Skip to content

Commit 1bc98df

Browse files
author
Release Manager
committed
gh-39572: Change some instances of "gens" method to return tuples <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> Contributes to #34120 As noted in the referenced issue. most instances of the "gens" method return tuples, so the few instances of the method which return lists instead should be modified to return tuples. This pull request handles the following bullet points from the issue: - `SymmetricReductionStrategy` in `src/sage/rings/polynomial/symmetric_reduction.pyx` - `EllipticCurve_number_field` in `src/sage/schemes/elliptic_curves/ell_number_field.py` - `SpecialCubicQuotientRing` in `src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py` In each case the gens method from the mentioned class has been modified to return a tuple instead of a list and doctests have been updated appropriately. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [X] The title is concise and informative. - [X] The description explains in detail what this PR is about. - [X] I have linked a relevant issue or discussion. - [X] I have created tests covering the changes. - [X] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #39572 Reported by: Caleb Van't Land Reviewer(s): Vincent Macri
2 parents 8806c7c + b9275d7 commit 1bc98df

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/sage/rings/polynomial/symmetric_reduction.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,9 @@ cdef class SymmetricReductionStrategy:
254254
return richcmp((left._parent, left._lm, left._tail),
255255
(right._parent, right._lm, right._tail), op)
256256

257-
def gens(self) -> list:
257+
def gens(self) -> tuple:
258258
"""
259-
Return the list of Infinite Polynomials modulo which ``self`` reduces.
259+
Return the tuple of Infinite Polynomials modulo which ``self`` reduces.
260260

261261
EXAMPLES::
262262

@@ -269,9 +269,9 @@ cdef class SymmetricReductionStrategy:
269269
y_2*y_1^2,
270270
y_2^2*y_1
271271
sage: S.gens()
272-
[y_2*y_1^2, y_2^2*y_1]
272+
(y_2*y_1^2, y_2^2*y_1)
273273
"""
274-
return self._lm
274+
return tuple(self._lm)
275275

276276
def setgens(self, L):
277277
"""

src/sage/schemes/elliptic_curves/ell_number_field.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def base_extend(self, R):
158158
[(52 : 111 : 1)]
159159
sage: EK = E.base_extend(K)
160160
sage: EK.gens()
161-
[(52 : 111 : 1)]
161+
((52 : 111 : 1),)
162162
"""
163163
E = super().base_extend(R)
164164
if isinstance(E, EllipticCurve_number_field):
@@ -2328,21 +2328,21 @@ def gens(self, **kwds):
23282328
sage: K.<a> = NumberField(x^2 + 23, 'a')
23292329
sage: E = EllipticCurve(K,[0,0,0,101,0])
23302330
sage: E.gens()
2331-
[(23831509/8669448*a - 2867471/8669448 : 76507317707/18049790736*a - 424166479633/18049790736 : 1),
2331+
((23831509/8669448*a - 2867471/8669448 : 76507317707/18049790736*a - 424166479633/18049790736 : 1),
23322332
(-2031032029/969232392*a + 58813561/969232392 : -15575984630401/21336681877488*a + 451041199309/21336681877488 : 1),
2333-
(-186948623/4656964 : 549438861195/10049728312*a : 1)]
2333+
(-186948623/4656964 : 549438861195/10049728312*a : 1))
23342334
23352335
It can happen that no points are found if the height bounds
23362336
used in the search are too small (see :issue:`10745`)::
23372337
23382338
sage: K.<t> = NumberField(x^4 + x^2 - 7)
23392339
sage: E = EllipticCurve(K, [1, 0, 5*t^2 + 16, 0, 0])
23402340
sage: E.gens(lim1=1, lim3=1)
2341-
[]
2341+
()
23422342
sage: E.rank()
23432343
1
23442344
sage: gg=E.gens(lim3=13); gg # long time (about 4s)
2345-
[(... : 1)]
2345+
((... : 1),)
23462346
23472347
Check that the point found has infinite order, and that it is on the curve::
23482348
@@ -2356,7 +2356,7 @@ def gens(self, **kwds):
23562356
sage: K.<t> = NumberField(x^2 - 17)
23572357
sage: E = EllipticCurve(K, [-4, 0])
23582358
sage: E.gens()
2359-
[(-1/2*t + 1/2 : -1/2*t + 1/2 : 1), (-t + 3 : -2*t + 10 : 1)]
2359+
((-1/2*t + 1/2 : -1/2*t + 1/2 : 1), (-t + 3 : -2*t + 10 : 1))
23602360
sage: E.rank()
23612361
2
23622362
@@ -2368,7 +2368,7 @@ def gens(self, **kwds):
23682368
sage: EK.rank()
23692369
0
23702370
sage: EK.gens()
2371-
[]
2371+
()
23722372
23732373
IMPLEMENTATION:
23742374
@@ -2378,10 +2378,10 @@ def gens(self, **kwds):
23782378
PARI/GP scripts from http://www.math.unicaen.fr/~simon/.
23792379
"""
23802380
try:
2381-
return self.gens_quadratic(**kwds)
2381+
return tuple(self.gens_quadratic(**kwds))
23822382
except ValueError:
23832383
self.simon_two_descent(**kwds)
2384-
return self._known_points
2384+
return tuple(self._known_points)
23852385

23862386
def period_lattice(self, embedding):
23872387
r"""

src/sage/schemes/hyperelliptic_curves/monsky_washnitzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ def poly_ring(self):
572572

573573
def gens(self):
574574
"""
575-
Return a list [x, T] where x and T are the generators of the ring
575+
Return a tuple (x, T) where x and T are the generators of the ring
576576
(as element *of this ring*).
577577
578578
.. NOTE::

0 commit comments

Comments
 (0)