Ticket #3869 (closed defect: fixed)

Opened 3 months ago

Last modified 3 months ago

[with patch, positive review] CremonaDatabase functions iter() and isogeny_classes() sort keys wrongly

Reported by: cremona Assigned to: cremona
Priority: minor Milestone: sage-3.1.2
Component: number theory Keywords: elliptic curve database
Cc:

Description

Example:

sage: CDB=CremonaDatabase()    
sage: [[EllipticCurve(ai[0]).label() for ai in C] for C in CDB.isogeny_classes(1728)]

[['1728a1', '1728a2', '1728a3', '1728a4'],
 ['1728b1'],
 ['1728ba1'],
 ['1728bb1', '1728bb2', '1728bb3'],
 ['1728c1'],
 ['1728d1'],
 ['1728e1', '1728e2', '1728e3'],
 ['1728f1', '1728f2'],
 ['1728g1'],
 ['1728h1'],
 ['1728i1'],
 ['1728j1', '1728j2', '1728j3'],
 ['1728k1'],
 ['1728l1'],
 ['1728m1', '1728m2'],
 ['1728n1'],
 ['1728o1'],
 ['1728p1'],
 ['1728q1'],
 ['1728r1'],
 ['1728s1', '1728s2', '1728s3'],
 ['1728t1'],
 ['1728u1'],
 ['1728v1', '1728v2', '1728v3', '1728v4'],
 ['1728w1'],
 ['1728x1'],
 ['1728y1'],
 ['1728z1']]

The keys are strings like '1728a1',...,'1728z1','1728ba1',... and these a wrongly sorted by the standard sort function. What this means is that when iterating through the database, the isogeny classes are not listed in the standard order a,b,...,z,ba,bb,...,bz,...

In the above example, classes ba and bb should come after class z, and not between classes b and c.

Attachments

sage-trac3869.patch (2.8 kB) - added by cremona on 08/15/2008 03:27:39 AM.
trac3869-extra-doctest.patch (0.9 kB) - added by cwitty on 08/23/2008 02:35:01 PM.

Change History

08/15/2008 03:27:39 AM changed by cremona

  • attachment sage-trac3869.patch added.

08/15/2008 03:29:33 AM changed by cremona

The attached patch fixes this by defining a new cmp function for curve codes which gets it right.

This should apply to 3.1.

I have doctested the new functions, and also checked that ell_rational_field doctests ok.

08/15/2008 03:31:51 AM changed by mabshoff

  • summary changed from CremonaDatabase functions iter() and isogeny_classes() sort keys wrongly to [with patch, needs review] CremonaDatabase functions iter() and isogeny_classes() sort keys wrongly.

:)

Cheers,

Michael

08/23/2008 02:35:01 PM changed by cwitty

  • attachment trac3869-extra-doctest.patch added.

08/23/2008 02:35:34 PM changed by cwitty

  • summary changed from [with patch, needs review] CremonaDatabase functions iter() and isogeny_classes() sort keys wrongly to [with patch, positive review] CremonaDatabase functions iter() and isogeny_classes() sort keys wrongly.

Looks good to me.

I added one more doctest; both patches should be applied.

08/24/2008 01:51:42 AM changed by cremona

I like the extra doctest! Thanks.

08/24/2008 07:58:29 PM changed by mabshoff

  • status changed from new to closed.
  • resolution set to fixed.

Merged sage-trac3869.patch and trac3869-extra-doctest.patch in Sage 3.1.2.alpha1