Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/sage/modular/arithgroup/congroup.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def degeneracy_coset_representatives_gamma0(int N, int M, int t):
dd = dd / g
# Test if we've found a new coset representative.
is_new = 1
for i from 0 <= i < k:
for i in range(k):
j = 4*i
if (R[j+1]*aa - R[j]*bb) % t == 0 and \
(R[j+3]*cc - R[j+2]*dd) % Ndivt == 0:
Expand Down Expand Up @@ -237,7 +237,7 @@ def degeneracy_coset_representatives_gamma1(int N, int M, int t):
continue
# Test if we've found a new coset representative.
is_new = 1
for i from 0 <= i < k:
for i in range(k):
j = 4*i
if (R[j] - aa) % t == 0 and \
(R[j+1] - bb) % t == 0 and \
Expand All @@ -258,7 +258,7 @@ def degeneracy_coset_representatives_gamma1(int N, int M, int t):

# Return the list left multiplied by T.
S = []
for i from 0 <= i < k:
for i in range(k):
j = 4*i
S.append([R[j], R[j+1], R[j+2]*t, R[j+3]*t])
sig_free(R)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/modular/modform/eis_series_cython.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ cpdef Ek_ZZ(int k, int prec=10):
while True:
continue_flag = 0
# do the first p-1
for i from 0 < i < p:
for i in range(1, p):
ind += p
if (ind >= prec):
continue_flag = 1
Expand Down Expand Up @@ -215,7 +215,7 @@ cpdef eisenstein_series_poly(int k, int prec = 10) :
mpz_clear(last_m1)

fmpz_poly_set_coeff_mpz(res.poly, prec-1, val[prec-1])
for i from 1 <= i < prec - 1 :
for i in range(1, prec - 1):
fmpz_poly_set_coeff_mpz(res.poly, i, val[i])

fmpz_poly_scalar_mul_mpz(res.poly, res.poly, (<Integer>(a0.denominator())).value)
Expand Down
8 changes: 4 additions & 4 deletions src/sage/modular/modform/l_series_gross_zagier_coeffs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def bqf_theta_series(Q, long bound, var=None):
cdef long a, b, c
a, b, c = Q
cdef long* terms = bqf_theta_series_c(NULL, bound, a, b, c)
L = [terms[i] for i from 0 <= i <= bound]
L = [terms[i] for i in range(bound + 1)]
sig_free(terms)
return to_series(L, var)

Expand All @@ -85,13 +85,13 @@ cdef long* bqf_theta_series_c(long* terms, long bound, long a, long b, long c) e
terms = <long*>check_calloc(1 + bound, sizeof(long))

sig_on()
for x from -xmax <= x <= xmax:
for x in range(-xmax, xmax + 1):
yD = b * b * x * x - 4 * c * (a * x * x - bound)
if yD > 0:
sqrt_yD = sqrt(yD)
ymin = <long>ceil((-b * x - sqrt_yD) / (2 * c))
ymax = <long>floor((-b * x + sqrt_yD) / (2 * c))
for y from ymin <= y <= ymax:
for y in range(ymin, ymax + 1):
terms[a * x * x + b * x * y + c * y * y] += 1
sig_off()
return terms
Expand Down Expand Up @@ -161,7 +161,7 @@ def gross_zagier_L_series(an_list, Q, long N, long u, var=None):
i += 1
sig_on()
memcpy(terms, con_terms, sizeof(long) * bound) # m = 1
for m from 2 <= m <= <long>sqrt(bound):
for m in range(2, <long>sqrt(bound) + 1):
if arith.c_gcd_longlong(D * N, m) == 1:
me = m * kronecker_symbol(D, m)
j = 0
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/modsym/apply.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def apply_to_monomial(int i, int j, int a, int b, int c, int d):

