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"
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")