# HG changeset patch
# User Preston Wake <preston.wake@gmail.com>
# Date 1250471218 14400
# Node ID 0fce5ebf9305c04d7c997245e2608ed25c761f0d
# Parent 2e793d2a0e123293b73eed40715e43185fd9ccfe
Added code for bases of Hecke Algebras
diff -r 2e793d2a0e12 -r 0fce5ebf9305 sage/modular/hecke/algebra.py
a
|
b
|
|
31 | 31 | import math |
32 | 32 | import weakref |
33 | 33 | |
| 34 | import sage.rings.all as rings |
34 | 35 | import sage.rings.arith as arith |
35 | 36 | import sage.rings.infinity |
36 | 37 | import sage.misc.latex as latex |
… |
… |
|
40 | 41 | import sage.rings.commutative_algebra |
41 | 42 | from sage.misc.misc import verbose |
42 | 43 | from sage.matrix.constructor import matrix |
| 44 | from sage.rings.arith import lcm |
| 45 | from sage.matrix.matrix_space import MatrixSpace |
43 | 46 | |
44 | 47 | def is_HeckeAlgebra(x): |
45 | 48 | r""" |
… |
… |
|
142 | 145 | return T |
143 | 146 | |
144 | 147 | |
| 148 | def _heckebasis(M): |
| 149 | r""" |
| 150 | Gives a basis of the hecke algebra of M as a ZZ-module |
| 151 | |
| 152 | INPUT: |
| 153 | |
| 154 | - ``M`` - a hecke module |
| 155 | |
| 156 | OUTPUT: |
| 157 | |
| 158 | - a list of hecke algebra elements represented as matrices |
| 159 | |
| 160 | EXAMPLES:: |
| 161 | |
| 162 | sage: M = ModularSymbols(11,2,1) |
| 163 | sage: sage.modular.hecke.algebra._heckebasis(M) |
| 164 | [Hecke operator on Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field defined by: |
| 165 | [1 0] |
| 166 | [0 1], |
| 167 | Hecke operator on Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field defined by: |
| 168 | [0 1] |
| 169 | [0 5]] |
| 170 | """ |
| 171 | QQ = rings.QQ |
| 172 | ZZ = rings.ZZ |
| 173 | d = M.rank() |
| 174 | VV = QQ**(d**2) |
| 175 | WW = ZZ**(d**2) |
| 176 | MM = MatrixSpace(QQ,d) |
| 177 | MMZ = MatrixSpace(ZZ,d) |
| 178 | S = []; Denom = []; B = []; B1 = [] |
| 179 | for i in xrange(1, M.hecke_bound() + 1): |
| 180 | v = M.hecke_operator(i).matrix() |
| 181 | den = v.denominator() |
| 182 | Denom.append(den) |
| 183 | S.append(v) |
| 184 | den = lcm(Denom) |
| 185 | for m in S: |
| 186 | B.append(WW((den*m).list())) |
| 187 | UU = WW.submodule(B) |
| 188 | B = UU.basis() |
| 189 | for u in B: |
| 190 | u1 = u.list() |
| 191 | m1 = M.hecke_algebra()(MM(u1), check=False) |
| 192 | #m1 = MM(u1) |
| 193 | B1.append((1/den)*m1) |
| 194 | return B1 |
| 195 | |
| 196 | |
145 | 197 | class HeckeAlgebra_base(sage.rings.commutative_algebra.CommutativeAlgebra): |
146 | 198 | """ |
147 | 199 | Base class for algebras of Hecke operators on a fixed Hecke module. |
… |
… |
|
404 | 456 | def basis(self): |
405 | 457 | r""" |
406 | 458 | Return a basis for this Hecke algebra as a free module over |
407 | | its base ring. Not implemented at present. |
| 459 | its base ring. |
408 | 460 | |
409 | 461 | EXAMPLE:: |
410 | 462 | |
411 | 463 | sage: ModularSymbols(Gamma1(3), 3).hecke_algebra().basis() |
412 | | Traceback (most recent call last): |
413 | | ... |
414 | | NotImplementedError |
| 464 | [Hecke operator on Modular Symbols space of dimension 2 for Gamma_1(3) of weight 3 with sign 0 and over Rational Field defined by: |
| 465 | [1 0] |
| 466 | [0 1], |
| 467 | Hecke operator on Modular Symbols space of dimension 2 for Gamma_1(3) of weight 3 with sign 0 and over Rational Field defined by: |
| 468 | [0 0] |
| 469 | [0 2]] |
415 | 470 | """ |
416 | | raise NotImplementedError |
| 471 | try: |
| 472 | return self.__basis_cache |
| 473 | except AttributeError: |
| 474 | self.__basis_cache=_heckebasis(self.__M) |
| 475 | return self.__basis_cache |
417 | 476 | |
418 | 477 | def discriminant(self): |
419 | 478 | r""" |