def __init__(self, p, depth, act_on_left=False, adjuster=None): self._dimension = 0 ## Hack!! Dimension was being called before it was intialised self._Rmod = ZpCA(p, depth - 1) ## create Zp Module.__init__(self, base=self._Rmod) self.Element = BianchiDistributionElement self._R = ZZ self._p = p self._depth = depth self._pN = self._p**(depth - 1) self._cache_powers = dict() self._unset_coercions_used() ## Initialise monoid Sigma_0(p) + action; use Pollack-Stevens modular symbol code ## our_adjuster() is set above to allow different conventions if adjuster is None: adjuster = _default_adjuster() self._adjuster = adjuster ## Power series ring for representing distributions as strings self._repr_R = PowerSeriesRing(self._R, num_gens=2, default_prec=self._depth, names='X,Y') self._Sigma0Squared = Sigma0Squared(self._p, self._Rmod, adjuster) self._act = Sigma0SquaredAction(self._Sigma0Squared, self, act_on_left=act_on_left) self.register_action(self._act) self._populate_coercion_lists_() ## Initialise dictionaries of indices to translate between pairs and index for moments self._index = dict() self._ij = [] m = 0 ## Populate dictionary/array giving index of the basis element corr. to tuple (i,j), 0 <= i,j <= depth = n ## These things are ordered by degree of y, then degree of x: [1, x, x^2, ..., y, xy, ... ] for j in range(depth): for i in range(depth): self._ij.append((i, j)) self._index[(i, j)] = m m += 1 self._dimension = m ## Number of moments we store ## Power series ring Zp[[x,y]]. We have to work with monomials up to x^depth * y^depth, so need prec = 2*depth self._PowerSeries_x = PowerSeriesRing(self._Rmod, default_prec=self._depth, names='x') self._PowerSeries_x_ZZ = PowerSeriesRing(ZZ, default_prec=self._depth, names='x') self._PowerSeries = PowerSeriesRing(self._PowerSeries_x, default_prec=self._depth, names='y') self._PowerSeries_ZZ = PowerSeriesRing(self._PowerSeries_x_ZZ, default_prec=self._depth, names='y')
def create_key(self, k, p=None, prec_cap=None, base=None, \ character=None, adjuster=None, act_on_left=False, \ dettwist=None): k = ZZ(k) if base is None: if p is None: raise ValueError("Must specify a prime or a base ring.") if prec_cap is None: base = ZpCA(p) else: base = ZpCA(p, prec_cap) if prec_cap is None: prec_cap = base.precision_cap() elif prec_cap > base.precision_cap(): raise ValueError("Insufficient precision in base ring (%s < %s)."%(base.precision_cap(), prec_cap)) if p is None: p = base.prime() elif p != base.prime(): raise ValueError("Prime p(=%s) must equal the prime of the base ring(=%s)"%(p, base.prime())) if adjuster is None: adjuster = _default_adjuster() if dettwist is not None: dettwist = ZZ(dettwist) if dettwist == 0: dettwist = None return (k, p, prec_cap, base, character, adjuster, act_on_left, dettwist)
def create_key(self, k, p=None, prec_cap=None, base=None, \ character=None, adjuster=None, act_on_left=False, \ dettwist=None): k = ZZ(k) if base is None: if p is None: raise ValueError("Must specify a prime or a base ring.") if prec_cap is None: base = ZpCA(p) else: base = ZpCA(p, prec_cap) if prec_cap is None: prec_cap = base.precision_cap() elif prec_cap > base.precision_cap(): raise ValueError("Insufficient precision in base ring (%s < %s)." % (base.precision_cap(), prec_cap)) if p is None: p = base.prime() elif p != base.prime(): raise ValueError( "Prime p(=%s) must equal the prime of the base ring(=%s)" % (p, base.prime())) if adjuster is None: adjuster = _default_adjuster() if dettwist is not None: dettwist = ZZ(dettwist) if dettwist == 0: dettwist = None return (k, p, prec_cap, base, character, adjuster, act_on_left, dettwist)
def create_key(self, k, p=None, prec_cap=None, base=None, base_coeffs=None, \ character=None, adjuster=None, act_on_left=False, \ dettwist=None, variable_name = 'w'): if base is None: if base_coeffs is None: if p is None: raise ValueError("Must specify a prime, a base ring, or coefficients.") if prec_cap is None: raise ValueError("Must specify a precision cap or a base ring.") prec_cap = _prec_cap_parser(prec_cap) base_coeffs = Zp(p, prec = prec_cap[0]) elif not isinstance(base_coeffs, ring.Ring): raise TypeError("base_coeffs must be a ring if base is None") elif prec_cap is None: raise ValueError("Must specify a precision cap or a base ring.") else: prec_cap = _prec_cap_parser(prec_cap) if base_coeffs.precision_cap() < prec_cap[0]: raise ValueError("Precision cap on coefficients of base ring must be at least the p-adic precision cap of this space.") base = PowerSeriesRing(base_coeffs, name=variable_name, default_prec=prec_cap[1]) elif prec_cap is None: prec_cap = [ZZ(base.base_ring().precision_cap()), ZZ(base.default_prec())] else: if base.base_ring().precision_cap() < prec_cap[0]: raise ValueError("Precision cap on coefficients of base ring must be at least the p-adic precision cap of this space.") if base.default_prec() < prec_cap[1]: raise ValueError("Default precision on the variable of base ring must be at least the w-adic precision cap of this space.") base_coeffs = None p = base.base_ring().prime() k_shift = 0 #if character is not None: # #Should we ensure character is primitive? # cond_val = character.conductor().valuation(p) # if cond_val > 1: # raise ValueError("Level must not be divisible by p^2.") # elif cond_val == 1: # pass # else: # pass k = ZZ((k + k_shift) % (p-1)) #if prec_cap is None: # prec_cap = [base.base_ring().precision_cap, base.default_prec()] #else: # prec_cap = list(prec_cap) #prec_cap = [base.base_ring().precision_cap(), base.default_prec()] if adjuster is None: adjuster = _default_adjuster() if dettwist is not None: dettwist = ZZ(dettwist) if dettwist == 0: dettwist = None return (k, p, tuple(prec_cap), base, character, adjuster, act_on_left, dettwist)
def create_key(self, k, base=None, character=None, adjuster=None, act_on_left=False, dettwist=None): r""" Sanitize input. EXAMPLE:: sage: from sage.modular.pollack_stevens.distributions import Symk sage: Symk(6) # indirect doctest Sym^6 Q^2 sage: V = Symk(6, Qp(7)) sage: TestSuite(V).run() """ k = ZZ(k) if adjuster is None: adjuster = _default_adjuster() prec_cap = k+1 if base is None: base = QQ return (k, base, character, adjuster, act_on_left, dettwist)
def create_key(self, k, p=None, prec_cap=None, base=None, character=None, adjuster=None, act_on_left=False, dettwist=None): """ EXAMPLES:: sage: from sage.modular.pollack_stevens.distributions import Distributions sage: Distributions(20, 3, 10) # indirect doctest Space of 3-adic distributions with k=20 action and precision cap 10 sage: TestSuite(Distributions).run() """ k = ZZ(k) if p is None: try: p = base.prime() except AttributeError: raise ValueError("You must specify a prime") else: p = ZZ(p) if base is None: if prec_cap is None: base = ZpCA(p) else: base = ZpCA(p, prec_cap) if prec_cap is None: try: prec_cap = base.precision_cap() except AttributeError: raise ValueError("You must specify a base or precision cap") if adjuster is None: adjuster = _default_adjuster() if dettwist is not None: dettwist = ZZ(dettwist) if dettwist == 0: dettwist = None return (k, p, prec_cap, base, character, adjuster, act_on_left, dettwist)