Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

""" 

Sparse action of Hecke operators 

""" 

from __future__ import absolute_import 

 

########################################################################## 

# 

# Copyright (C) 2008 William Stein <wstein@gmail.com> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# 

# http://www.gnu.org/licenses/ 

# 

########################################################################## 

 

import sage.modular.hecke.hecke_operator 

from sage.arith.all import is_prime 

from . import heilbronn 

 

 

class HeckeOperator(sage.modular.hecke.hecke_operator.HeckeOperator): 

def apply_sparse(self, x): 

""" 

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) 

64*[X^2,(1,8)] + 24*[X^2,(1,10)] - 9*[X^2,(1,13)] + 37*[X^2,(1,16)] 

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 

""" 

if x not in self.domain(): 

raise TypeError("x (={}) must be in {}".format(x, self.domain())) 

 

p = self.index() 

if is_prime(p): 

H = heilbronn.HeilbronnCremona(p) 

else: 

H = heilbronn.HeilbronnMerel(p) 

 

M = self.parent().module() 

mod2term = M._mod2term 

syms = M.manin_symbols() 

K = M.base_ring() 

R = M.manin_gens_to_basis() 

 

W = R.new_matrix(nrows=1, ncols=R.nrows()) 

 

B = M.manin_basis() 

 

v = x.element() 

for i in v.nonzero_positions(): 

for h in H: 

entries = syms.apply(B[i], h) 

for k, w in entries: 

f, s = mod2term[k] 

if s: 

W[0, f] += s * K(w) * v[i] 

 

return M(v.parent()((W * R).row(0)))