cdef Integer res
v = []
for k from 0 <= k <= j:
for k in range(j + 1):
res = <Integer>PY_NEW(Integer)
fmpz_poly_get_coeff_mpz(res.value, pr, k)
v.append(int(res))
Expand Down
30 changes: 15 additions & 15 deletions src/sage/modular/modsym/p1list.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ cdef int c_p1_normalize_int(int N, int u, int v,
Ng = N/g
vNg = (v*Ng) % N
t = 1
for k from 2 <= k <= g:
for k in range(2, g + 1):
v = (v + vNg) % N
t = (t + Ng) % N
if v<min_v and arith_int.c_gcd_int(t,N)==1:
Expand Down Expand Up @@ -220,8 +220,8 @@ def p1list_int(int N):

lst = [(0,1)]
c = 1
for d from 0 <= d < N:
lst.append((c,d))
for d in range(N):
lst.append((c, d))

cmax = N // 2
if N % 2: # N odd, max divisor is <= N/3
Expand All @@ -230,11 +230,11 @@ def p1list_int(int N):
else:
cmax = N // 3

for c from 2 <= c <= cmax:
for c in range(2, cmax + 1):
if N % c == 0: # c is a proper divisor
h = N // c
g = arith_int.c_gcd_int(c, h)
for d from 1 <= d <= h:
for d in range(1, h + 1):
sig_check()
if arith_int.c_gcd_int(d, g) == 1:
d1 = d
Expand Down Expand Up @@ -373,10 +373,10 @@ cdef int c_p1_normalize_llong(int N, int u, int v,
Ng = N/g
vNg = <int> ((<llong>v * <llong> Ng) % ll_N)
t = 1
for k from 2 <= k <= g:
for k in range(2, g + 1):
v = (v + vNg) % N
t = (t + Ng) % N
if v<min_v and arith_int.c_gcd_int(t,N)==1:
if v < min_v and arith_int.c_gcd_int(t, N) == 1:
min_v = v
min_t = t
v = min_v
Expand Down Expand Up @@ -472,8 +472,8 @@ def p1list_llong(int N):

lst = [(0,1)]
c = 1
for d from 0 <= d < N:
lst.append((c,d))
for d in range(N):
lst.append((c, d))

cmax = N // 2
if N % 2: # N odd, max divisor is <= N/3
Expand All @@ -482,18 +482,18 @@ def p1list_llong(int N):
else:
cmax = N // 3

for c from 2 <= c <= cmax:
for c in range(2, cmax + 1):
if N % c == 0: # c is a proper divisor
h = N // c
g = arith_int.c_gcd_int(c, h)
for d from 1 <= d <= h:
for d in range(1, h + 1):
if arith_int.c_gcd_int(d, g) == 1:
sig_check()
d1 = d
while arith_int.c_gcd_int(d1, c) != 1:
d1 += h
c_p1_normalize_llong(N, c, d1, &u, &v, &s, 0)
lst.append((u,v))
lst.append((u, v))
lst.sort()
return lst

Expand Down Expand Up @@ -663,7 +663,7 @@ cdef int p1_normalize_xgcdtable(int N, int u, int v,
Ng = N/g
vNg = (v*Ng) % N
t = 1
for k from 2 <= k <= g:
for k in range(2, g + 1):
v = (v + vNg) % N
t = (t + Ng) % N
if v < min_v and t_g[t] == 1: # arith_int.c_gcd_int(t,N)==1:
Expand Down Expand Up @@ -744,10 +744,10 @@ cdef class P1List():
cdef llong ll_s, ll_t, ll_N = N

if N <= 46340:
for i from 0 <= i < N:
for i in range(N):
self.g[i] = arith_int.c_xgcd_int(i, N, &self.s[i], &self.t[i])
else:
for i from 0 <= i < N:
for i in range(N):
self.g[i] = arith_llong.c_xgcd_longlong(i, N, &ll_s, &ll_t)
self.s[i] = <int>(ll_s % ll_N)
self.t[i] = <int>(ll_t % ll_N)
Expand Down