Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/modular/modsym/ghlist.py
4057 views
1
r"""
2
List of coset representatives for `\Gamma_H(N)` in `{\rm SL}_2(\ZZ)`
3
"""
4
5
###########################################################################
6
# Sage: System for Algebra and Geometry Experimentation
7
#
8
# Copyright (C) 2005 William Stein <[email protected]>
9
#
10
# Distributed under the terms of the GNU General Public License (GPL)
11
#
12
# This code is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# General Public License for more details.
16
#
17
# The full text of the GPL is available at:
18
#
19
# http://www.gnu.org/licenses/
20
###########################################################################
21
22
23
import p1list
24
25
class GHlist:
26
r"""
27
A class representing a list of coset representatives for `\Gamma_H(N)` in
28
`{\rm SL}_2(\ZZ)`.
29
30
TESTS::
31
32
sage: L = sage.modular.modsym.ghlist.GHlist(GammaH(18,[13]))
33
sage: loads(dumps(L)) == L
34
True
35
"""
36
37
def __init__(self, group):
38
"""
39
EXAMPLE::
40
41
sage: L = sage.modular.modsym.ghlist.GHlist(GammaH(8,[7])); L # indirect doctest
42
List of coset representatives for Congruence Subgroup Gamma_H(8) with H generated by [7]
43
"""
44
self.__group = group
45
N = group.level()
46
v = group._coset_reduction_data()[0]
47
N = group.level()
48
coset_reps = set([a for a, b, _ in v if b == 1])
49
w = [group._reduce_coset(x*u, x*v) for x in coset_reps for u,v in p1list.P1List(N).list()]
50
w = list(set(w))
51
w.sort()
52
self.__list = w
53
54
def __getitem__(self, i):
55
"""
56
EXAMPLE::
57
58
sage: L = sage.modular.modsym.ghlist.GHlist(GammaH(8, [5])); L[5] # indirect doctest
59
(1, 3)
60
"""
61
return self.__list[i]
62
63
def __cmp__(self, other):
64
r"""
65
Compare self to other.
66
67
EXAMPLE::
68
69
sage: L1 = sage.modular.modsym.ghlist.GHlist(GammaH(18, [11]))
70
sage: L2 = sage.modular.modsym.ghlist.GHlist(GammaH(18, [13]))
71
sage: L1 < L2
72
True
73
sage: L1 == QQ
74
False
75
"""
76
if not isinstance(other, GHlist):
77
return cmp(type(self), type(other))
78
else:
79
return cmp(self.__group, other.__group)
80
81
def __len__(self):
82
"""
83
Return the length of the underlying list (the index of the group).
84
85
EXAMPLE::
86
87
sage: L = sage.modular.modsym.ghlist.GHlist(GammaH(24, [5])); len(L) # indirect doctest
88
192
89
"""
90
return len(self.__list)
91
92
def __repr__(self):
93
"""
94
String representation of self.
95
96
EXAMPLE::
97
98
sage: L = sage.modular.modsym.ghlist.GHlist(GammaH(11,[4])); L.__repr__()
99
'List of coset representatives for Congruence Subgroup Gamma_H(11) with H generated by [4]'
100
"""
101
return "List of coset representatives for %s"%self.__group
102
103
def list(self):
104
r"""
105
Return a list of vectors representing the cosets. Do not change the
106
returned list!
107
108
EXAMPLE::
109
110
sage: L = sage.modular.modsym.ghlist.GHlist(GammaH(4,[])); L.list()
111
[(0, 1), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 1), (2, 3), (3, 0), (3, 1), (3, 2), (3, 3)]
112
"""
113
return self.__list
114
115
def normalize(self, u, v):
116
r"""
117
Given a pair `(u,v)` of integers, return the unique pair `(u', v')`
118
such that the pair `(u', v')` appears in ``self.list()`` and `(u, v)`
119
is equivalent to `(u', v')`.
120
121
This will only make sense if `{\rm gcd}(u, v, N) = 1`; otherwise the
122
output will not be an element of self.
123
124
EXAMPLES::
125
126
sage: sage.modular.modsym.ghlist.GHlist(GammaH(24, [17, 19])).normalize(17, 6)
127
(1, 6)
128
sage: sage.modular.modsym.ghlist.GHlist(GammaH(24, [7, 13])).normalize(17, 6)
129
(5, 6)
130
sage: sage.modular.modsym.ghlist.GHlist(GammaH(24, [5, 23])).normalize(17, 6)
131
(7, 18)
132
"""
133
return self.__group._reduce_coset(u,v)
134
135
136
137
138
139
140
141