void-packages/srcpkgs/sagemath/patches/11-fix_very_slow_doctest-isogeny_small_degree.patch
2022-02-03 14:31:06 +01:00

107 lines
8.7 KiB
Diff

diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
index 43727346269..9d3ccd475cd 100644
--- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
@@ -186,7 +186,7 @@ def Psi(l, use_stored=True):
sage: assert Psi(3, use_stored=True) == Psi(3, use_stored=False)
sage: assert Psi(5, use_stored=True) == Psi(5, use_stored=False)
sage: assert Psi(7, use_stored=True) == Psi(7, use_stored=False)
- sage: assert Psi(13, use_stored=True) == Psi(13, use_stored=False) # not tested (very long time)
+ sage: assert Psi(13, use_stored=True) == Psi(13, use_stored=False) # long time (2s)
"""
if l not in [2, 3, 5, 7, 13]:
raise ValueError("Genus zero primes are 2, 3, 5, 7 or 13.")
@@ -1207,7 +1207,7 @@ def isogenies_13_0(E, minimal_models=True):
sage: K.<a> = NumberField(f)
sage: E = EllipticCurve(j=K(0)); E.ainvs()
(0, 0, 0, 0, 1)
- sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)]
+ sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)] # long time (4s)
[(0,
0,
20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 - 101/8789110986240*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 - 19487/21127670640*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 + 8349/521670880*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 58759402/48906645,
@@ -1325,7 +1325,7 @@ def isogenies_13_1728(E, minimal_models=True):
sage: f = x^12 + 1092*x^10 - 432432*x^8 + 6641024*x^6 - 282896640*x^4 - 149879808*x^2 - 349360128
sage: K.<a> = NumberField(f)
sage: E = EllipticCurve(K, [1,0])
- sage: [phi.codomain().ainvs() for phi in isogenies_13_1728(E)]
+ sage: [phi.codomain().ainvs() for phi in isogenies_13_1728(E)] # long time (3s)
[(0,
0,
0,
@@ -1550,8 +1550,11 @@ def Psi2(l):
sage: from sage.schemes.elliptic_curves.isogeny_small_degree import Psi2
sage: Psi2(11)
x^5 - 55*x^4*u + 994*x^3*u^2 - 8774*x^2*u^3 + 41453*x*u^4 - 928945/11*u^5 + 33*x^4 + 276*x^3*u - 7794*x^2*u^2 + 4452*x*u^3 + 1319331/11*u^4 + 216*x^3*v - 4536*x^2*u*v + 31752*x*u^2*v - 842616/11*u^3*v + 162*x^3 + 38718*x^2*u - 610578*x*u^2 + 33434694/11*u^3 - 4536*x^2*v + 73872*x*u*v - 2745576/11*u^2*v - 16470*x^2 + 580068*x*u - 67821354/11*u^2 - 185976*x*v + 14143896/11*u*v + 7533*x - 20437029/11*u - 12389112/11*v + 19964151/11
- sage: Psi2(71) # long time (1 second)
- -2209380711722505179506258739515288584116147237393815266468076436521/71*u^210 + ... - 14790739586438315394567393301990769678157425619440464678252277649/71
+ sage: f = Psi2(71)
+ sage: f.coefficient([0, 210, 0])
+ -2209380711722505179506258739515288584116147237393815266468076436521/71
+ sage: f.coefficient([0, 0, 0])
+ -14790739586438315394567393301990769678157425619440464678252277649/71
TESTS::
@@ -1665,17 +1668,17 @@ def isogenies_prime_degree_genus_plus_0(E, l=None, minimal_models=True):
sage: K = QuadraticField(5,'a')
sage: a = K.gen()
sage: E = EllipticCurve_from_j(184068066743177379840*a - 411588709724712960000)
- sage: isogenies_prime_degree_genus_plus_0(E, 47) # long time (4.3s)
+ sage: isogenies_prime_degree_genus_plus_0(E, 47) # long time (2s)
[Isogeny of degree 47 from Elliptic Curve defined by y^2 = x^3 + (454562028554080355857852049849975895490560*a-1016431595837124114668689286176511361024000)*x + (-249456798429896080881440540950393713303830363999480904280965120*a+557802358738710443451273320227578156598454035482869042774016000) over Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? to Elliptic Curve defined by y^2 = x^3 + (39533118442361013730577638493616965245992960*a-88398740199669828340617478832005245173760000)*x + (214030321479466610282320528611562368963830105830555363061803253760*a-478586348074220699687616322532666163722004497458452316582576128000) over Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790?]
sage: K = QuadraticField(-66827,'a')
sage: a = K.gen()
sage: E = EllipticCurve_from_j(-98669236224000*a + 4401720074240000)
- sage: isogenies_prime_degree_genus_plus_0(E, 59) # long time (25s, 2012)
+ sage: isogenies_prime_degree_genus_plus_0(E, 59) # long time (5s)
[Isogeny of degree 59 from Elliptic Curve defined by y^2 = x^3 + (2605886146782144762297974784000*a+1893681048912773634944634716160000)*x + (-116918454256410782232296183198067568744071168000*a+17012043538294664027185882358514011304812871680000) over Number Field in a with defining polynomial x^2 + 66827 with a = 258.5091874576221?*I to Elliptic Curve defined by y^2 = x^3 + (-19387084027159786821400775098368000*a-4882059104868154225052787156713472000)*x + (-25659862010101415428713331477227179429538847260672000*a-2596038148441293485938798119003462972840818381946880000) over Number Field in a with defining polynomial x^2 + 66827 with a = 258.5091874576221?*I]
sage: E = EllipticCurve_from_j(GF(13)(5))
- sage: isogenies_prime_degree_genus_plus_0(E, 71) # long time
+ sage: isogenies_prime_degree_genus_plus_0(E, 71)
[Isogeny of degree 71 from Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 10*x + 7 over Finite Field of size 13, Isogeny of degree 71 from Elliptic Curve defined by y^2 = x^3 + x + 4 over Finite Field of size 13 to Elliptic Curve defined by y^2 = x^3 + 10*x + 7 over Finite Field of size 13]
sage: E = EllipticCurve(GF(13),[0,1,1,1,0])
@@ -2117,11 +2120,11 @@ def isogenies_prime_degree_general(E, l, minimal_models=True):
sage: isogenies_prime_degree_general(E, 19)
[Isogeny of degree 19 from Elliptic Curve defined by y^2 + y = x^3 - 1862*x - 30956 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - 672182*x + 212325489 over Rational Field]
sage: E = EllipticCurve([0, -1, 0, -6288, 211072])
- sage: isogenies_prime_degree_general(E, 37) # long time (10s)
+ sage: isogenies_prime_degree_general(E, 37) # long time (2s)
[Isogeny of degree 37 from Elliptic Curve defined by y^2 = x^3 - x^2 - 6288*x + 211072 over Rational Field to Elliptic Curve defined by y^2 = x^3 - x^2 - 163137088*x - 801950801728 over Rational Field]
sage: E = EllipticCurve([-3440, 77658])
- sage: isogenies_prime_degree_general(E, 43) # long time (16s)
+ sage: isogenies_prime_degree_general(E, 43) # long time (2s)
[Isogeny of degree 43 from Elliptic Curve defined by y^2 = x^3 - 3440*x + 77658 over Rational Field to Elliptic Curve defined by y^2 = x^3 - 6360560*x - 6174354606 over Rational Field]
Isogenies of degree equal to the characteristic are computed (but
@@ -2175,7 +2178,7 @@ def isogenies_prime_degree_general(E, l, minimal_models=True):
sage: K.<i> = QuadraticField(-1)
sage: E = EllipticCurve(K,[0,0,0,1,0])
- sage: [phi.codomain().ainvs() for phi in E.isogenies_prime_degree(37)] # long time
+ sage: [phi.codomain().ainvs() for phi in E.isogenies_prime_degree(37)] # long time (6s)
[(0, 0, 0, -840*i + 1081, 0), (0, 0, 0, 840*i + 1081, 0)]
"""
if not l.is_prime():
@@ -2329,14 +2332,14 @@ def isogenies_prime_degree(E, l, minimal_models=True):
sage: E = EllipticCurve(GF(101), [-3440, 77658])
sage: E.isogenies_prime_degree(71) # fast
[]
- sage: E.isogenies_prime_degree(73) # slower (2s)
+ sage: E.isogenies_prime_degree(73) # long time (2s)
[]
Test that :trac:`32269` is fixed::
sage: K = QuadraticField(-11)
sage: E = EllipticCurve(K, [0,1,0,-117,-541])
- sage: E.isogenies_prime_degree(37)
+ sage: E.isogenies_prime_degree(37) # long time (9s)
[Isogeny of degree 37 from Elliptic Curve defined by y^2 = x^3 + x^2 + (-117)*x + (-541) over Number Field in a with defining polynomial x^2 + 11 with a = 3.316624790355400?*I to Elliptic Curve defined by y^2 = x^3 + x^2 + (30800*a+123963)*x + (3931312*a-21805005) over Number Field in a with defining polynomial x^2 + 11 with a = 3.316624790355400?*I,
Isogeny of degree 37 from Elliptic Curve defined by y^2 = x^3 + x^2 + (-117)*x + (-541) over Number Field in a with defining polynomial x^2 + 11 with a = 3.316624790355400?*I to Elliptic Curve defined by y^2 = x^3 + x^2 + (-30800*a+123963)*x + (-3931312*a-21805005) over Number Field in a with defining polynomial x^2 + 11 with a = 3.316624790355400?*I]