code / alex / psage / psage / modform / fourier_expansion_framework / modularforms / modularform_interfaces.py
241852 viewsr"""1Interfaces for modular forms which admit Hecke actions or ring which have2Maass lifts.34AUTHOR :5-- Martin Raum (2009 - 07 - 30) Initial version6"""78#===============================================================================9#10# Copyright (C) 2009 Martin Raum11#12# This program is free software; you can redistribute it and/or13# modify it under the terms of the GNU General Public License14# as published by the Free Software Foundation; either version 315# of the License, or (at your option) any later version.16#17# This program is distributed in the hope that it will be useful,18# but WITHOUT ANY WARRANTY; without even the implied warranty of19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU20# General Public License for more details.21#22# You should have received a copy of the GNU General Public License23# along with this program; if not, see <http://www.gnu.org/licenses/>.24#25#===============================================================================2627from psage.modform.fourier_expansion_framework.gradedexpansions.gradedexpansion_element import GradedExpansion_abstract28from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_element import MonoidPowerSeries_abstract, \29EquivariantMonoidPowerSeries_abstract30from psage.modform.fourier_expansion_framework.modularforms.modularform_submodule import ModularFormsSubmoduleHeckeInvariant31from psage.modform.fourier_expansion_framework.gradedexpansions.fourierexpansionwrapper import FourierExpansionWrapper3233#===============================================================================34# ModularFormsAmbientWithHeckeAction_abstract35#===============================================================================3637class ModularFormsAmbientWithHeckeAction_abstract :38"""39The standard implementation assumes that the action only depends on the40modulus and the weight.41The deriving class must override self._hecke_operator_class or it will42be derived from the type.43"""4445def __init__(self, type) :46"""47TESTS::48sage: from psage.modform.fourier_expansion_framework.modularforms.modularform_ambient import *49sage: from psage.modform.fourier_expansion_framework.modularforms.modularform_testtype import *50sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *51sage: ma = ModularFormsModule_withheckeaction( QQ, ModularFormTestType_vectorvalued(), NNFilter(5) )52sage: sm = ma.graded_submodule(3)53sage: sm._hecke_action(7)54[(1)]55sage: ma = ModularFormsRing_withheckeaction( QQ, ModularFormTestType_scalar(), NNFilter(5) )56Traceback (most recent call last):57...58ValueError: Type for modular forms ambients with Hecke action must support Hecke operators.59"""60if not hasattr(self, '_hecke_operator_class') :61if not type.has_hecke_action() :62raise ValueError( "Type for modular forms ambients with Hecke action must support Hecke operators." )63self._hecke_operator_class = type._hecke_operator_class()6465hecke_invariant_pred = lambda basis, **kwds : "is_hecke_invariant" in kwds and kwds["is_hecke_invariant"]66def hecke_invariant_fcn(basis, **kwds) :67try :68return self.type()._submodule_heckeinvariant_class(self, basis, **kwds)69except NotImplementedError :70return ModularFormsSubmoduleHeckeInvariant(self, basis, **kwds)7172self._submodule_classes.insert(-2, (hecke_invariant_pred, hecke_invariant_fcn))7374def _hecke_action(self, n, form) :75"""76The image of ``form`` under the `n`-th Hecke operator.7778INPUT:79- `n` -- A Hecke modulus. Probably an integer.80- ``form`` -- An element whose parent supports conversion from81Fourier expansions.8283OUTPUT:84An element in the parent of ``form``.8586TESTS::87sage: from psage.modform.fourier_expansion_framework.modularforms.modularform_ambient import *88sage: from psage.modform.fourier_expansion_framework.modularforms.modularform_testtype import *89sage: from psage.modform.fourier_expansion_framework.monoidpowerseries.monoidpowerseries_basicmonoids import *90sage: ma = ModularFormsModule_withheckeaction( QQ, ModularFormTestType_vectorvalued(), NNFilter(5) )91sage: sm = ma.graded_submodule(3)92sage: ma._hecke_action(2, sm.0)93Equivariant monoid power series in Module of equivariant monoid power series over NN94sage: ma._hecke_action(7, sm.0)95(1)96sage: ma._hecke_action(2, 2)97Traceback (most recent call last):98...99TypeError: Form must be a Fourier expansion or wrap one.100"""101T = self._hecke_operator_class(n)102103if isinstance(form, FourierExpansionWrapper) :104expansion = form.fourier_expansion()105try :106weight = form.weight()107except AttributeError :108weight = None109elif isinstance(form, (MonoidPowerSeries_abstract, EquivariantMonoidPowerSeries_abstract)) :110expansion = form111weight = None112else :113raise TypeError( "Form must be a Fourier expansion or wrap one." )114115hecke_expansion = T.eval(expansion, weight)116117if isinstance(form, FourierExpansionWrapper) :118try :119return form.parent()(hecke_expansion)120except (ValueError, ArithmeticError) :121pass122123return hecke_expansion124125126