Ticket #12768: 12768-review.patch

File 12768-review.patch, 7.3 KB (added by cremona, 10 years ago)

Apply after previous

  • sage/databases/cremona.py

    # 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  
    280280    label = chr(k)*int(n//26 + 1)
    281281    return label
    282282
    283 cremona_label_regex = re.compile(r'(\d+)([a-z]*)(\d*)')
    284 lmfdb_label_regex = re.compile(r'(\d+)\.([a-z]+)(\d*)')
     283cremona_label_regex = re.compile(r'(\d+)([a-z]*)(\d*)$')
     284lmfdb_label_regex = re.compile(r'(\d+)\.([a-z]+)(\d*)$')
    285285
    286286def parse_cremona_label(label):
    287287    """
     
    292292    For this function, the curve number may be omitted, in which case
    293293    it defaults to 1.  If the curve number and isogeny class are both
    294294    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.
    296299
    297300    INPUT:
    298301
     
    313316        (37, 'b', 1)
    314317        sage: parse_cremona_label('10bb2')
    315318        (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
    316331    """
    317332    m = cremona_label_regex.match(str(label).lower())
    318333    if m is None:
     
    362377    EXAMPLES::
    363378
    364379        sage: from sage.databases.cremona import parse_lmfdb_label
    365         sage: parse_cremona_label('37.a2')
     380        sage: parse_lmfdb_label('37.a2')
    366381        (37, 'a', 2)
    367         sage: parse_cremona_label('37.b')
     382        sage: parse_lmfdb_label('37.b')
    368383        (37, 'b', 1)
    369         sage: parse_cremona_label('10.bb2')
     384        sage: parse_lmfdb_label('10.bb2')
    370385        (10, 'bb', 2)
    371386    """
    372387    m = lmfdb_label_regex.match(str(label).lower())
  • sage/schemes/elliptic_curves/ell_rational_field.py

    diff --git a/sage/schemes/elliptic_curves/ell_rational_field.py b/sage/schemes/elliptic_curves/ell_rational_field.py
    a b  
    37963796            lexicographically by a-invariants.
    37973797
    37983798          - 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
    38003800            list of curves.
    38013801
    38023802        - ``use_tuple`` -- bool (default: True).  Controls the output
     
    38063806
    38073807        If ``use_tuple`` is False, returns a
    38083808        :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
    38103810        containment, index, etc based on isomorphism classes).  It
    38113811        also has methods for computing the isogeny matrix and the list
    38123812        of isogenies between curves in this class.
     
    39773977            deprecation("""For elliptic curves E over Q, isogeny_class(use_tuple=False) returns a class
    39783978that has methods producing the isogeny graph and list of lists of isogenies.
    39793979use_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
    39813981            # the keyword argument
    39823982            if return_maps:
    39833983                return isoclass, isoclass.matrix(fill_matrix), isoclass.isogenies()
     
    44054405
    44064406        E = self.minimal_model()
    44074407        C = self.optimal_curve()
    4408         _, m = C.isogeny_class()
     4408        m = C.isogeny_class(use_tuple=False).matrix()
    44094409        ma = max(max(x) for x in m)
    44104410        OmC = C.period_lattice().basis()
    44114411        OmE = E.period_lattice().basis()
  • sage/schemes/elliptic_curves/isogeny_class.py

    diff --git a/sage/schemes/elliptic_curves/isogeny_class.py b/sage/schemes/elliptic_curves/isogeny_class.py
    a b  
    2929from sage.rings.all import ZZ
    3030from sage.misc.cachefunc import cached_method
    3131from sage.misc.abstract_method import abstract_method
    32 from sage.schemes.elliptic_curves.ell_generic import EllipticCurve_generic
     32from sage.schemes.elliptic_curves.ell_rational_field import EllipticCurve_rational_field
    3333
    3434class IsogenyClass_EC(SageObject):
    3535    """
    3636    Isogeny class of an elliptic curve.
    3737
    3838    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.
    4141
    4242    EXAMPLES::
    4343
     
    122122            2
    123123        """
    124124        # 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):
    126126            raise ValueError("x not in isogeny class")
    127127        return self.curves.index(C.minimal_model())
    128128
     
    219219            sage: E.short_weierstrass_model() in cls
    220220            True
    221221        """
    222         if not isinstance(x, EllipticCurve_generic):
     222        if not isinstance(x, EllipticCurve_rational_field):
    223223            return False
    224224        return x.minimal_model() in self.curves
    225225
     
    571571
    572572            sage: isocls = EllipticCurve('389a1').isogeny_class(use_tuple=False); isocls
    573573            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
    574579            sage: TestSuite(isocls).run()
    575580        """
    576581        self._algorithm = algorithm
     
    632637            try:
    633638                label = self.E.cremona_label(space=False)
    634639            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)
    636641            db = sage.databases.cremona.CremonaDatabase()
    637642            curves = db.isogeny_class(label)
    638643            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)
    640645            # All curves will have the same conductor and isogeny class,
    641646            # and there are are most 8 of them, so lexicographic sorting is okay.
    642647            self.curves = tuple(sorted(curves, key = lambda E: E.cremona_label()))