# HG changeset patch
# User John Cremona <john.cremona@gmail.com>
# Date 1334071688 -3600
# Node ID e6f0a810663d47089fd475f77f4aea9df5ef1153
# Parent b6a386ca681dd0764a539b896dc2bc4e75bd811c
#12768: reviewer's patch
diff --git a/sage/databases/cremona.py b/sage/databases/cremona.py
a
|
b
|
|
280 | 280 | label = chr(k)*int(n//26 + 1) |
281 | 281 | return label |
282 | 282 | |
283 | | cremona_label_regex = re.compile(r'(\d+)([a-z]*)(\d*)') |
284 | | lmfdb_label_regex = re.compile(r'(\d+)\.([a-z]+)(\d*)') |
| 283 | cremona_label_regex = re.compile(r'(\d+)([a-z]*)(\d*)$') |
| 284 | lmfdb_label_regex = re.compile(r'(\d+)\.([a-z]+)(\d*)$') |
285 | 285 | |
286 | 286 | def parse_cremona_label(label): |
287 | 287 | """ |
… |
… |
|
292 | 292 | For this function, the curve number may be omitted, in which case |
293 | 293 | it defaults to 1. If the curve number and isogeny class are both |
294 | 294 | omitted (label is just a string representing a conductor), then |
295 | | the isogeny class defaults to 'a' and the number to 1. |
| 295 | the isogeny class defaults to 'a' and the number to 1. Valid |
| 296 | labels consist of one or more digits, followed by zero or more |
| 297 | letters (in either upper or lower case, which will be lowered), |
| 298 | followed by zero or more digits. |
296 | 299 | |
297 | 300 | INPUT: |
298 | 301 | |
… |
… |
|
313 | 316 | (37, 'b', 1) |
314 | 317 | sage: parse_cremona_label('10bb2') |
315 | 318 | (10, 'bb', 2) |
| 319 | sage: parse_cremona_label('11a') |
| 320 | (11, 'a', 1) |
| 321 | sage: parse_cremona_label('11') |
| 322 | (11, 'a', 1) |
| 323 | |
| 324 | TESTS:: |
| 325 | |
| 326 | sage: from sage.databases.cremona import parse_cremona_label |
| 327 | sage: parse_cremona_label('x11') |
| 328 | Traceback (most recent call last): |
| 329 | ... |
| 330 | ValueError: x11 is not a valid Cremona label |
316 | 331 | """ |
317 | 332 | m = cremona_label_regex.match(str(label).lower()) |
318 | 333 | if m is None: |
… |
… |
|
362 | 377 | EXAMPLES:: |
363 | 378 | |
364 | 379 | sage: from sage.databases.cremona import parse_lmfdb_label |
365 | | sage: parse_cremona_label('37.a2') |
| 380 | sage: parse_lmfdb_label('37.a2') |
366 | 381 | (37, 'a', 2) |
367 | | sage: parse_cremona_label('37.b') |
| 382 | sage: parse_lmfdb_label('37.b') |
368 | 383 | (37, 'b', 1) |
369 | | sage: parse_cremona_label('10.bb2') |
| 384 | sage: parse_lmfdb_label('10.bb2') |
370 | 385 | (10, 'bb', 2) |
371 | 386 | """ |
372 | 387 | m = lmfdb_label_regex.match(str(label).lower()) |
diff --git a/sage/schemes/elliptic_curves/ell_rational_field.py b/sage/schemes/elliptic_curves/ell_rational_field.py
a
|
b
|
|
3796 | 3796 | lexicographically by a-invariants. |
3797 | 3797 | |
3798 | 3798 | - if ``order`` is a list of curves, then the curves in the |
3799 | | class are reordered to be isogenous with the specified |
| 3799 | class are reordered to be isomorphic with the specified |
3800 | 3800 | list of curves. |
3801 | 3801 | |
3802 | 3802 | - ``use_tuple`` -- bool (default: True). Controls the output |
… |
… |
|
3806 | 3806 | |
3807 | 3807 | If ``use_tuple`` is False, returns a |
3808 | 3808 | :class:`sage.schemes.elliptic_curves.isogeny_class.IsogenyClass_EC_Rational` |
3809 | | instace. This object models a list of minimal models (with |
| 3809 | instance. This object models a list of minimal models (with |
3810 | 3810 | containment, index, etc based on isomorphism classes). It |
3811 | 3811 | also has methods for computing the isogeny matrix and the list |
3812 | 3812 | of isogenies between curves in this class. |
… |
… |
|
3977 | 3977 | deprecation("""For elliptic curves E over Q, isogeny_class(use_tuple=False) returns a class |
3978 | 3978 | that has methods producing the isogeny graph and list of lists of isogenies. |
3979 | 3979 | use_tuple=True (currently default) is deprecated.""", "Sage Version 5.0") |
3980 | | # After a year or so we should switch the default to use_tuple=False as the default and deprecate |
| 3980 | # After a year or so (in May 2013) we should switch the default to use_tuple=False as the default and deprecate |
3981 | 3981 | # the keyword argument |
3982 | 3982 | if return_maps: |
3983 | 3983 | return isoclass, isoclass.matrix(fill_matrix), isoclass.isogenies() |
… |
… |
|
4405 | 4405 | |
4406 | 4406 | E = self.minimal_model() |
4407 | 4407 | C = self.optimal_curve() |
4408 | | _, m = C.isogeny_class() |
| 4408 | m = C.isogeny_class(use_tuple=False).matrix() |
4409 | 4409 | ma = max(max(x) for x in m) |
4410 | 4410 | OmC = C.period_lattice().basis() |
4411 | 4411 | OmE = E.period_lattice().basis() |
diff --git a/sage/schemes/elliptic_curves/isogeny_class.py b/sage/schemes/elliptic_curves/isogeny_class.py
a
|
b
|
|
29 | 29 | from sage.rings.all import ZZ |
30 | 30 | from sage.misc.cachefunc import cached_method |
31 | 31 | from sage.misc.abstract_method import abstract_method |
32 | | from sage.schemes.elliptic_curves.ell_generic import EllipticCurve_generic |
| 32 | from sage.schemes.elliptic_curves.ell_rational_field import EllipticCurve_rational_field |
33 | 33 | |
34 | 34 | class IsogenyClass_EC(SageObject): |
35 | 35 | """ |
36 | 36 | Isogeny class of an elliptic curve. |
37 | 37 | |
38 | 38 | The current implementation chooses a curve from each isomorphism |
39 | | class in the isogeny class, since over Q there is a unique minimal |
40 | | model in each isomorphism class. |
| 39 | class in the isogeny class, since over Q there is a unique reduced |
| 40 | minimal model in each isomorphism class. |
41 | 41 | |
42 | 42 | EXAMPLES:: |
43 | 43 | |
… |
… |
|
122 | 122 | 2 |
123 | 123 | """ |
124 | 124 | # This will need updating once we start talking about curves over more general number fields |
125 | | if not isinstance(C, EllipticCurve_generic): |
| 125 | if not isinstance(C, EllipticCurve_rational_field): |
126 | 126 | raise ValueError("x not in isogeny class") |
127 | 127 | return self.curves.index(C.minimal_model()) |
128 | 128 | |
… |
… |
|
219 | 219 | sage: E.short_weierstrass_model() in cls |
220 | 220 | True |
221 | 221 | """ |
222 | | if not isinstance(x, EllipticCurve_generic): |
| 222 | if not isinstance(x, EllipticCurve_rational_field): |
223 | 223 | return False |
224 | 224 | return x.minimal_model() in self.curves |
225 | 225 | |
… |
… |
|
571 | 571 | |
572 | 572 | sage: isocls = EllipticCurve('389a1').isogeny_class(use_tuple=False); isocls |
573 | 573 | Elliptic curve isogeny class 389a |
| 574 | sage: E = EllipticCurve([1, -1, 0, -53594, 4788959]) # conductor 10001 |
| 575 | sage: E.isogeny_class(use_tuple=False, order='database') |
| 576 | Traceback (most recent call last): |
| 577 | ... |
| 578 | RuntimeError: unable to to find Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 53594*x + 4788959 over Rational Field in the database |
574 | 579 | sage: TestSuite(isocls).run() |
575 | 580 | """ |
576 | 581 | self._algorithm = algorithm |
… |
… |
|
632 | 637 | try: |
633 | 638 | label = self.E.cremona_label(space=False) |
634 | 639 | except RuntimeError: |
635 | | raise RuntimeError("unable to to find %s in the database"%self) |
| 640 | raise RuntimeError("unable to to find %s in the database"%self.E) |
636 | 641 | db = sage.databases.cremona.CremonaDatabase() |
637 | 642 | curves = db.isogeny_class(label) |
638 | 643 | if len(curves) == 0: |
639 | | raise RuntimeError("unable to to find %s in the database"%self) |
| 644 | raise RuntimeError("unable to to find %s in the database"%self.E) |
640 | 645 | # All curves will have the same conductor and isogeny class, |
641 | 646 | # and there are are most 8 of them, so lexicographic sorting is okay. |
642 | 647 | self.curves = tuple(sorted(curves, key = lambda E: E.cremona_label())) |