Skip to content

Commit 14ca9e2

Browse files
committed
Fix caching for Khuri-Makdisi Jacobian implementation
1 parent 9352a32 commit 14ca9e2

File tree

1 file changed

+4
-35
lines changed

1 file changed

+4
-35
lines changed

src/sage/rings/function_field/jacobian_khuri_makdisi.py

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
6969
EXAMPLES::
7070
71-
sage: # long time
7271
sage: P2.<x,y,z> = ProjectiveSpace(GF(17), 2)
7372
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
7473
sage: F = C.function_field()
@@ -155,7 +154,6 @@ class JacobianPoint(JacobianPoint_base):
155154
156155
EXAMPLES::
157156
158-
sage: # long time
159157
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
160158
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
161159
sage: b = C([0,1,0]).place()
@@ -178,7 +176,6 @@ def __init__(self, parent, w):
178176
179177
TESTS::
180178
181-
sage: # long time
182179
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
183180
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
184181
sage: b = C([0,1,0]).place()
@@ -199,7 +196,6 @@ def _repr_(self):
199196
200197
EXAMPLES::
201198
202-
sage: # long time
203199
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
204200
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
205201
sage: h = C.function(y/x).divisor_of_poles()
@@ -222,7 +218,6 @@ def __hash__(self):
222218
223219
EXAMPLES::
224220
225-
sage: # long time
226221
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
227222
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
228223
sage: F = C.function_field()
@@ -247,7 +242,6 @@ def _richcmp_(self, other, op):
247242
248243
EXAMPLES::
249244
250-
sage: # long time
251245
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
252246
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
253247
sage: h = C.function(y/x).divisor_of_poles()
@@ -281,7 +275,6 @@ def _add_(self, other):
281275
282276
EXAMPLES::
283277
284-
sage: # long time
285278
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
286279
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
287280
sage: h = C.function(y/x).divisor_of_poles()
@@ -313,7 +306,6 @@ def _neg_(self):
313306
314307
EXAMPLES::
315308
316-
sage: # long time
317309
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
318310
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
319311
sage: F = C.function_field()
@@ -348,7 +340,6 @@ def _rmul_(self, n):
348340
349341
EXAMPLES::
350342
351-
sage: # long time
352343
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
353344
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
354345
sage: h = C.function(y/x).divisor_of_poles()
@@ -372,7 +363,6 @@ def multiple(self, n):
372363
373364
EXAMPLES::
374365
375-
sage: # long time
376366
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
377367
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
378368
sage: h = C.function(y/x).divisor_of_poles()
@@ -404,7 +394,6 @@ def addflip(self, other):
404394
405395
EXAMPLES::
406396
407-
sage: # long time
408397
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
409398
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
410399
sage: h = C.function(y/x).divisor_of_poles()
@@ -437,7 +426,6 @@ def defining_matrix(self):
437426
438427
EXAMPLES::
439428
440-
sage: # long time
441429
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
442430
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
443431
sage: h = C.function(y/x).divisor_of_poles()
@@ -462,7 +450,6 @@ def divisor(self):
462450
463451
EXAMPLES::
464452
465-
sage: # long time
466453
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
467454
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
468455
sage: F = C.function_field()
@@ -506,7 +493,6 @@ class JacobianGroupEmbedding(Map):
506493
507494
EXAMPLES::
508495
509-
sage: # long time
510496
sage: k = GF(5)
511497
sage: P2.<x,y,z> = ProjectiveSpace(k, 2)
512498
sage: C = Curve(x^3 + z^3 - y^2*z, P2)
@@ -528,7 +514,6 @@ def __init__(self, base_group, extension_group):
528514
529515
TESTS::
530516
531-
sage: # long time
532517
sage: k = GF(5)
533518
sage: P2.<x,y,z> = ProjectiveSpace(k, 2)
534519
sage: C = Curve(x^3 + z^3 - y^2*z, P2)
@@ -553,7 +538,6 @@ def _repr_type(self):
553538
554539
TESTS::
555540
556-
sage: # long time
557541
sage: k = GF(5)
558542
sage: P2.<x,y,z> = ProjectiveSpace(k, 2)
559543
sage: C = Curve(x^3 + z^3 - y^2*z, P2)
@@ -577,7 +561,6 @@ def _call_(self, x):
577561
578562
TESTS::
579563
580-
sage: # long time
581564
sage: k = GF(5)
582565
sage: P2.<x,y,z> = ProjectiveSpace(k, 2)
583566
sage: C = Curve(x^3 + z^3 - y^2*z, P2)
@@ -609,7 +592,6 @@ class JacobianGroup(UniqueRepresentation, JacobianGroup_base):
609592
610593
EXAMPLES::
611594
612-
sage: # long time
613595
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
614596
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
615597
sage: h = C.function(y/x).divisor_of_poles()
@@ -627,7 +609,6 @@ def __init__(self, parent, function_field, base_div):
627609
628610
TESTS::
629611
630-
sage: # long time
631612
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
632613
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
633614
sage: h = C.function(y/x).divisor_of_poles()
@@ -639,16 +620,14 @@ def __init__(self, parent, function_field, base_div):
639620
D0 = base_div
640621

