本文整理汇总了Python中sage.all.ZZ.level方法的典型用法代码示例。如果您正苦于以下问题:Python ZZ.level方法的具体用法?Python ZZ.level怎么用?Python ZZ.level使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.all.ZZ
的用法示例。
在下文中一共展示了ZZ.level方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sage.all import ZZ [as 别名]
# 或者: from sage.all.ZZ import level [as 别名]
def __init__(self, p, congruence_type=1, sign=1, algorithm="custom", verbose=False, dump_dir=None):
"""
Create a Kamienny criterion object.
INPUT:
- `p` -- prime -- verify that there is no order p torsion
over a degree `d` field
- `sign` -- 1 (default),-1 or 0 -- the sign of the modular symbols space to use
- ``algorithm`` -- "default" or "custom" whether to use a custom (faster)
integral structure algorithm or to use the sage builtin algortihm
- ``verbose`` -- bool; whether to print extra stuff while
running.
EXAMPLES::
sage: from mdsage import *
sage: C = KamiennyCriterion(29, algorithm="custom", verbose=False); C
Kamienny's Criterion for p=29
sage: C.use_custom_algorithm
True
sage: C.p
29
sage: C.verbose
False
"""
self.verbose = verbose
self.dump_dir = dump_dir
if self.verbose: tm = cputime(); mem = get_memory_usage(); print "init"
assert congruence_type == 0 or congruence_type == 1
self.congruence_type=congruence_type
try:
p = ZZ(p)
if congruence_type==0:
self.congruence_group = Gamma0(p)
if congruence_type==1:
self.congruence_group = GammaH(p,[-1])
except TypeError:
self.congruence_group = GammaH(p.level(),[-1]+p._generators_for_H())
self.congruence_type = ("H",self.congruence_group._list_of_elements_in_H())
self.p = self.congruence_group.level()
self.algorithm=algorithm
self.sign=sign
self.M = ModularSymbols(self.congruence_group, sign=sign)
if self.verbose: print "time and mem", cputime(tm), get_memory_usage(mem), "modsym"
self.S = self.M.cuspidal_submodule()
if self.verbose: print "time and mem", cputime(tm), get_memory_usage(mem), "cuspsub"
self.use_custom_algorithm = False
if algorithm=="custom":
self.use_custom_algorithm = True
if self.use_custom_algorithm:
int_struct = self.integral_cuspidal_subspace()
if self.verbose: print "time and mem", cputime(tm), get_memory_usage(mem), "custom int_struct"
else:
int_struct = self.S.integral_structure()
if self.verbose: print "time and mem", cputime(tm), get_memory_usage(mem), "sage int_struct"
self.S_integral = int_struct
v = VectorSpace(GF(2), self.S.dimension()).random_element()
self.v=v
if self.verbose: print "time and mem", cputime(tm), get_memory_usage(mem), "rand_vect"
if dump_dir:
v.dump(dump_dir+"/vector%s_%s" % (p,congruence_type))
if self.verbose: print "time and mem", cputime(tm), get_memory_usage(mem), "dump"