Ticket #12853: trac_12853.patch

File trac_12853.patch, 3.8 KB (added by jdemeyer, 10 years ago)
  • sage/schemes/elliptic_curves/ell_rational_field.py

    # HG changeset patch
    # User Andrey Novoseltsev <novoselt@gmail.com>
    # Date 1334784040 21600
    # Node ID a9b3c3ae050a031c6037725dfcf815165d850013
    # Parent  7d8ac0ee679de0e5eeba4966fe280f5f65295472
    Speed up elliptic_curve integral_points() by pre-computing torsion points
    
    diff --git a/sage/schemes/elliptic_curves/ell_rational_field.py b/sage/schemes/elliptic_curves/ell_rational_field.py
    a b  
    51395139            983886013344700707678587482584/141566320009,\
    51405140            1124614335716851053281176544216033/152487126016]
    51415141            sage: points = [E.lift_x(x) for x in xi]
    5142             sage: newpoints, U = E.lll_reduce(points)  # long time (35s on sage.math, 2011)
     5142            sage: newpoints, U = E.lll_reduce(points)  # long time (36s on sage.math, 2011)
    51435143            sage: [P[0] for P in newpoints]            # long time
    51445144            [6823803569166584943, 5949539878899294213, 2005024558054813068, 5864879778877955778, 23955263915878682727/4, 5922188321411938518, 5286988283823825378, 175620639884534615751/25, -11451575907286171572, 3502708072571012181, 1500143935183238709184/225, 27180522378120223419/4, -5811874164190604461581/625, 26807786527159569093, 7404442636649562303, 475656155255883588, 265757454726766017891/49, 7272142121019825303, 50628679173833693415/4, 6951643522366348968, 6842515151518070703, 111593750389650846885/16, 2607467890531740394315/9, -1829928525835506297]
    51455145        """
     
    53205320            sage: P1=E.point((540,1188)); P2=E.point((576,1836))
    53215321            sage: P3=E.point((468,3132)); P4=E.point((612,3132))
    53225322            sage: P5=E.point((432,4428))
    5323             sage: a=E.integral_points([P1,P2,P3,P4,P5]); len(a)  # long time (34s on sage.math, 2011)
     5323            sage: a=E.integral_points([P1,P2,P3,P4,P5]); len(a)  # long time (18s on sage.math, 2011)
    53245324            54
    53255325       
    53265326        TESTS:
     
    57285728           
    57295729        Output checked with Magma (corrected in 3 cases)::
    57305730       
    5731             sage: [len(e.S_integral_points([2], both_signs=False)) for e in cremona_curves([11..100])] # long time (19s on sage.math, 2011)
     5731            sage: [len(e.S_integral_points([2], both_signs=False)) for e in cremona_curves([11..100])] # long time (17s on sage.math, 2011)
    57325732            [2, 0, 2, 3, 3, 1, 3, 1, 3, 5, 3, 5, 4, 1, 1, 2, 2, 2, 3, 1, 2, 1, 0, 1, 3, 3, 1, 1, 5, 3, 4, 2, 1, 1, 5, 3, 2, 2, 1, 1, 1, 0, 1, 3, 0, 1, 0, 1, 1, 3, 7, 1, 3, 3, 3, 1, 1, 2, 3, 1, 2, 3, 1, 2, 1, 3, 3, 1, 1, 1, 0, 1, 3, 3, 1, 1, 7, 1, 0, 1, 1, 0, 1, 2, 0, 3, 1, 2, 1, 3, 1, 2, 2, 4, 5, 3, 2, 1, 1, 6, 1, 0, 1, 3, 1, 3, 3, 1, 1, 1, 1, 1, 3, 1, 5, 1, 2, 4, 1, 1, 1, 1, 1, 0, 1, 0, 2, 2, 0, 0, 1, 0, 1, 1, 6, 1, 0, 1, 1, 0, 4, 3, 1, 2, 1, 2, 3, 1, 1, 1, 1, 8, 3, 1, 2, 1, 2, 0, 8, 2, 0, 6, 2, 3, 1, 1, 1, 3, 1, 3, 2, 1, 3, 1, 2, 1, 6, 9, 3, 3, 1, 1, 2, 3, 1, 1, 5, 5, 1, 1, 0, 1, 1, 2, 3, 1, 1, 2, 3, 1, 3, 1, 1, 1, 1, 0, 0, 1, 3, 3, 1, 3, 1, 1, 2, 2, 0, 0, 6, 1, 0, 1, 1, 1, 1, 3, 1, 2, 6, 3, 1, 2, 2, 1, 1, 1, 1, 7, 5, 4, 3, 3, 1, 1, 1, 1, 1, 1, 8, 5, 1, 1, 3, 3, 1, 1, 3, 3, 1, 1, 2, 3, 6, 1, 1, 7, 3, 3, 4, 5, 9, 6, 1, 0, 7, 1, 1, 3, 1, 1, 2, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 7, 8, 2, 3, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1]
    57335733
    57345734        An example from [PZGH]::
     
    64166416    for i in range(1,r):
    64176417        RPi[i] = RPi[i-1] + RgensN[i]   
    64186418
     6419    tors_points_R = map(ER, tors_points)
    64196420    while True:
    64206421        if all([n==0 for n in ni]):
    64216422             use_t(E(0))
     
    64246425        # test the ni-combination which is RPi[r-1]
    64256426        RP = RPi[r-1]
    64266427
    6427         for T in tors_points:
    6428             if is_approx_integral(RP+ER(T)):
     6428        for T, TR in zip(tors_points, tors_points_R):
     6429            if is_approx_integral(RP + TR):
    64296430                 P = sum([ni[i]*mw_base[i] for i in range(r)],T)
    64306431                 use(P)
    64316432