-
Notifications
You must be signed in to change notification settings - Fork 4
/
changes_to_sagelib.patch
274 lines (258 loc) · 9.96 KB
/
changes_to_sagelib.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# HG changeset patch
# User David Roe <[email protected]>
# Date 1334787052 25200
# Node ID f15c22727ca0159fe236ecd83c415bea2ec05cb4
# Parent 8352a4055d80dc42d481f6f0f549532d0e155872
Changes to Sage library for Pollack-Stevens
diff --git a/module_list.py b/module_list.py
--- a/module_list.py
+++ b/module_list.py
@@ -1207,6 +1207,13 @@
sources = ['sage/modular/modsym/p1list.pyx'],
libraries = ['gmp']),
+ Extension('sage.modular.pollack_stevens.dist',
+ sources = ['sage/modular/pollack_stevens/dist.pyx'],
+ libraries = ['flint','gmp','zn_poly'],
+ extra_compile_args=['-std=c99', '-D_XPG6'],
+ include_dirs = [SAGE_INC + 'FLINT/'],
+ depends = flint_depends),
+
################################
##
## sage.modules
diff --git a/sage/matrix/matrix_integer_2x2.pyx b/sage/matrix/matrix_integer_2x2.pyx
--- a/sage/matrix/matrix_integer_2x2.pyx
+++ b/sage/matrix/matrix_integer_2x2.pyx
@@ -385,11 +385,14 @@
sage: m == n
False
"""
- return mpz_cmp(left.a, (<Matrix_integer_2x2>right).a) or \
- mpz_cmp(left.b, (<Matrix_integer_2x2>right).b) or \
- mpz_cmp(left.c, (<Matrix_integer_2x2>right).c) or \
- mpz_cmp(left.d, (<Matrix_integer_2x2>right).d)
-
+ cdef int c = mpz_cmp(left.a, (<Matrix_integer_2x2>right).a) or \
+ mpz_cmp(left.b, (<Matrix_integer_2x2>right).b) or \
+ mpz_cmp(left.c, (<Matrix_integer_2x2>right).c) or \
+ mpz_cmp(left.d, (<Matrix_integer_2x2>right).d)
+ if c < 0: return -1
+ if c > 0: return 1
+ return 0
+
def __neg__(self):
"""
Return the additive inverse of self.
diff --git a/sage/modular/all.py b/sage/modular/all.py
--- a/sage/modular/all.py
+++ b/sage/modular/all.py
@@ -30,7 +30,10 @@
from overconvergent.all import *
+from pollack_stevens.all import *
+
from local_comp.all import *
from cusps_nf import NFCusp, NFCusps, NFCusps_clear_cache, Gamma0_NFCusps
+from btquotients.all import *
diff --git a/sage/modular/modform/element.py b/sage/modular/modform/element.py
--- a/sage/modular/modform/element.py
+++ b/sage/modular/modform/element.py
@@ -19,6 +19,7 @@
from sage.modules.free_module_element import vector
from sage.misc.misc import verbose
from sage.modular.dirichlet import DirichletGroup
+from sage.modular.pollack_stevens.space import ps_modsym_from_simple_modsym_space
def is_ModularFormElement(x):
"""
@@ -834,6 +835,19 @@
"""
return self.__modsym_space.modular_symbols_of_sign(sign)
+ def PS_modular_symbol(self, sign=1):
+ r"""
+ Return the Pollack-Stevens modular symbol attached to this newform.
+
+ EXAMPLE::
+
+ sage: f = Newform('37a')
+ sage: f.PS_modular_symbol()
+ Modular symbol with values in Sym^0 Q^2
+ """
+ M = self.modular_symbols(sign)
+ return ps_modsym_from_simple_modsym_space(M)
+
def _defining_modular_symbols(self):
"""
Return the modular symbols space corresponding to self.
diff --git a/sage/modular/overconvergent/all.py b/sage/modular/overconvergent/all.py
--- a/sage/modular/overconvergent/all.py
+++ b/sage/modular/overconvergent/all.py
@@ -2,4 +2,6 @@
from genus0 import OverconvergentModularForms
+from pollack.all import *
+
from hecke_series import hecke_series
diff --git a/sage/rings/padics/padic_ZZ_pX_CR_element.pyx b/sage/rings/padics/padic_ZZ_pX_CR_element.pyx
--- a/sage/rings/padics/padic_ZZ_pX_CR_element.pyx
+++ b/sage/rings/padics/padic_ZZ_pX_CR_element.pyx
@@ -2239,6 +2239,39 @@
# for now, a simple implementation
return self * (~right)
+ def add_bigoh(self, _n):
+ if _n is infinity:
+ return self
+ _n = Integer(_n)
+ cdef long n, aprec
+ if mpz_fits_slong_p((<Integer>_n).value):
+ n = mpz_get_si((<Integer>_n).value)
+ elif mpz_sgn((<Integer>_n).value) > 0:
+ return self
+ else:
+ raise ValueError("negative valuation too large")
+ if self.relprec < 0:
+ aprec = self.ordp - self.relprec
+ else:
+ aprec = self.ordp + self.relprec
+ if n >= aprec:
+ return self
+ if n <= self.ordp:
+ ans = self._new_c(0)
+ ans.ordp = n
+ else:
+ ans = self._new_c(n - self.ordp)
+ ans.ordp = self.ordp
+ if n < 0 and not ans.prime_pow.in_field:
+ ans._parent = self._parent.fraction_field()
+ ans.prime_pow = ans._parent.prime_pow
+ if ans.relprec == 0:
+ return ans
+ ZZ_pX_conv_modulus(ans.unit, self.unit, self.prime_pow.get_context_capdiv(ans.relprec).x)
+ if self.relprec < 0:
+ ans.relprec = -ans.relprec
+ return ans
+
def __copy__(self):
"""
Returns a copy of ``self``.
diff --git a/sage/rings/padics/padic_capped_absolute_element.pyx b/sage/rings/padics/padic_capped_absolute_element.pyx
--- a/sage/rings/padics/padic_capped_absolute_element.pyx
+++ b/sage/rings/padics/padic_capped_absolute_element.pyx
@@ -1372,7 +1372,7 @@
else:
return self
- def valuation(self):
+ def valuation(self, p=None):
"""
Returns the valuation of ``self``, ie the largest power of `p`
dividing ``self``.
@@ -1402,7 +1402,8 @@
"""
# We override this, rather than using the valuation in
# padic_generic_element, for speed reasons.
-
+ if p is not None and p != self.prime_pow.prime:
+ raise ValueError("p must be the same as the prime")
cdef Integer ans
ans = PY_NEW(Integer)
mpz_set_ui(ans.value, self.valuation_c())
diff --git a/sage/rings/padics/pow_computer.pxd b/sage/rings/padics/pow_computer.pxd
--- a/sage/rings/padics/pow_computer.pxd
+++ b/sage/rings/padics/pow_computer.pxd
@@ -20,4 +20,8 @@
cdef class PowComputer_base(PowComputer_class):
cdef mpz_t* small_powers
cdef mpz_t top_power
- cdef object __weakref__
\ No newline at end of file
+ cdef object __weakref__
+
+cdef class PowComputer_long(PowComputer_class):
+ cdef long* small_powers
+ cdef object __weakref__
diff --git a/sage/rings/padics/pow_computer.pyx b/sage/rings/padics/pow_computer.pyx
--- a/sage/rings/padics/pow_computer.pyx
+++ b/sage/rings/padics/pow_computer.pyx
@@ -503,7 +503,42 @@
return &(self.top_power)
mpz_pow_ui(self.temp_m, self.prime.value, n)
return &(self.temp_m)
-
+
+cdef class PowComputer_long(PowComputer_class):
+ def __cinit__(self, Integer prime, long cache_limit, long prec_cap, long ram_prec_cap, bint in_field, poly=None, shift_seed=None):
+ self._initialized = 0
+ sig_on()
+ self.small_powers = <long*>sage_malloc(sizeof(mpz_t) * (cache_limit + 1))
+ sig_off()
+ if self.small_powers == NULL:
+ raise MemoryError("out of memory allocating power storing")
+ mpz_init(self.temp_m)
+
+ cdef Py_ssize_t i
+ self.small_powers[0] = 1
+ if cache_limit > 0:
+ self.small_powers[1] = mpz_get_si(prime.value)
+ for i from 2 <= i <= cache_limit:
+ self.small_powers[i] = self.small_powers[i-1] * self.small_powers[1]
+ (<PowComputer_class>self)._initialized = 1
+
+ def __dealloc__(self):
+ cdef Py_ssize_t i
+ if (<PowComputer_class>self)._initialized:
+ sage_free(self.small_powers)
+ mpz_clear(self.temp_m)
+
+ cdef mpz_t* pow_mpz_t_top(self):
+ mpz_set_si(self.temp_m, self.small_powers[self.prec_cap])
+ return &self.temp_m
+
+ cdef mpz_t* pow_mpz_t_tmp(self, long n):
+ if n <= self.cache_limit:
+ mpz_set_si(self.temp_m, self.small_powers[n])
+ else:
+ mpz_pow_ui(self.temp_m, self.prime.value, n)
+ return &(self.temp_m)
+
pow_comp_cache = {}
cdef PowComputer_base PowComputer_c(Integer m, Integer cache_limit, Integer prec_cap, in_field):
"""
diff --git a/sage/schemes/elliptic_curves/ell_rational_field.py b/sage/schemes/elliptic_curves/ell_rational_field.py
--- a/sage/schemes/elliptic_curves/ell_rational_field.py
+++ b/sage/schemes/elliptic_curves/ell_rational_field.py
@@ -1235,6 +1235,19 @@
padic_lseries = padics.padic_lseries
+ def PS_modular_symbol(self):
+ r"""
+ Return the Pollack-Stevens modular symbol of E.
+
+ EXAMPLE::
+
+ sage: E = EllipticCurve('389a')
+ sage: E.PS_modular_symbol()
+ Modular symbol with values in Sym^0 Q^2
+ """
+ from sage.modular.pollack_stevens.space import ps_modsym_from_elliptic_curve
+ return ps_modsym_from_elliptic_curve(self)
+
def newform(self):
r"""
Same as ``self.modular_form()``.
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -744,7 +744,7 @@
debug = '--gdb'
# call cython, abort if it failed
- cmd = "cython %s %s --old-style-globals --embed-positions --directive cdivision=True,autotestdict=False,fast_getattr=True -I%s -o %s %s"%(debug, cplus, os.getcwd(), outfile, f)
+ cmd = "cython %s %s --old-style-globals --disable-function-redefinition --embed-positions --directive cdivision=True,autotestdict=False,fast_getattr=True -I'%s' -I%s -o %s %s"%(debug, cplus, os.path.join(SAGE_DEVEL,'sage','sage','ext'), os.getcwd(), outfile, f)
r = run_command(cmd)
if r:
return r
@@ -962,7 +962,10 @@
'sage.modular.modsym',
'sage.modular.quatalg',
'sage.modular.ssmod',
+ 'sage.modular.btquotients',
+ 'sage.modular.pollack_stevens',
'sage.modular.overconvergent',
+ 'sage.modular.overconvergent.pollack',
'sage.modular.local_comp',
'sage.monoids',