-
-
Notifications
You must be signed in to change notification settings - Fork 552
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #26611: py3: fix hypergeometric motives
plus some pep8 details URL: https://trac.sagemath.org/26611 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): Vincent Klein
- Loading branch information
Showing
1 changed file
with
18 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,16 +48,16 @@ | |
- [Watkins]_ | ||
""" | ||
#***************************************************************************** | ||
# **************************************************************************** | ||
# Copyright (C) 2017 Frédéric Chapoton | ||
# Kiran S. Kedlaya <[email protected]> | ||
# | ||
# Distributed under the terms of the GNU General Public License (GPL) | ||
# as published by the Free Software Foundation; either version 2 of | ||
# the License, or (at your option) any later version. | ||
# | ||
# http://www.gnu.org/licenses/ | ||
#***************************************************************************** | ||
# https://www.gnu.org/licenses/ | ||
# **************************************************************************** | ||
|
||
from collections import defaultdict | ||
from itertools import combinations | ||
|
@@ -196,12 +196,13 @@ def enumerate_hypergeometric_data(d, weight=None): | |
def formule(u): | ||
return [possible[j][0] for j in range(N) for _ in range(u[j])] | ||
|
||
for a,b in combinations(vectors, 2): | ||
for a, b in combinations(vectors, 2): | ||
if not any(a[j] and b[j] for j in range(N)): | ||
H = HypergeometricData(cyclotomic=(formule(a), formule(b))) | ||
if weight is None or H.weight() == weight: | ||
yield H | ||
|
||
|
||
def possible_hypergeometric_data(d, weight=None): | ||
""" | ||
Return the list of possible parameters of hypergeometric motives (up to swapping). | ||
|
@@ -220,6 +221,7 @@ def possible_hypergeometric_data(d, weight=None): | |
""" | ||
return list(enumerate_hypergeometric_data(d, weight)) | ||
|
||
|
||
def cyclotomic_to_alpha(cyclo): | ||
""" | ||
Convert a list of indices of cyclotomic polynomials | ||
|
@@ -749,7 +751,7 @@ def gamma_list(self): | |
""" | ||
gamma = self.gamma_array() | ||
resu = [] | ||
for v, n in gamma.items(): | ||
for v, n in sorted(gamma.items()): | ||
resu += [sgn(n) * v] * abs(n) | ||
return resu | ||
|
||
|
@@ -982,29 +984,30 @@ def padic_H_value(self, p, f, t, prec=None): | |
|
||
# m = {r: beta.count(QQ((r, q - 1))) for r in range(q - 1)} | ||
m = defaultdict(lambda: 0) | ||
for r in range(q-1): | ||
u = QQ((r, q-1)) | ||
for r in range(q - 1): | ||
u = QQ((r, q - 1)) | ||
if u in beta: | ||
m[r] = beta.count(u) | ||
M = self.M_value() | ||
D = -min(self.zigzag(x, flip_beta=True) for x in alpha + beta) | ||
# also: D = (self.weight() + 1 - m[0]) // 2 | ||
|
||
if prec is None: | ||
prec = (self.weight()*f)//2 + ceil(log(self.degree(),p)) + 1 | ||
prec = (self.weight() * f) // 2 + ceil(log(self.degree(), p)) + 1 | ||
# For some reason, working in Qp instead of Zp is much faster; | ||
# it appears to avoid some costly conversions. | ||
p_ring = Qp(p, prec=prec) | ||
teich = p_ring.teichmuller(M / t) | ||
|
||
gauss_table = [padic_gauss_sum(r, p, f, prec, factored=True, algorithm='sage', parent=p_ring) | ||
for r in range(q-1)] | ||
gauss_table = [padic_gauss_sum(r, p, f, prec, factored=True, | ||
algorithm='sage', parent=p_ring) | ||
for r in range(q - 1)] | ||
|
||
sigma = sum( ((-p)**(sum(gauss_table[(v * r) % (q - 1)][0] * gv | ||
sigma = sum(((-p)**(sum(gauss_table[(v * r) % (q - 1)][0] * gv | ||
for v, gv in gamma.items()) // (p - 1)) * | ||
prod(gauss_table[(v * r) % (q - 1)][1] ** gv | ||
for v, gv in gamma.items()) * teich ** r) | ||
<< (f*(D+m[0]-m[r])) for r in range(q-1)) | ||
prod(gauss_table[(v * r) % (q - 1)][1] ** gv | ||
for v, gv in gamma.items()) * teich ** r) | ||
<< (f * (D + m[0] - m[r])) for r in range(q - 1)) | ||
resu = ZZ(-1) ** m[0] / (1 - q) * sigma | ||
return IntegerModRing(p**prec)(resu).lift_centered() | ||
|
||
|
@@ -1136,7 +1139,7 @@ def sign(self, t, p): | |
else: | ||
sign = kronecker_symbol(t * (t - 1) * self._sign_param, p) | ||
return sign | ||
|
||
@cached_method | ||
def euler_factor(self, t, p): | ||
""" | ||
|