Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/modular/hecke/homspace.py
4096 views
1
r"""
2
Hom spaces between Hecke modules
3
"""
4
5
#*****************************************************************************
6
# Copyright (C) 2005 William Stein <[email protected]>
7
#
8
# Distributed under the terms of the GNU General Public License (GPL)
9
#
10
# This code is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty
12
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
#
14
# See the GNU General Public License for more details; the full text
15
# is available at:
16
#
17
# http://www.gnu.org/licenses/
18
#*****************************************************************************
19
20
import sage.categories.homset
21
import morphism
22
import module
23
24
def is_HeckeModuleHomspace(x):
25
r"""
26
Return True if x is a space of homomorphisms in the category of Hecke modules.
27
28
EXAMPLES::
29
30
sage: M = ModularForms(Gamma0(7), 4)
31
sage: sage.modular.hecke.homspace.is_HeckeModuleHomspace(Hom(M, M))
32
True
33
sage: sage.modular.hecke.homspace.is_HeckeModuleHomspace(Hom(M, QQ))
34
False
35
"""
36
return isinstance(x, HeckeModuleHomspace)
37
38
class HeckeModuleHomspace(sage.categories.homset.HomsetWithBase):
39
r"""
40
A space of homomorphisms between two objects in the category of Hecke
41
modules over a given base ring.
42
"""
43
def __init__(self, X, Y, category = None):
44
r"""
45
Create the space of homomorphisms between X and Y, which must have the
46
same base ring.
47
48
EXAMPLE::
49
50
sage: M = ModularForms(Gamma0(7), 4)
51
sage: M.Hom(M)
52
Set of Morphisms from ... to ... in Category of Hecke modules over Rational Field
53
sage: sage.modular.hecke.homspace.HeckeModuleHomspace(M, M.base_extend(Qp(13)))
54
Traceback (most recent call last):
55
...
56
TypeError: X and Y must have the same base ring
57
sage: M.Hom(M) == loads(dumps(M.Hom(M)))
58
True
59
"""
60
if not module.is_HeckeModule(X) or not module.is_HeckeModule(Y):
61
raise TypeError, "X and Y must be Hecke modules"
62
if X.base_ring() != Y.base_ring():
63
raise TypeError, "X and Y must have the same base ring"
64
if category is None:
65
category = X.category()
66
sage.categories.homset.HomsetWithBase.__init__(self, X, Y, category = category)
67
68
def __call__(self, A, name=''):
69
r"""
70
Create an element of this space from A, which should be an element of a
71
Hecke algebra, a Hecke module morphism, or a matrix.
72
73
EXAMPLES::
74
75
sage: M = ModularForms(Gamma0(7), 4)
76
sage: H = M.Hom(M)
77
sage: H(M.hecke_operator(7))
78
Hecke module morphism T_7 defined by the matrix
79
[ -7 0 0]
80
[ 0 1 240]
81
[ 0 0 343]
82
Domain: Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(7) ...
83
Codomain: Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(7) ...
84
sage: H(H(M.hecke_operator(7)))
85
Hecke module morphism T_7 defined by the matrix
86
[ -7 0 0]
87
[ 0 1 240]
88
[ 0 0 343]
89
Domain: Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(7) ...
90
Codomain: Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(7) ...
91
sage: H(matrix(QQ, 3, srange(9)))
92
Hecke module morphism defined by the matrix
93
[0 1 2]
94
[3 4 5]
95
[6 7 8]
96
Domain: Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(7) ...
97
Codomain: Modular Forms space of dimension 3 for Congruence Subgroup Gamma0(7) ...
98
"""
99
try:
100
if A.parent() == self:
101
A._set_parent(self)
102
return A
103
A = A.hecke_module_morphism()
104
if A.parent() == self:
105
A._set_parent(self)
106
return A
107
else:
108
raise TypeError, "unable to coerce A to self"
109
except AttributeError:
110
pass
111
return morphism.HeckeModuleMorphism_matrix(self, A, name)
112
113
114
115