Opened 12 years ago

Closed 12 years ago

# Problem computing Hecke matrices on subspaces of modular forms spaces

Reported by: Owned by: davidloeffler craigcitro major sage-4.6.2 modular forms hecke operator sage-4.6.2.alpha3 David Loeffler Alex Ghitza N/A

Sage seems to have trouble computing Hecke matrices on subspaces of Gamma1 modular forms spaces, which is absurd, since it has no trouble computing Hecke matrices on the parent spaces:

```sage: S = CuspForms(Gamma1(22))
sage: S.new_submodule().hecke_matrix(5)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)

/home/masiao/<ipython console> in <module>()

/usr/local/sage/sage-4.6/local/lib/python2.6/site-packages/sage/modular/hecke/module.pyc in hecke_matrix(self, n)
1288             raise IndexError, "n must be positive."
1289         if not self._hecke_matrices.has_key(n):
-> 1290             T = self._compute_hecke_matrix(n)
1291             T.set_immutable()
1292             self._hecke_matrices[n] = T

/usr/local/sage/sage-4.6/local/lib/python2.6/site-packages/sage/modular/modform/space.pyc in _compute_hecke_matrix(self, n)
1311         """
1312         if hasattr(self, '_compute_q_expansion_basis'):
-> 1313             return hecke.HeckeModule_generic._compute_hecke_matrix(self, n)
1314         else:
1315             return hecke.HeckeSubmodule._compute_hecke_matrix(self, n)

/usr/local/sage/sage-4.6/local/lib/python2.6/site-packages/sage/modular/hecke/module.pyc in _compute_hecke_matrix(self, n, **kwds)
214
215         if arith.is_prime(n):
--> 216             return self._compute_hecke_matrix_prime(n, **kwds)
217
218         F = arith.factor(n)

/usr/local/sage/sage-4.6/local/lib/python2.6/site-packages/sage/modular/modform/space.pyc in _compute_hecke_matrix_prime(self, p, prec)
1281         eps = self.character()
1282         if eps is None:
-> 1283             raise NotImplementedError
1284         try:
1285             return hecke_operator_on_qexp.hecke_operator_on_basis(B, p,

NotImplementedError:
```

### comment:1 Changed 12 years ago by davidloeffler

Description: modified (diff)

### comment:2 Changed 12 years ago by davidloeffler

Authors: → David Loeffler new → needs_review

Here's a 1/1/1 fix: one line, one comment and one doctest.

### Changed 12 years ago by davidloeffler

patch against 4.6.1.alpha3

### comment:3 Changed 12 years ago by AlexGhitza

Status: needs_review → needs_info

This looks good with one exception: we (still) can't have the action of Tn with n not squarefree:

```sage: CuspForms(Gamma1(22), 2).new_submodule().hecke_matrix(9)
...
NotImplementedError: either character or _compute_hecke_matrix_prime_power must be overloaded in a derived class
```

Do you want to try to fix this here as well, or put this into a new ticket?

### Changed 12 years ago by davidloeffler

apply only this patch

### comment:4 Changed 12 years ago by davidloeffler

Status: needs_info → needs_review

Here's a new patch which should correct the prime power case as well. The new version does all of the factoring tricks etc at the level of the ambient space (or, where possible, its eisenstein or cuspidal submodule), and just restricts the answer to the given subspace at the end. Along the way, I've fixed a tiny bug in `eisenstein_submodule` and `cuspidal_submodule`, and added `is_eisenstein` and `is_cuspidal`, for generic mod forms spaces.

### comment:5 Changed 12 years ago by AlexGhitza

Great stuff, and good catch on the two missing return statements.

Of course, these would never have made it in if there were doctests to check those parts of the code. May I suggest adding some now? Here is an easy example:

```sage: M = ModularForms(6, 10)
sage: S = M.cuspidal_submodule()
sage: W = S.span_of_basis(S.basis()[0:2])
sage: W.cuspidal_submodule()
Modular Forms subspace of dimension 2 of Modular Forms space of dimension 11 for Congruence Subgroup Gamma0(6) of weight 10 over Rational Field
```

and something along the same lines for `eisenstein_submodule`.

### comment:7 Changed 12 years ago by AlexGhitza

Reviewers: → Alex Ghitza needs_review → positive_review

Looks good to me.

Thanks!

### comment:9 Changed 12 years ago by jdemeyer

Merged in: → sage-4.6.2.alpha3 → fixed positive_review → closed
Note: See TracTickets for help on using tickets.