def __mul__(self, other): if is_number(other): if other == 1: return self fcmap = _mul_fourier_by_num(self.fc_dct, other, self.prec, cuspidal=self._is_cuspidal, hol=True) if hasattr(other, "parent"): bs = _common_base_ring(self.base_ring, other.parent()) else: bs = self.base_ring return ModFormQexpLevel1(self.wt, fcmap, self.prec, base_ring=bs, is_cuspidal=self._is_cuspidal, given_reduced_tuples_only=True) if isinstance(other, ModFormQexpLevel1) and other.wt == 0: return self.__mul__(other[(0, 0, 0)]) if is_hol_mod_form(other): prec = common_prec([self, other]) bsring = _common_base_ring(self.base_ring, other.base_ring) ms = self.fc_dct mo = other.fc_dct cuspidal = self._is_cuspidal or other._is_cuspidal fcmap = _mul_fourier(ms, mo, prec, cuspidal=cuspidal, hol=True) return ModFormQexpLevel1(self.wt + other.wt, fcmap, prec, base_ring=bsring, is_cuspidal=cuspidal, given_reduced_tuples_only=True) else: return QexpLevel1.__mul__(self, other)
def __eq__(self, other): if is_number(other) and other == 0: return self.vec == 0 if isinstance(other, SymTensorRepElt): return self.wt == other.wt and self.vec == other.vec else: raise NotImplementedError
def __mul__(self, other): if is_number(other): if other == 1: return self fcmap = _mul_fourier_by_num(self.fc_dct, other, self.prec, self._is_cuspidal) if hasattr(other, "parent"): bs = _common_base_ring(self.base_ring, other.parent()) else: bs = self.base_ring return QexpLevel1(fcmap, self.prec, base_ring=bs, is_cuspidal=self._is_cuspidal) elif isinstance(other, QexpLevel1): prec = common_prec([self, other]) bsring = _common_base_ring(self.base_ring, other.base_ring) ms = self.fc_dct mo = other.fc_dct cuspidal = self._is_cuspidal or other._is_cuspidal fcmap = _mul_fourier(ms, mo, prec, cuspidal) res = QexpLevel1(fcmap, prec, base_ring=bsring, is_cuspidal=cuspidal) return res elif isinstance(other, (SymWtGenElt, QseriesTimesQminushalf)): return other.__mul__(self) else: raise NotImplementedError
def __getitem__(self, t): if (isinstance(t, tuple) and isinstance(t[0], tuple) and is_number(t[1])): tpl, i = t return self.forms[i][tpl] else: vec = vector([f[t] for f in self.forms]) return vec
def __mul__(self, other): if isinstance(other, QseriesTimesQminushalf): return _mul_q_half_monom(self.f_part * other.f_part) elif isinstance(other, QexpLevel1) or is_number(other): return QseriesTimesQminushalf(self.f_part * other) elif isinstance(other, SymWtGenElt): return other.__mul__(self) else: raise NotImplementedError
def __rmul__(self, other): if is_number(other): return self.__mul__(other) elif isinstance(other, list) or (hasattr(other, "parent") and isinstance( other.parent(), sage.matrix.matrix_space.MatrixSpace)): return self.group_action(other) else: raise NotImplementedError
def __mul__(self, other): res = QseriesTimesQminushalf.__mul__(self, other) if is_number(other): return ModFormQsrTimesQminushalf(res.f_part, self.wt) elif isinstance(other, ModFormQexpLevel1): return ModFormQsrTimesQminushalf(res.f_part, self.wt + other.wt) elif isinstance(other, ModFormQsrTimesQminushalf): return ModFormQexpLevel1(self.wt + other.wt, res.fc_dct, res.prec, base_ring=res.base_ring) else: return res
def __mul__(self, other): res = SymWtGenElt.__mul__(self, other) if is_number(other): return SymWtModFmElt(res.forms, self.wt, res.prec, res.base_ring) if isinstance(other, (ModFormQexpLevel1, ModFormQsrTimesQminushalf)): return SymWtModFmElt(res.forms, self.wt + other.wt, res.prec, res.base_ring) else: return res
def _linearly_indep_tuples_of_given_bd(self, bd): basis = self.basis() dim = self.dimension() if is_number(bd): bd = list(PrecisionDeg2(bd)) tpls = sorted(list(bd), key=lambda x: (x[0] + x[2], max(x[0], x[2]))) tpls_w_idx = reduce(operator.add, [[(t, i) for i in range(self.sym_wt + 1)] for t in tpls], []) ml = [[f.forms[i][t] for f in basis] for t, i in tpls_w_idx] index_list = linearly_indep_rows_index_list(ml, dim) res = [tpls_w_idx[i] for i in index_list] return res
def __pow__(self, other): if other == 0: return 1 elif other == 1: return self elif is_number(other) and other > 0: f = (self.f_part) ** other q, r = divmod(other, 2) g = _mul_q_half_monom(f, a=q) if r == 0: return g else: return QseriesTimesQminushalf(g) else: raise NotImplementedError
def __add__(self, other): if is_number(other): fcmap = self.fc_dct.copy() fcmap[(0, 0, 0)] = self.fc_dct[(0, 0, 0)] + other cuspidal = other == 0 and self._is_cuspidal return QexpLevel1(fcmap, self.prec, self.base_ring, is_cuspidal=cuspidal) prec = common_prec([self, other]) bsring = _common_base_ring(self.base_ring, other.base_ring) cuspidal = self._is_cuspidal and other._is_cuspidal ms = self.fc_dct mo = other.fc_dct fcmap = _add_fourier(ms, mo, prec, cuspidal) return QexpLevel1(fcmap, prec, base_ring=bsring, is_cuspidal=cuspidal)
def __mul__(self, other): if is_number(other): prec = self.prec forms = [other * f for f in self.forms] if hasattr(other, "parent"): base_ring = _common_base_ring(self.base_ring, other.parent()) else: base_ring = self.base_ring return SymWtGenElt(forms, prec, base_ring) if isinstance(other, (QexpLevel1, QseriesTimesQminushalf)): forms = [f * other for f in self.forms] prec = common_prec(forms) base_ring = _common_base_ring(self.base_ring, other.base_ring) return SymWtGenElt(forms, prec, base_ring) else: raise NotImplementedError
def __add__(self, other): if is_number(other): fcmap = self.fc_dct.copy() fcmap[(0, 0, 0)] = self.fc_dct[(0, 0, 0)] + other if other == 0: return ModFormQexpLevel1(self.wt, fcmap, self.prec, self.base_ring, is_cuspidal=self._is_cuspidal) else: return QexpLevel1(fcmap, self.prec, self.base_ring) if is_hol_mod_form(other) and self.wt == other.wt: prec = common_prec([self, other]) bsring = _common_base_ring(self.base_ring, other.base_ring) ms = self.fc_dct mo = other.fc_dct cuspidal = self._is_cuspidal and other._is_cuspidal fcmap = _add_fourier(ms, mo, prec, cuspidal=cuspidal, hol=True) return ModFormQexpLevel1(self.wt, fcmap, prec, bsring, is_cuspidal=cuspidal, given_reduced_tuples_only=True) else: return QexpLevel1.__add__(self, other)
def __mul__(self, other): if is_number(other): return SymTensorRepElt(self.vec * other, self.wt) else: raise NotImplementedError