641622
self._base_div_degree = base_div.degree()
642-
self._V_cache = 10*[None]
643-
644-
V_cache = self._V_cache
623+
self._V_cache = dict()
645624

646625
def V(n):
647-
if n in V_cache:
648-
return V_cache[n]
626+
if n in self._V_cache:
627+
return self._V_cache[n]
649628

650629
Vn, from_Vn, to_Vn = (n * D0).function_space()
651-
V_cache[n] = (Vn, from_Vn, to_Vn)
630+
self._V_cache[n] = (Vn, from_Vn, to_Vn)
652631

653632
return Vn, from_Vn, to_Vn
654633

@@ -692,7 +671,6 @@ def _repr_(self):
692671
693672
EXAMPLES::
694673
695-
sage: # long time
696674
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
697675
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
698676
sage: h = C.function(y/x).divisor_of_poles()
@@ -714,7 +692,6 @@ def _wd_from_divisor(self, x):
714692
715693
TESTS:
716694
717-
sage: # long time
718695
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
719696
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
720697
sage: h = C.function(y/x).divisor_of_poles()
@@ -741,7 +718,6 @@ def _element_constructor_(self, x):
741718
742719
TESTS::
743720
744-
sage: # long time
745721
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
746722
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
747723
sage: h = C.function(y/x).divisor_of_poles()
@@ -800,7 +776,6 @@ def point(self, divisor):
800776
801777
EXAMPLES::
802778
803-
sage: # long time
804779
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
805780
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
806781
sage: h = C.function(y/x).divisor_of_poles()
@@ -834,7 +809,6 @@ def zero(self):
834809
835810
EXAMPLES::
836811
837-
sage: # long time
838812
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
839813
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
840814
sage: h = C.function(y/x).divisor_of_poles()
@@ -866,7 +840,6 @@ class JacobianGroup_finite_field(JacobianGroup, JacobianGroup_finite_field_base)
866840
867841
EXAMPLES::
868842
869-
sage: # long time
870843
sage: k = GF(7)
871844
sage: P2.<x,y,z> = ProjectiveSpace(k, 2)
872845
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
@@ -890,7 +863,6 @@ def __init__(self, parent, function_field, base_div):
890863
891864
TESTS::
892865
893-
sage: # long time
894866
sage: k = GF(7)
895867
sage: P2.<x,y,z> = ProjectiveSpace(k, 2)
896868
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
@@ -981,7 +953,6 @@ def _frobenius_on(self, pt):
981953
982954
TESTS::
983955
984-
sage: # long time
985956
sage: k = GF(7)
986957
sage: A.<x,y> = AffineSpace(k,2)
987958
sage: C = Curve(y^2 + x^3 + 2*x + 1).projective_closure()
@@ -1016,15 +987,13 @@ def __init__(self, function_field, base_div, model, **kwds):
1016987
1017988
TESTS::
1018989
1019-
sage: # long time
1020990
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
1021991
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
1022992
sage: J = C.jacobian(model='km_large')
1023993
sage: TestSuite(J).run(skip=['_test_elements', '_test_pickling'])
1024994
1025995
::
1026996
1027-
sage: # long time
1028997
sage: J = C.jacobian(model='km_unknown')
1029998
Traceback (most recent call last):
1030999
...

0 commit comments

Comments
 (0)