Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/modular/overconvergent/hecke_series.py
8821 views
1
r"""
2
Atkin/Hecke series for overconvergent modular forms.
3
4
This file contains a function :func:`~hecke_series` to compute the
5
characteristic series `P(t)` modulo `p^m` of the Atkin/Hecke operator `U_p`
6
upon the space of p-adic overconvergent modular forms of level `\Gamma_0(N)`.
7
The input weight ``k`` can also be a list ``klist`` of weights which must all
8
be congruent modulo `(p-1)`.
9
10
Two optional parameters ``modformsring`` and ``weightbound`` can be specified,
11
and in most cases for levels `N > 1` they can be used to obtain the output more
12
quickly. When `m \le k-1` the output `P(t)` is also equal modulo `p^m` to the
13
reverse characteristic polynomial of the Atkin operator `U_p` on the space of
14
classical modular forms of weight k and level `\Gamma_0(Np)`. In addition,
15
provided `m \le (k-2)/2` the output `P(t)` is equal modulo `p^m` to the reverse
16
characteristic polynomial of the Hecke operator `T_p` on the space of classical
17
modular forms of weight k and level `\Gamma_0(N)`. The function is based upon
18
the main algorithm in [AGBL]_, and has linear running time in the logarithm of
19
the weight k.
20
21
AUTHORS:
22
23
- Alan G.B. Lauder (2011-11-10): original implementation.
24
- David Loeffler (2011-12): minor optimizations in review stage.
25
26
EXAMPLES:
27
28
The characteristic series of the U_11 operator modulo 11^10 on the space of 11-adic overconvergent
29
modular forms of level 1 and weight 10000::
30
31
sage: hecke_series(11,1,10000,10)
32
10009319650*x^4 + 25618839103*x^3 + 6126165716*x^2 + 10120524732*x + 1
33
34
The characteristic series of the U_5 operator modulo 5^5 on the space of 5-adic overconvergent
35
modular forms of level 3 and weight 1000::
36
37
sage: hecke_series(5,3,1000,5)
38
1875*x^6 + 1250*x^5 + 1200*x^4 + 1385*x^3 + 1131*x^2 + 2533*x + 1
39
40
The characteristic series of the U_7 operator modulo 7^5 on the space of 7-adic overconvergent
41
modular forms of level 5 and weight 1000. Here the optional parameter ``modformsring`` is set to true::
42
43
sage: hecke_series(7,5,1000,5,modformsring = True) # long time (21s on sage.math, 2012)
44
12005*x^7 + 10633*x^6 + 6321*x^5 + 6216*x^4 + 5412*x^3 + 4927*x^2 + 4906*x + 1
45
46
The characteristic series of the U_13 operator modulo 13^5 on the space of 13-adic overconvergent
47
modular forms of level 2 and weight 10000. Here the optional parameter ``weightbound`` is set to 4::
48
49
sage: hecke_series(13,2,10000,5,weightbound = 4) # long time (17s on sage.math, 2012)
50
325156*x^5 + 109681*x^4 + 188617*x^3 + 220858*x^2 + 269566*x + 1
51
52
A list containing the characteristic series of the U_23 operator modulo 23^10 on the spaces of
53
23-adic overconvergent modular forms of level 1 and weights 1000 and 1022, respectively.
54
55
::
56
57
sage: hecke_series(23,1,[1000,1022],10)
58
[7204610645852*x^6 + 2117949463923*x^5 + 24152587827773*x^4 + 31270783576528*x^3 + 30336366679797*x^2
59
+ 29197235447073*x + 1, 32737396672905*x^4 + 36141830902187*x^3 + 16514246534976*x^2 + 38886059530878*x + 1]
60
61
REFERENCES:
62
63
.. [AGBL] Alan G.B. Lauder, "Computations with classical and p-adic modular
64
forms", LMS J. of Comput. Math. 14 (2011), 214-231.
65
66
"""
67
#########################################################################
68
# Copyright (C) 2011 Alan Lauder <[email protected]>
69
#
70
# Distributed under the terms of the GNU General Public License (GPL)
71
#
72
# http://www.gnu.org/licenses/
73
#########################################################################
74
75
from sage.functions.all import floor, ceil
76
from sage.rings.all import ZZ,Zmod,valuation,Infinity,Integer
77
from sage.rings.finite_rings.constructor import GF
78
from sage.modular.modform.all import ModularForms, ModularFormsRing, delta_qexp, eisenstein_series_qexp
79
from sage.modular.dims import dimension_modular_forms
80
from sage.misc.functional import dimension,transpose,charpoly
81
from sage.matrix.constructor import matrix, random_matrix
82
from sage.matrix.matrix_space import MatrixSpace
83
from sage.misc.misc import cputime, verbose
84
85
# AUXILIARY CODE: SPACES OF MODULAR FORMS AND LINEAR ALGEBRA
86
87
def compute_G(p, F):
88
r"""
89
Given a power series `F \in R[[q]]^\times`, for some ring `R`, and an
90
integer `p`, compute the quotient
91
92
.. math::
93
94
\frac{F(q)}{F(q^p)}.
95
96
Used by :func:`level1_UpGj` and by :func:`higher_level_UpGj`, with `F` equal
97
to the Eisenstein series `E_{p-1}`.
98
99
INPUT:
100
101
- ``p`` -- integer
102
- ``F`` -- power series (with invertible constant term)
103
104
OUTPUT:
105
106
the power series `F(q) / F(q^p)`, to the same precision as `F`
107
108
EXAMPLE::
109
110
sage: E = sage.modular.overconvergent.hecke_series.eisenstein_series_qexp(2, 12, Zmod(9),normalization="constant")
111
sage: sage.modular.overconvergent.hecke_series.compute_G(3, E)
112
1 + 3*q + 3*q^4 + 6*q^7 + O(q^12)
113
"""
114
Fp = (F.truncate_powerseries(ceil(F.prec() / ZZ(p)))).V(p)
115
return F / Fp
116
117
def low_weight_bases(N,p,m,NN,weightbound):
118
r"""
119
Returns a list of integral bases of modular forms of level N and (even)
120
weight at most ``weightbound``, as `q`-expansions modulo `(p^m,q^{NN})`.
121
122
These forms are obtained by reduction mod `p^m` from an integral basis in
123
Hermite normal form (so they are not necessarily in reduced row echelon
124
form mod `p^m`, but they are not far off).
125
126
INPUT:
127
128
- ``N`` -- positive integer (level).
129
- ``p`` -- prime.
130
- ``m``, ``NN`` -- positive integers.
131
- ``weightbound`` -- (even) positive integer.
132
133
OUTPUT:
134
135
- list of lists of `q`-expansions modulo `(p^m,q^{NN})`.
136
137
EXAMPLES::
138
139
sage: from sage.modular.overconvergent.hecke_series import low_weight_bases
140
sage: low_weight_bases(2,5,3,5,6)
141
[[1 + 24*q + 24*q^2 + 96*q^3 + 24*q^4 + O(q^5)],
142
[1 + 115*q^2 + 35*q^4 + O(q^5), q + 8*q^2 + 28*q^3 + 64*q^4 + O(q^5)],
143
[1 + 121*q^2 + 118*q^4 + O(q^5), q + 32*q^2 + 119*q^3 + 24*q^4 + O(q^5)]]
144
145
"""
146
generators = []
147
148
for k in xrange(2,weightbound + 2,2):
149
b = ModularForms(N,k,base_ring=Zmod(p**m)).q_expansion_basis(prec=NN)
150
generators.append(list(b))
151
return generators
152
153
def random_low_weight_bases(N,p,m,NN,weightbound):
154
r"""
155
Returns list of random integral bases of modular forms of level `N` and
156
(even) weight at most weightbound with coefficients reduced modulo
157
`(p^m,q^{NN})`.
158
159
INPUT:
160
161
- ``N`` -- positive integer (level).
162
- ``p`` -- prime.
163
- ``m``, ``NN`` -- positive integers.
164
- ``weightbound`` -- (even) positive integer.
165
166
OUTPUT:
167
168
- list of lists of `q`-expansions modulo `(p^m,q^{NN})`.
169
170
EXAMPLES::
171
172
sage: from sage.modular.overconvergent.hecke_series import random_low_weight_bases
173
sage: S = random_low_weight_bases(3,7,2,5,6); S # random
174
[[4 + 48*q + 46*q^2 + 48*q^3 + 42*q^4 + O(q^5)],
175
[3 + 5*q + 45*q^2 + 22*q^3 + 22*q^4 + O(q^5),
176
1 + 3*q + 27*q^2 + 27*q^3 + 23*q^4 + O(q^5)],
177
[2*q + 4*q^2 + 16*q^3 + 48*q^4 + O(q^5),
178
2 + 6*q + q^2 + 3*q^3 + 43*q^4 + O(q^5),
179
1 + 2*q + 6*q^2 + 14*q^3 + 4*q^4 + O(q^5)]]
180
sage: S[0][0].parent()
181
Power Series Ring in q over Ring of integers modulo 49
182
sage: S[0][0].prec()
183
5
184
185
"""
186
LWB = low_weight_bases(N,p,m,NN,weightbound)
187
# this is "approximately" row reduced (it's the mod p^n reduction of a
188
# matrix over ZZ in Hermite form)
189
RandomLWB = []
190
for i in xrange(len(LWB)):
191
n = len(LWB[i])
192
c = random_matrix(Zmod(p**m), n)
193
while c.det() % p == 0:
194
c = random_matrix(Zmod(p**m), n)
195
RandomLWB.append([ sum([c[j, k] * LWB[i][k] for k in xrange(n)]) for j in xrange(n) ])
196
197
return RandomLWB
198
199
def low_weight_generators(N,p,m,NN):
200
r"""
201
Returns a list of lists of modular forms, and an even natural number. The
202
first output is a list of lists of modular forms reduced modulo
203
`(p^m,q^{NN})` which generate the `(\ZZ / p^m \ZZ)`-algebra of mod `p^m`
204
modular forms of weight at most 8, and the second output is the largest
205
weight among the forms in the generating set.
206
207
We (Alan Lauder and David Loeffler, the author and reviewer of this patch)
208
conjecture that forms of weight at most 8 are always sufficient to generate
209
the algebra of mod `p^m` modular forms of all weights. (We believe 6 to be
210
sufficient, and we can prove that 4 is sufficient when there are no
211
elliptic points, but using weights up to 8 acts as a consistency check.)
212
213
INPUT:
214
215
- ``N`` -- positive integer (level).
216
- ``p`` -- prime.
217
- ``m``, ``NN`` -- positive integers.
218
219
OUTPUT:
220
221
a tuple consisting of:
222
223
- a list of lists of `q`-expansions modulo `(p^m,q^{NN})`,
224
- an even natural number (twice the length of the list).
225
226
EXAMPLES::
227
228
sage: from sage.modular.overconvergent.hecke_series import low_weight_generators
229
sage: low_weight_generators(3,7,3,10)
230
([[1 + 12*q + 36*q^2 + 12*q^3 + 84*q^4 + 72*q^5 + 36*q^6 + 96*q^7 + 180*q^8 + 12*q^9 + O(q^10)],
231
[1 + 240*q^3 + 102*q^6 + 203*q^9 + O(q^10)],
232
[1 + 182*q^3 + 175*q^6 + 161*q^9 + O(q^10)]], 6)
233
sage: low_weight_generators(11,5,3,10)
234
([[1 + 12*q^2 + 12*q^3 + 12*q^4 + 12*q^5 + 24*q^6 + 24*q^7 + 36*q^8 + 36*q^9 + O(q^10),
235
q + 123*q^2 + 124*q^3 + 2*q^4 + q^5 + 2*q^6 + 123*q^7 + 123*q^9 + O(q^10)],
236
[q + 116*q^4 + 115*q^5 + 102*q^6 + 121*q^7 + 96*q^8 + 106*q^9 + O(q^10)]], 4)
237
"""
238
M = ModularFormsRing(N,base_ring=Zmod(p))
239
240
b = M.gen_forms(maxweight = 8)
241
242
weightbound = max([f.weight() for f in b])
243
generators = []
244
245
for k in xrange(2,weightbound + 2,2):
246
generators.append([f.qexp(NN).change_ring(Zmod(p**m)) for f in b if f.weight() == k])
247
248
return generators,weightbound
249
250
def random_solution(B,K):
251
r"""
252
Returns a random solution in non-negative integers to the equation `a_1 + 2
253
a_2 + 3 a_3 + ... + B a_B = K`, using a greedy algorithm.
254
255
Note that this is *much* faster than using
256
``WeightedIntegerVectors.random_element()``.
257
258
INPUT:
259
260
- ``B``, ``K`` -- non-negative integers.
261
262
OUTPUT:
263
264
- list.
265
266
EXAMPLES::
267
268
sage: from sage.modular.overconvergent.hecke_series import random_solution
269
sage: random_solution(5,10)
270
[1, 1, 1, 1, 0]
271
"""
272
a = []
273
for i in xrange(B,1,-1):
274
ai = ZZ.random_element((K // i) + 1)
275
a.append(ai)
276
K = K - ai*i
277
a.append(K)
278
a.reverse()
279
280
return a
281
282
# AUXILIARY CODE: ECHELON FORM
283
284
def ech_form(A,p):
285
r"""
286
Returns echelon form of matrix ``A`` over the ring of integers modulo
287
`p^m`, for some prime `p` and `m \ge 1`.
288
289
.. todo::
290
291
This should be moved to :mod:`sage.matrix.matrix_modn_dense` at some
292
point.
293
294
INPUT:
295
296
- ``A`` -- matrix over ``Zmod(p^m)`` for some m.
297
- ``p`` - prime p.
298
299
OUTPUT:
300
301
- matrix over ``Zmod(p^m)``.
302
303
EXAMPLES::
304
305
sage: from sage.modular.overconvergent.hecke_series import ech_form
306
sage: A = MatrixSpace(Zmod(5**3),3)([1,2,3,4,5,6,7,8,9])
307
sage: ech_form(A,5)
308
[1 2 3]
309
[0 1 2]
310
[0 0 0]
311
"""
312
313
S = A[0,0].parent()
314
a = A.nrows()
315
b = A.ncols()
316
317
k = 0 # position pivoting row will be swapped to
318
for j in xrange(b):
319
if k < a:
320
pivj = k # find new pivot
321
for i in xrange(k+1,a):
322
if valuation(A[i,j],p) < valuation(A[pivj,j],p):
323
pivj = i
324
if valuation(A[pivj,j],p) < +Infinity: # else column already reduced
325
A.swap_rows(pivj, k)
326
A.set_row_to_multiple_of_row(k, k, S(ZZ(A[k,j])/(p**valuation(A[k,j],p)))**(-1))
327
for i in xrange(k+1,a):
328
A.add_multiple_of_row(i, k, S(-ZZ(A[i,j])/ZZ(A[k,j])))
329
k = k + 1
330
331
return A
332
333
334
# *** COMPLEMENTARY SPACES FOR LEVEL N > 1 ***
335
336
def random_new_basis_modp(N,p,k,LWBModp,TotalBasisModp,elldash,bound):
337
r"""
338
Returns ``NewBasisCode``. Here `NewBasisCode` is a list of lists of lists
339
``[j,a]``. This encodes a choice of basis for the ith complementary space
340
`W_i`, as explained in the documentation for the function
341
:func:`complementary_spaces_modp`.
342
343
INPUT:
344
345
- ``N`` -- positive integer at least 2 and not divisible by p (level).
346
- ``p`` -- prime at least 5.
347
- ``k`` -- non-negative integer.
348
- ``LWBModp`` -- list of list of q-expansions modulo
349
`(p,q^\text{elldash})`.
350
- ``TotalBasisModp`` -- matrix over GF(p).
351
- ``elldash`` - positive integer.
352
- ``bound`` -- positive even integer (twice the length of the list
353
``LWBModp``).
354
355
OUTPUT:
356
357
- A list of lists of lists ``[j,a]``.
358
359
.. note::
360
361
As well as having a non-trivial return value, this function also
362
modifies the input matrix ``TotalBasisModp``.
363
364
EXAMPLES::
365
366
sage: from sage.modular.overconvergent.hecke_series import random_low_weight_bases, complementary_spaces_modp
367
sage: LWB = random_low_weight_bases(2,5,2,4,6)
368
sage: LWBModp = [ [f.change_ring(GF(5)) for f in x] for x in LWB]
369
sage: complementary_spaces_modp(2,5,2,3,4,LWBModp,4) # random, indirect doctest
370
[[[[0, 0]]], [[[0, 0], [1, 1]]], [[[0, 0], [1, 0], [1, 1]]], [[[0, 0], [1, 0], [1, 1], [1, 1]]]]
371
372
"""
373
374
R = LWBModp[0][0].parent()
375
376
# Case k0 + i(p-1) = 0 + 0(p-1) = 0
377
378
if k == 0:
379
TotalBasisModp[0,0] = 1
380
return [[]]
381
382
# Case k = k0 + i(p-1) > 0
383
384
di = dimension_modular_forms(N, k)
385
diminus1 = dimension_modular_forms(N, k-(p-1))
386
mi = di - diminus1
387
388
NewBasisCode = []
389
rk = diminus1
390
for i in xrange(1,mi+1):
391
while (rk < diminus1 + i):
392
# take random product of basis elements
393
exps = random_solution(bound // 2, k // 2)
394
TotalBasisi = R(1)
395
TotalBasisiCode = []
396
for j in xrange(len(exps)):
397
for l in xrange(exps[j]):
398
a = ZZ.random_element(len(LWBModp[j]))
399
TotalBasisi = TotalBasisi*LWBModp[j][a]
400
TotalBasisiCode.append([j,a])
401
TotalBasisModp[rk] = [TotalBasisi[j] for j in range(elldash)]
402
TotalBasisModp.echelonize()
403
rk = TotalBasisModp.rank()
404
NewBasisCode.append(TotalBasisiCode) # this choice increased the rank
405
406
return NewBasisCode
407
408
def complementary_spaces_modp(N,p,k0,n,elldash,LWBModp,bound):
409
r"""
410
Returns a list of lists of lists of lists ``[j,a]``. The pairs ``[j,a]``
411
encode the choice of the `a`-th element in the `j`-th list of the input
412
``LWBModp``, i.e., the `a`-th element in a particular basis modulo
413
`(p,q^\text{elldash})` for the space of modular forms of level
414
`\Gamma_0(N)` and weight `2(j+1)`. The list ``[[j_1,a_1],...,[j_r,a_r]]``
415
then encodes the product of the r modular forms associated to each
416
``[j_i,a_i]``; this has weight `k + (p-1)i` for some `0 \le i \le n`; here
417
the i is such that this *list of lists* occurs in the ith list of the
418
output. The ith list of the output thus encodes a choice of basis for the
419
complementary space `W_i` which occurs in Step 2 of Algorithm 2 in [AGBL]_.
420
The idea is that one searches for this space `W_i` first modulo
421
`(p,q^\text{elldash})` and then, having found the correct products of
422
generating forms, one can reconstruct these spaces modulo
423
`(p^\text{mdash},q^\text{elldashp})` using the output of this function.
424
(This idea is based upon a suggestion of John Voight.)
425
426
INPUT:
427
428
- ``N`` -- positive integer at least 2 and not divisible by p (level).
429
- ``p`` -- prime at least 5.
430
- ``k0`` -- integer in range 0 to `p-1`.
431
- ``n,elldash`` -- positive integers.
432
- ``LWBModp`` -- list of lists of `q`-expansions over `GF(p)`.
433
- ``bound`` -- positive even integer (twice the length of the list ``LWBModp``).
434
435
OUTPUT:
436
437
- list of list of list of lists.
438
439
EXAMPLES::
440
441
sage: from sage.modular.overconvergent.hecke_series import random_low_weight_bases, complementary_spaces_modp
442
sage: LWB = random_low_weight_bases(2,5,2,4,6)
443
sage: LWBModp = [[f.change_ring(Zmod(5)) for f in x] for x in LWB]
444
sage: complementary_spaces_modp(2,5,0,3,4,LWBModp,6) # random, indirect doctest
445
[[[]], [[[0, 0], [0, 0]]], [[[0, 0], [2, 1]]], [[[0, 0], [0, 0], [0, 0], [2, 1]]]]
446
"""
447
CompSpacesCode = []
448
ell = dimension_modular_forms(N,k0 + n*(p-1))
449
TotalBasisModp = matrix(GF(p),ell,elldash); # zero matrix
450
451
for i in xrange(n+1):
452
NewBasisCodemi = random_new_basis_modp(N,p,k0 + i*(p-1),LWBModp,TotalBasisModp,elldash,bound)
453
# TotalBasisModp is passed by reference and updated in function
454
CompSpacesCode.append(NewBasisCodemi)
455
456
return CompSpacesCode
457
458
def complementary_spaces(N,p,k0,n,mdash,elldashp,elldash,modformsring,bound):
459
r"""
460
Returns a list ``Ws``, each element in which is a list ``Wi`` of
461
q-expansions modulo `(p^\text{mdash},q^\text{elldashp})`. The list ``Wi`` is
462
a basis for a choice of complementary space in level `\Gamma_0(N)` and
463
weight `k` to the image of weight `k - (p-1)` forms under multiplication by
464
the Eisenstein series `E_{p-1}`.
465
466
The lists ``Wi`` play the same role as `W_i` in Step 2 of Algorithm 2 in
467
[AGBL]_. (The parameters ``k0,n,mdash,elldash,elldashp = elldash*p`` are
468
defined as in Step 1 of that algorithm when this function is used in
469
:func:`hecke_series`.) However, the complementary spaces are computed in a
470
different manner, combining a suggestion of David Loeffler with one of John
471
Voight. That is, one builds these spaces recursively using random products
472
of forms in low weight, first searching for suitable products modulo
473
`(p,q^\text{elldash})`, and then later reconstructing only the required
474
products to the full precision modulo `(p^\text{mdash},q^{elldashp})`. The
475
forms in low weight are chosen from either bases of all forms up to weight
476
``bound`` or from a (tentative) generating set for the ring of all modular
477
forms, according to whether ``modformsring`` is ``False`` or ``True``.
478
479
INPUT:
480
481
- ``N`` -- positive integer at least 2 and not divisible by p (level).
482
- ``p`` -- prime at least 5.
483
- ``k0`` -- integer in range 0 to ``p-1``.
484
- ``n,mdash,elldashp,elldash`` -- positive integers.
485
- ``modformsring`` -- True or False.
486
- ``bound`` -- positive (even) integer (ignored if ``modformsring`` is True).
487
488
OUTPUT:
489
490
- list of lists of q-expansions modulo
491
``(p^\text{mdash},q^\text{elldashp})``.
492
493
EXAMPLES::
494
495
sage: from sage.modular.overconvergent.hecke_series import complementary_spaces
496
sage: complementary_spaces(2,5,0,3,2,5,4,true,6) # random
497
[[1],
498
[1 + 23*q + 24*q^2 + 19*q^3 + 7*q^4 + O(q^5)],
499
[1 + 21*q + 2*q^2 + 17*q^3 + 14*q^4 + O(q^5)],
500
[1 + 19*q + 9*q^2 + 11*q^3 + 9*q^4 + O(q^5)]]
501
sage: complementary_spaces(2,5,0,3,2,5,4,false,6) # random
502
[[1],
503
[3 + 4*q + 2*q^2 + 12*q^3 + 11*q^4 + O(q^5)],
504
[2 + 2*q + 14*q^2 + 19*q^3 + 18*q^4 + O(q^5)],
505
[6 + 8*q + 10*q^2 + 23*q^3 + 4*q^4 + O(q^5)]]
506
"""
507
if modformsring == False:
508
LWB = random_low_weight_bases(N,p,mdash,elldashp,bound)
509
else:
510
LWB,bound = low_weight_generators(N,p,mdash,elldashp)
511
512
LWBModp = [ [ f.change_ring(GF(p)).truncate_powerseries(elldash) for f in x] for x in LWB]
513
514
CompSpacesCode = complementary_spaces_modp(N,p,k0,n,elldash,LWBModp,bound)
515
516
Ws = []
517
Epm1 = eisenstein_series_qexp(p-1, prec=elldashp, K = Zmod(p**mdash), normalization="constant")
518
for i in xrange(n+1):
519
CompSpacesCodemi = CompSpacesCode[i]
520
Wi = []
521
for k in xrange(len(CompSpacesCodemi)):
522
CompSpacesCodemik = CompSpacesCodemi[k]
523
Wik = Epm1.parent()(1)
524
for j in xrange(len(CompSpacesCodemik)):
525
l = CompSpacesCodemik[j][0]
526
index = CompSpacesCodemik[j][1]
527
Wik = Wik*LWB[l][index]
528
Wi.append(Wik)
529
Ws.append(Wi)
530
531
return Ws
532
533
# AUXILIARY CODE: KATZ EXPANSIONS
534
535
def higher_level_katz_exp(p,N,k0,m,mdash,elldash,elldashp,modformsring,bound):
536
r"""
537
Returns a matrix `e` of size ``ell x elldashp`` over the integers modulo
538
`p^\text{mdash}`, and the Eisenstein series `E_{p-1} = 1 + .\dots \bmod
539
(p^\text{mdash},q^\text{elldashp})`. The matrix e contains the coefficients
540
of the elements `e_{i,s}` in the Katz expansions basis in Step 3 of
541
Algorithm 2 in [AGBL]_ when one takes as input to that algorithm
542
`p`,`N`,`m` and `k` and define ``k0``, ``mdash``, ``n``, ``elldash``,
543
``elldashp = ell*dashp`` as in Step 1.
544
545
INPUT:
546
547
- ``p`` -- prime at least 5.
548
- ``N`` -- positive integer at least 2 and not divisible by p (level).
549
- ``k0`` -- integer in xrange 0 to p-1.
550
- ``m,mdash,elldash,elldashp`` -- positive integers.
551
- ``modformsring`` -- True or False.
552
- ``bound`` -- positive (even) integer.
553
554
OUTPUT:
555
556
- matrix and q-expansion.
557
558
EXAMPLES::
559
560
sage: from sage.modular.overconvergent.hecke_series import higher_level_katz_exp
561
sage: e,Ep1 = higher_level_katz_exp(5,2,0,1,2,4,20,true,6)
562
sage: e
563
[ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
564
[ 0 1 18 23 19 6 9 9 17 7 3 17 12 8 22 8 11 19 1 5]
565
[ 0 0 1 11 20 16 0 8 4 0 18 15 24 6 15 23 5 18 7 15]
566
[ 0 0 0 1 4 16 23 13 6 5 23 5 2 16 4 18 10 23 5 15]
567
sage: Ep1
568
1 + 15*q + 10*q^2 + 20*q^3 + 20*q^4 + 15*q^5 + 5*q^6 + 10*q^7 +
569
5*q^9 + 10*q^10 + 5*q^11 + 10*q^12 + 20*q^13 + 15*q^14 + 20*q^15 + 15*q^16 +
570
10*q^17 + 20*q^18 + O(q^20)
571
"""
572
ordr = 1/(p+1)
573
S = Zmod(p**mdash)
574
Ep1 = eisenstein_series_qexp(p-1,prec=elldashp,K=S, normalization="constant")
575
576
n = floor(((p+1)/(p-1))*(m+1))
577
Wjs = complementary_spaces(N,p,k0,n,mdash,elldashp,elldash,modformsring,bound)
578
579
Basis = []
580
for j in xrange(n+1):
581
Wj = Wjs[j]
582
dimj = len(Wj)
583
Ep1minusj = Ep1**(-j)
584
for i in xrange(dimj):
585
wji = Wj[i]
586
b = p**floor(ordr*j) * wji * Ep1minusj
587
Basis.append(b)
588
589
# extract basis as a matrix
590
591
ell = len(Basis)
592
M = matrix(S,ell,elldashp)
593
for i in xrange(ell):
594
for j in xrange(elldashp):
595
M[i,j] = Basis[i][j]
596
597
ech_form(M,p) # put it into echelon form
598
599
return M,Ep1
600
601
def compute_elldash(p,N,k0,n):
602
r"""
603
Returns the "Sturm bound" for the space of modular forms of level
604
`\Gamma_0(N)` and weight `k_0 + n(p-1)`.
605
606
.. seealso::
607
608
:meth:`~sage.modular.modform.space.ModularFormsSpace.sturm_bound`
609
610
INPUT:
611
612
- ``p`` -- prime.
613
- ``N`` -- positive integer (level).
614
- ``k0``, ``n`` - non-negative integers not both zero.
615
616
OUTPUT:
617
618
- positive integer.
619
620
EXAMPLES::
621
622
sage: from sage.modular.overconvergent.hecke_series import compute_elldash
623
sage: compute_elldash(11,5,4,10)
624
53
625
"""
626
627
return ModularForms(N,k0 + n*(p-1)).sturm_bound()
628
629
# *** DEGREE BOUND ON HECKE SERIES ***
630
631
def hecke_series_degree_bound(p,N,k,m):
632
r"""
633
Returns the ``Wan bound`` on the degree of the characteristic series of the
634
Atkin operator on p-adic overconvergent modular forms of level
635
`\Gamma_0(N)` and weight k when reduced modulo `p^m`. This bound depends
636
only upon p, `k \pmod{p-1}`, and N. It uses Lemma 3.1 in [DW]_.
637
638
INPUT:
639
640
- ``p`` -- prime at least 5.
641
- ``N`` -- positive integer not divisible by p.
642
- ``k`` -- even integer.
643
- ``m`` -- positive integer.
644
645
OUTPUT:
646
647
A non-negative integer.
648
649
EXAMPLES::
650
651
sage: from sage.modular.overconvergent.hecke_series import hecke_series_degree_bound
652
sage: hecke_series_degree_bound(13,11,100,5)
653
39
654
655
REFERENCES:
656
657
.. [DW] Daqing Wan, "Dimension variation of classical and p-adic modular
658
forms", Invent. Math. 133, (1998) 449-463.
659
"""
660
k0 = k % (p-1)
661
ds = [dimension_modular_forms(N, k0)]
662
ms = [ds[0]]
663
sum = 0
664
u = 1
665
666
ord = 0
667
while ord < m:
668
ds.append(dimension_modular_forms(N,k0 + u*(p-1)))
669
ms.append(ds[u] - ds[u-1])
670
sum = sum + u*ms[u]
671
ord = floor(((p-1)/(p+1))*sum - ds[u])
672
u = u + 1
673
674
return (ds[u-1] - 1)
675
676
# *** MAIN FUNCTION FOR LEVEL > 1 ***
677
678
# Returns matrix A modulo p^m from Step 6 of Algorithm 2.
679
680
def higher_level_UpGj(p,N,klist,m,modformsring,bound):
681
r"""
682
Returns a list ``[A_k]`` of square matrices over ``IntegerRing(p^m)``
683
parameterised by the weights k in ``klist``. The matrix `A_k` is the finite
684
square matrix which occurs on input p,k,N and m in Step 6 of Algorithm 2 in
685
[AGBL]_. Notational change from paper: In Step 1 following Wan we defined
686
j by `k = k_0 + j(p-1)` with `0 \le k_0 < p-1`. Here we replace j by
687
``kdiv`` so that we may use j as a column index for matrices.)
688
689
INPUT:
690
691
- ``p`` -- prime at least 5.
692
- ``N`` -- integer at least 2 and not divisible by p (level).
693
- ``klist`` -- list of integers all congruent modulo (p-1) (the weights).
694
- ``m`` -- positive integer.
695
- ``modformsring`` -- True or False.
696
- ``bound`` -- (even) positive integer.
697
698
OUTPUT:
699
700
- list of square matrices.
701
702
EXAMPLES::
703
704
sage: from sage.modular.overconvergent.hecke_series import higher_level_UpGj
705
sage: higher_level_UpGj(5,3,[4],2,true,6)
706
[
707
[ 1 0 0 0 0 0]
708
[ 0 1 0 0 0 0]
709
[ 0 7 0 0 0 0]
710
[ 0 5 10 20 0 0]
711
[ 0 7 20 0 20 0]
712
[ 0 1 24 0 20 0]
713
]
714
715
"""
716
t = cputime()
717
# Step 1
718
719
k0 = klist[0] % (p-1)
720
n = floor(((p+1)/(p-1)) * (m+1))
721
elldash = compute_elldash(p,N,k0,n)
722
elldashp = elldash*p
723
mdash = m + ceil(n/(p+1))
724
725
verbose("done step 1",t)
726
t = cputime()
727
# Steps 2 and 3
728
729
e,Ep1 = higher_level_katz_exp(p,N,k0,m,mdash,elldash,elldashp,modformsring,bound)
730
ell = dimension(transpose(e)[0].parent())
731
S = e[0,0].parent()
732
733
verbose("done steps 2+3", t)
734
t = cputime()
735
# Step 4
736
737
R = Ep1.parent()
738
G = compute_G(p, Ep1)
739
Alist = []
740
741
verbose("done step 4a", t)
742
t = cputime()
743
for k in klist:
744
k = ZZ(k) # convert to sage integer
745
kdiv = k // (p-1)
746
Gkdiv = G**kdiv
747
748
T = matrix(S,ell,elldash)
749
for i in xrange(ell):
750
ei = R(e[i].list())
751
Gkdivei = Gkdiv*ei; # act by G^kdiv
752
for j in xrange(0, elldash):
753
T[i,j] = Gkdivei[p*j]
754
755
verbose("done steps 4b and 5", t)
756
t = cputime()
757
758
# Step 6: solve T = AE using fact E is upper triangular.
759
# Warning: assumes that T = AE (rather than pT = AE) has
760
# a solution over Z/(p^mdash). This has always been the case in
761
# examples computed by the author, see Note 3.1.
762
763
A = matrix(S,ell,ell)
764
verbose("solving a square matrix problem of dimension %s" % ell)
765
verbose("elldash is %s" % elldash)
766
767
for i in xrange(0,ell):
768
Ti = T[i]
769
for j in xrange(0,ell):
770
ej = Ti.parent()([e[j][l] for l in xrange(0,elldash)])
771
ejleadpos = ej.nonzero_positions()[0]
772
lj = ZZ(ej[ejleadpos])
773
A[i,j] = S(ZZ(Ti[j])/lj)
774
Ti = Ti - A[i,j]*ej
775
776
Alist.append(MatrixSpace(Zmod(p**m),ell,ell)(A))
777
verbose("done step 6", t)
778
779
return Alist
780
781
782
# *** LEVEL 1 CODE ***
783
784
def compute_Wi(k,p,h,hj,E4,E6):
785
r"""
786
This function computes a list `W_i` of q-expansions, together with an
787
auxilliary quantity `h^j` (see below) which is to be used on the next
788
call of this function. (The precision is that of input q-expansions.)
789
790
The list `W_i` is a certain subset of a basis of the modular forms of
791
weight `k` and level 1. Suppose `(a, b)` is the pair of non-negative
792
integers with `4a + 6b = k` and `a` minimal among such pairs. Then this
793
space has a basis given by
794
795
.. math::
796
797
\{ \Delta^j E_6^{b - 2j} E_4^a : 0 \le j < d\}
798
799
where `d` is the dimension.
800
801
What this function returns is the subset of the above basis corresponding
802
to `e \le j < d` where `e` is the dimension of the space of modular forms
803
of weight `k - (p-1)`. This set is a basis for the complement of the image
804
of the weight `k - (p-1)` forms under multiplication by `E_{p-1}`.
805
806
This function is used repeatedly in the construction of the Katz expansion
807
basis. Hence considerable care is taken to reuse steps in the computation
808
wherever possible: we keep track of powers of the form `h = \Delta /
809
E_6^2`.
810
811
INPUT:
812
813
- ``k`` -- non-negative integer.
814
- ``p`` -- prime at least 5.
815
- ``h`` -- q-expansion of `h` (to some finite precision).
816
- ``hj`` -- q-expansion of h^j where j is the dimension of the space of
817
modular forms of level 1 and weight `k - (p-1)` (to same finite
818
precision).
819
- ``E4`` -- q-expansion of ``E_4`` (to same finite precision).
820
- ``E6`` -- q-expansion of ``E_6`` (to same finite precision).
821
822
The Eisenstein series q-expansions should be normalized to have constant
823
term 1.
824
825
OUTPUT:
826
827
- list of q-expansions (to same finite precision), and q-expansion.
828
829
EXAMPLES::
830
831
sage: from sage.modular.overconvergent.hecke_series import compute_Wi
832
sage: p = 17
833
sage: prec = 10
834
sage: k = 24
835
sage: S = Zmod(17^3)
836
sage: E4 = eisenstein_series_qexp(4, prec, K=S, normalization="constant")
837
sage: E6 = eisenstein_series_qexp(6, prec, K=S, normalization="constant")
838
sage: h = delta_qexp(prec, K=S) / E6^2
839
sage: j = dimension_modular_forms(1, k - (p-1))
840
sage: hj = h**j
841
sage: c = compute_Wi(k,p,h,hj,E4,E6); c
842
([q + 3881*q^2 + 4459*q^3 + 4665*q^4 + 2966*q^5 + 1902*q^6 + 1350*q^7 + 3836*q^8 + 1752*q^9 + O(q^10), q^2 + 4865*q^3 + 1080*q^4 + 4612*q^5 + 1343*q^6 + 1689*q^7 + 3876*q^8 + 1381*q^9 + O(q^10)], q^3 + 2952*q^4 + 1278*q^5 + 3225*q^6 + 1286*q^7 + 589*q^8 + 122*q^9 + O(q^10))
843
sage: c == ([delta_qexp(10) * E6^2, delta_qexp(10)^2], h**3)
844
True
845
"""
846
847
# Define a and b
848
a = k % 3
849
b = (k // 2) % 2
850
851
# Compute dimensions required for Miller basis
852
d = dimension_modular_forms(1, k) - 1
853
e = dimension_modular_forms(1, k-(p-1)) - 1
854
855
# This next line is a bit of a bottleneck, particularly when m is large but
856
# p is small. It would be good to reuse values calculated on the previous
857
# call here somehow.
858
r = E6**(2*d + b) * E4**a
859
860
prec = E4.prec() # everything gets trucated to this precision
861
862
# Construct basis for Wi
863
Wi = []
864
for j in xrange(e+1,d+1):
865
# compute aj = delta^j*E6^(2*(d-j) + b)*E4^a
866
verbose("k = %s, computing Delta^%s E6^%s E4^%s" % (k, j, 2*(d-j) + b, a), level=2)
867
aj = (hj * r).truncate_powerseries(prec)
868
hj = (hj * h).truncate_powerseries(prec)
869
Wi.append(aj)
870
871
return Wi,hj
872
873
def katz_expansions(k0,p,ellp,mdash,n):
874
r"""
875
Returns a list e of q-expansions, and the Eisenstein series `E_{p-1} = 1 +
876
\dots`, all modulo `(p^\text{mdash},q^\text{ellp})`. The list e contains
877
the elements `e_{i,s}` in the Katz expansions basis in Step 3 of Algorithm
878
1 in [AGBL]_ when one takes as input to that algorithm p,m and k and define
879
``k0``, ``mdash``, n, ``ellp = ell*p`` as in Step 1.
880
881
INPUT:
882
883
- ``k0`` -- integer in range 0 to p-1.
884
- ``p`` -- prime at least 5.
885
- ``ellp,mdash,n`` -- positive integers.
886
887
OUTPUT:
888
889
- list of q-expansions and the Eisenstein series E_{p-1} modulo
890
`(p^\text{mdash},q^\text{ellp})`.
891
892
EXAMPLES::
893
894
sage: from sage.modular.overconvergent.hecke_series import katz_expansions
895
sage: katz_expansions(0,5,10,3,4)
896
([1 + O(q^10), q + 6*q^2 + 27*q^3 + 98*q^4 + 65*q^5 + 37*q^6 + 81*q^7 + 85*q^8 + 62*q^9 + O(q^10)],
897
1 + 115*q + 35*q^2 + 95*q^3 + 20*q^4 + 115*q^5 + 105*q^6 + 60*q^7 + 25*q^8 + 55*q^9 + O(q^10))
898
"""
899
S = Zmod(p**mdash)
900
901
Ep1 = eisenstein_series_qexp(p-1, ellp, K=S, normalization="constant")
902
E4 = eisenstein_series_qexp(4, ellp, K=S, normalization="constant")
903
E6 = eisenstein_series_qexp(6, ellp, K=S, normalization="constant")
904
905
delta = delta_qexp(ellp, K=S)
906
h = delta / E6**2
907
hj = delta.parent()(1)
908
e = []
909
910
# We compute negative powers of E_(p-1) successively (this saves a great
911
# deal of time). The effect is that Ep1mi = Ep1 ** (-i).
912
Ep1m1 = ~Ep1
913
Ep1mi = 1
914
for i in xrange(0,n+1):
915
Wi,hj = compute_Wi(k0 + i*(p-1),p,h,hj,E4,E6)
916
for bis in Wi:
917
eis = p**floor(i/(p+1)) * Ep1mi * bis
918
e.append(eis)
919
Ep1mi = Ep1mi * Ep1m1
920
921
return e,Ep1
922
923
# *** MAIN FUNCTION FOR LEVEL 1 ***
924
925
def level1_UpGj(p,klist,m):
926
r"""
927
Returns a list `[A_k]` of square matrices over ``IntegerRing(p^m)``
928
parameterised by the weights k in ``klist``. The matrix `A_k` is the finite
929
square matrix which occurs on input p,k and m in Step 6 of Algorithm 1 in
930
[AGBL]_. Notational change from paper: In Step 1 following Wan we defined
931
j by `k = k_0 + j(p-1)` with `0 \le k_0 < p-1`. Here we replace j by
932
``kdiv`` so that we may use j as a column index for matrices.
933
934
INPUT:
935
936
- ``p`` -- prime at least 5.
937
- ``klist`` -- list of integers congruent modulo `(p-1)` (the weights).
938
- ``m`` -- positive integer.
939
940
OUTPUT:
941
942
- list of square matrices.
943
944
EXAMPLES::
945
946
sage: from sage.modular.overconvergent.hecke_series import level1_UpGj
947
sage: level1_UpGj(7,[100],5)
948
[
949
[ 1 980 4802 0 0]
950
[ 0 13727 14406 0 0]
951
[ 0 13440 7203 0 0]
952
[ 0 1995 4802 0 0]
953
[ 0 9212 14406 0 0]
954
]
955
"""
956
# Step 1
957
t = cputime()
958
959
k0 = klist[0] % (p-1)
960
n = floor(((p+1)/(p-1)) * (m+1))
961
ell = dimension_modular_forms(1, k0 + n*(p-1))
962
ellp = ell*p
963
mdash = m + ceil(n/(p+1))
964
965
verbose("done step 1", t)
966
t = cputime()
967
# Steps 2 and 3
968
969
e,Ep1 = katz_expansions(k0,p,ellp,mdash,n)
970
971
verbose("done steps 2+3", t)
972
t=cputime()
973
# Step 4
974
975
G = compute_G(p, Ep1)
976
Alist = []
977
978
verbose("done step 4a", t)
979
t=cputime()
980
for k in klist:
981
k = ZZ(k) # convert to sage integer
982
kdiv = k // (p-1)
983
Gkdiv = G**kdiv
984
u = []
985
for i in xrange(0,ell):
986
ei = e[i]
987
ui = Gkdiv*ei
988
u.append(ui)
989
990
verbose("done step 4b", t)
991
t = cputime()
992
# Step 5 and computation of T in Step 6
993
994
S = e[0][0].parent()
995
T = matrix(S,ell,ell)
996
997
for i in xrange(0,ell):
998
for j in xrange(0,ell):
999
T[i,j] = u[i][p*j]
1000
1001
verbose("done step 5", t)
1002
t = cputime()
1003
# Step 6: solve T = AE using fact E is upper triangular.
1004
# Warning: assumes that T = AE (rather than pT = AE) has
1005
# a solution over Z/(p^mdash). This has always been the case in
1006
# examples computed by the author, see Note 3.1.
1007
1008
A = matrix(S,ell,ell)
1009
verbose("solving a square matrix problem of dimension %s" % ell, t)
1010
1011
for i in xrange(0,ell):
1012
Ti = T[i]
1013
for j in xrange(0,ell):
1014
ej = Ti.parent()([e[j][l] for l in xrange(0,ell)])
1015
lj = ZZ(ej[j])
1016
A[i,j] = S(ZZ(Ti[j])/lj)
1017
Ti = Ti - A[i,j]*ej
1018
1019
Alist.append(MatrixSpace(Zmod(p**m),ell,ell)(A))
1020
verbose("done step 6", t)
1021
1022
return Alist
1023
1024
# *** CODE FOR GENERAL LEVEL ***
1025
1026
def is_valid_weight_list(klist,p):
1027
r"""
1028
This function checks that ``klist`` is a nonempty list of integers all of
1029
which are congruent modulo `(p-1)`. Otherwise, it will raise a ValueError.
1030
1031
INPUT:
1032
1033
- ``klist`` -- list of integers.
1034
- ``p`` -- prime.
1035
1036
EXAMPLES::
1037
1038
sage: from sage.modular.overconvergent.hecke_series import is_valid_weight_list
1039
sage: is_valid_weight_list([10,20,30],11)
1040
sage: is_valid_weight_list([-3, 1], 5)
1041
sage: is_valid_weight_list([], 3)
1042
Traceback (most recent call last):
1043
...
1044
ValueError: List of weights must be non-empty
1045
sage: is_valid_weight_list([-3, 2], 5)
1046
Traceback (most recent call last):
1047
...
1048
ValueError: List of weights must be all congruent modulo p-1 = 4, but given list contains -3 and 2 which are not congruent
1049
"""
1050
if len(klist) == 0:
1051
raise ValueError, "List of weights must be non-empty"
1052
k0 = klist[0] % (p-1)
1053
for i in xrange(1,len(klist)):
1054
if (klist[i] % (p-1)) != k0:
1055
raise ValueError, "List of weights must be all congruent modulo p-1 = %s, but given list contains %s and %s which are not congruent" % (p-1, klist[0], klist[i])
1056
1057
def hecke_series(p,N,klist,m, modformsring = False, weightbound = 6):
1058
r"""
1059
Returns the characteristic series modulo `p^m` of the Atkin operator `U_p`
1060
acting upon the space of p-adic overconvergent modular forms of level
1061
`\Gamma_0(N)` and weight ``klist``. The input ``klist`` may also be a list
1062
of weights congruent modulo `(p-1)`, in which case the output is the
1063
corresponding list of characteristic series for each `k` in ``klist``; this
1064
is faster than performing the computation separately for each `k`, since
1065
intermediate steps in the computation may be reused.
1066
1067
If ``modformsring`` is True, then for `N > 1` the algorithm computes at one
1068
step ``ModularFormsRing(N).generators()``. This will often be faster but
1069
the algorithm will default to ``modformsring = False`` if the generators
1070
found are not p-adically integral. Note that ``modformsring`` is ignored
1071
for `N = 1` and the ring structure of modular forms is *always* used in
1072
this case.
1073
1074
When ``modformsring`` is False and `N > 1`, `weightbound` is a bound set on
1075
the weight of generators for a certain subspace of modular forms. The
1076
algorithm will often be faster if ``weightbound = 4``, but it may fail to
1077
terminate for certain exceptional small values of `N`, when this bound is
1078
too small.
1079
1080
The algorithm is based upon that described in [AGBL]_.
1081
1082
INPUT:
1083
1084
- ``p`` -- a prime greater than or equal to 5.
1085
- ``N`` -- a positive integer not divisible by `p`.
1086
- ``klist`` -- either a list of integers congruent modulo `(p-1)`, or a single integer.
1087
- ``m`` -- a positive integer.
1088
- ``modformsring`` -- ``True`` or ``False`` (optional, default ``False``).
1089
Ignored if `N = 1`.
1090
- ``weightbound`` -- a positive even integer (optional, default 6). Ignored
1091
if `N = 1` or ``modformsring`` is True.
1092
1093
OUTPUT:
1094
1095
Either a list of polynomials or a single polynomial over the integers modulo `p^m`.
1096
1097
EXAMPLES::
1098
1099
sage: hecke_series(5,7,10000,5, modformsring = True) # long time (3.4s)
1100
250*x^6 + 1825*x^5 + 2500*x^4 + 2184*x^3 + 1458*x^2 + 1157*x + 1
1101
sage: hecke_series(7,3,10000,3, weightbound = 4)
1102
196*x^4 + 294*x^3 + 197*x^2 + 341*x + 1
1103
sage: hecke_series(19,1,[10000,10018],5)
1104
[1694173*x^4 + 2442526*x^3 + 1367943*x^2 + 1923654*x + 1,
1105
130321*x^4 + 958816*x^3 + 2278233*x^2 + 1584827*x + 1]
1106
1107
Check that silly weights are handled correctly::
1108
1109
sage: hecke_series(5, 7, [2, 3], 5)
1110
Traceback (most recent call last):
1111
...
1112
ValueError: List of weights must be all congruent modulo p-1 = 4, but given list contains 2 and 3 which are not congruent
1113
sage: hecke_series(5, 7, [3], 5)
1114
[1]
1115
sage: hecke_series(5, 7, 3, 5)
1116
1
1117
"""
1118
# convert to sage integers
1119
p = ZZ(p)
1120
N = ZZ(N)
1121
m = ZZ(m)
1122
weightbound = ZZ(weightbound)
1123
1124
oneweight = False
1125
# convert single weight to list
1126
if ((type(klist) == int) or (type(klist) == Integer)):
1127
klist = [klist]
1128
oneweight = True # input is single weight
1129
1130
# algorithm may finish with false output unless:
1131
is_valid_weight_list(klist,p)
1132
if not p.is_prime():
1133
raise ValueError, "p (=%s) is not prime" % p
1134
if p < 5:
1135
raise ValueError, "p = 2 and p = 3 not supported"
1136
if not N%p:
1137
raise ValueError, "Level (=%s) should be prime to p (=%s)" % (N, p)
1138
1139
# return all 1 list for odd weights
1140
if klist[0] % 2 == 1:
1141
if oneweight:
1142
return 1
1143
else:
1144
return [1 for i in xrange(len(klist))]
1145
1146
if N == 1:
1147
Alist = level1_UpGj(p,klist,m)
1148
else:
1149
Alist = higher_level_UpGj(p,N,klist,m,modformsring,weightbound)
1150
1151
Plist = []
1152
for A in Alist:
1153
P = charpoly(A).reverse()
1154
Plist.append(P)
1155
1156
if oneweight == True:
1157
return Plist[0]
1158
else:
1159
return Plist
1160
1161