Skip to content

Commit

Permalink
sagemathgh-36516: sage.schemes.toric: Remove pyright 'is possibly u…
Browse files Browse the repository at this point in the history
…nbound' warnings

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->
Just a single commit split out from sagemath#36443 to facilitate review.

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36516
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Oct 28, 2023
2 parents dd4dfe7 + a532055 commit 9dde1bd
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/sage/schemes/toric/variety.py
Original file line number Diff line number Diff line change
Expand Up @@ -2258,20 +2258,21 @@ def Todd_class(self, deg=None):
1
"""
Td = QQ.one()
if self.dimension() >= 1:
dim = self.dimension()
if dim >= 1:
c1 = self.Chern_class(1)
Td += QQ.one() / 2 * c1
if self.dimension() >= 2:
c2 = self.Chern_class(2)
Td += QQ.one() / 12 * (c1**2 + c2)
if self.dimension() >= 3:
Td += QQ.one() / 24 * c1*c2
if self.dimension() >= 4:
c3 = self.Chern_class(3)
c4 = self.Chern_class(4)
Td += -QQ.one() / 720 * (c1**4 - 4*c1**2*c2 - 3*c2**2 - c1*c3 + c4)
if self.dimension() >= 5:
raise NotImplementedError('Todd class is currently only implemented up to degree 4')
if dim >= 2:
c2 = self.Chern_class(2)
Td += QQ.one() / 12 * (c1**2 + c2)
if dim >= 3:
Td += QQ.one() / 24 * c1*c2
if dim >= 4:
c3 = self.Chern_class(3)
c4 = self.Chern_class(4)
Td += -QQ.one() / 720 * (c1**4 - 4*c1**2*c2 - 3*c2**2 - c1*c3 + c4)
if dim >= 5:
raise NotImplementedError('Todd class is currently only implemented up to degree 4')
if deg is None:
return Td
else:
Expand Down

0 comments on commit 9dde1bd

Please sign in to comment.