Skip to content

Commit b8210fa

Browse files
nbruinjdemeyer
authored andcommitted
move sig_on(); rename parameter in accordance with Pari/GP; include doctest
1 parent 552143b commit b8210fa

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

cypari2/pari_instance.pyx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ cdef class Pari(Pari_auto):
12871287
k += 1
12881288
return A
12891289

1290-
def genus2red(self, P, P0=None):
1290+
def genus2red(self, P, p=None):
12911291
"""
12921292
Let `P` be a polynomial with integer coefficients.
12931293
Determines the reduction of the (proper, smooth) genus 2
@@ -1296,19 +1296,25 @@ cdef class Pari(Pari_auto):
12961296
the polynomials `P` and `Q` have integer coefficients, to
12971297
represent the model `y^2 + Q(x)y = P(x)`.
12981298
1299+
If the second argument `p` is specified, it must be a prime.
1300+
Then only the local information at `p` is computed and returned.
1301+
12991302
Examples:
13001303
13011304
>>> import cypari2
13021305
>>> pari = cypari2.Pari()
13031306
>>> x = pari('x')
13041307
>>> pari.genus2red([-5*x**5, x**3 - 2*x**2 - 2*x + 1])
13051308
[1416875, [2, -1; 5, 4; 2267, 1], x^6 - 240*x^4 - 2550*x^3 - 11400*x^2 - 24100*x - 19855, [[2, [2, [Mod(1, 2)]], []], [5, [1, []], ["[V] page 156", [3]]], [2267, [2, [Mod(432, 2267)]], ["[I{1-0-0}] page 170", []]]]]
1309+
>>> pari.genus2red([-5*x**5, x**3 - 2*x**2 - 2*x + 1],2267)
1310+
[2267, Mat([2267, 1]), x^6 - 24*x^5 + 10*x^3 - 4*x + 1, [2267, [2, [Mod(432, 2267)]], ["[I{1-0-0}] page 170", []]]]
13061311
"""
13071312
cdef Gen t0 = objtogen(P)
1308-
sig_on()
1309-
if P0 is None:
1313+
if p is None:
1314+
sig_on()
13101315
return new_gen(genus2red(t0.g, NULL))
1311-
cdef Gen t1 = objtogen(P0)
1316+
cdef Gen t1 = objtogen(p)
1317+
sig_on()
13121318
return new_gen(genus2red(t0.g, t1.g))
13131319

13141320
def List(self, x=None):

0 commit comments

Comments
 (0)