# Sparse action of Hecke operators#

class sage.modular.modsym.hecke_operator.HeckeOperator(parent, n)[source]#

Bases: HeckeOperator

apply_sparse(x)[source]#

Return the image of x under self.

If x is not in self.domain(), raise a TypeError.

EXAMPLES:

sage: M = ModularSymbols(17,4,-1)
sage: T = M.hecke_operator(4)
sage: T.apply_sparse(M.0)
-27*[X^2,(1,7)] - 167/2*[X^2,(1,9)] - 21/2*[X^2,(1,13)] + 53/2*[X^2,(1,15)]
sage: [T.apply_sparse(x) == T.hecke_module_morphism()(x) for x in M.basis()]
[True, True, True, True]
sage: N = ModularSymbols(17,4,1)
sage: T.apply_sparse(N.0)
Traceback (most recent call last):
...
TypeError: x (=[X^2,(0,1)]) must be in Modular Symbols space
of dimension 4 for Gamma_0(17) of weight 4 with sign -1
over Rational Field

>>> from sage.all import *
>>> M = ModularSymbols(Integer(17),Integer(4),-Integer(1))
>>> T = M.hecke_operator(Integer(4))
>>> T.apply_sparse(M.gen(0))
-27*[X^2,(1,7)] - 167/2*[X^2,(1,9)] - 21/2*[X^2,(1,13)] + 53/2*[X^2,(1,15)]
>>> [T.apply_sparse(x) == T.hecke_module_morphism()(x) for x in M.basis()]
[True, True, True, True]
>>> N = ModularSymbols(Integer(17),Integer(4),Integer(1))
>>> T.apply_sparse(N.gen(0))
Traceback (most recent call last):
...
TypeError: x (=[X^2,(0,1)]) must be in Modular Symbols space
of dimension 4 for Gamma_0(17) of weight 4 with sign -1
over Rational Field