Skip to content

Commit

Permalink
sagemathgh-37132: Fix corners cases of free resolutions
Browse files Browse the repository at this point in the history
    
<!-- ^^^^^
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 -->
as seen in
```sage
sage: P2.<x,y,z> = ProjectiveSpace(QQ, 2)
sage: S = P2.coordinate_ring()
sage: I = S.ideal(0)
sage: C = I.graded_free_resolution(); C
S(0) <-- 0
sage: C[1]
Ambient free module of rank 0 over the integral domain Multivariate
Polynomial Ring in x, y, z over Rational Field
sage: C[0]
------------------------------------------------------------------------
---
IndexError                                Traceback (most recent call
last)
Cell In[5], line 1
----> 1 C[Integer(0)]

File ~/GitHub/sage/src/sage/homology/free_resolution.py:426, in
FiniteFreeResolution.__getitem__(self, i)
    424     F = FreeModule(self._base_ring, 0)
    425 elif i == self._length:
--> 426     F = FreeModule(self._base_ring, self._maps[i - 1].ncols())
    427 else:
    428     F = FreeModule(self._base_ring, self._maps[i].nrows())

IndexError: list index out of range
sage: C.differential(1)
------------------------------------------------------------------------
---
IndexError                                Traceback (most recent call
last)
Cell In[6], line 1
----> 1 C.differential(Integer(1))

File ~/GitHub/sage/src/sage/homology/free_resolution.py:489, in
FiniteFreeResolution.differential(self, i)
    487 elif i == self._length + 1:
    488     s = FreeModule(self._base_ring, 0)
--> 489     t = FreeModule(self._base_ring, self._maps[i - 2].ncols())
    490     m = s.hom(0, t)
    491 elif i > self._length + 1:

IndexError: list index out of range
```


<!-- 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.
- [ ] I have linked a relevant issue or discussion.
- [x] 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#37132
Reported by: Kwankyu Lee
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Jan 26, 2024
2 parents 4474f85 + 162163c commit 87ba4b8
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 87ba4b8

Please sign in to comment.