Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/groups/matrix_gps/unitary.py
4069 views
1
r"""
2
Unitary Groups `GU(n,q)` and `SU(n,q)`
3
4
These are `n \times n` unitary matrices with entries in
5
`GF(q^2)`.
6
7
AUTHORS:
8
9
- David Joyner (2006-03): initial version, modified from
10
special_linear (by W. Stein)
11
12
- David Joyner (2006-05): minor additions (examples, _latex_, __str__,
13
gens)
14
15
- William Stein (2006-12): rewrite
16
17
EXAMPLES::
18
19
sage: G = SU(3,GF(5))
20
sage: G.order()
21
378000
22
sage: G
23
Special Unitary Group of degree 3 over Finite Field of size 5
24
sage: G._gap_init_()
25
'SU(3, 5)'
26
sage: G.random_element()
27
[ 1 4*a + 4 4*a + 1]
28
[2*a + 4 2*a + 1 0]
29
[ 4 3*a 4*a + 2]
30
sage: G.base_ring()
31
Finite Field of size 5
32
sage: G.field_of_definition()
33
Finite Field in a of size 5^2
34
"""
35
36
#*********************************************************************************
37
# Copyright (C) 2006 David Joyner and William Stein
38
#
39
# Distributed under the terms of the GNU General Public License (GPL)
40
# http://www.gnu.org/licenses/
41
#*********************************************************************************
42
43
from sage.rings.all import is_FiniteField, GF, Integer
44
from matrix_group import MatrixGroup_gap_finite_field
45
46
###############################################################################
47
# General Unitary Group
48
###############################################################################
49
50
def GU(n, F, var='a'):
51
"""
52
Return the general unitary group of degree n over the finite field
53
F.
54
55
INPUT:
56
57
58
- ``n`` - a positive integer
59
60
- ``F`` - finite field
61
62
- ``var`` - variable used to represent generator of
63
quadratic extension of F, if needed.
64
65
66
EXAMPLES::
67
68
sage: G = GU(3,GF(7)); G
69
General Unitary Group of degree 3 over Finite Field of size 7
70
sage: G.gens()
71
[
72
[ a 0 0]
73
[ 0 1 0]
74
[ 0 0 5*a],
75
[6*a 6 1]
76
[ 6 6 0]
77
[ 1 0 0]
78
]
79
sage: G = GU(2,QQ)
80
Traceback (most recent call last):
81
...
82
NotImplementedError: general unitary group only implemented over finite fields
83
84
::
85
86
sage: G = GU(3,GF(5), var='beta')
87
sage: G.gens()
88
[
89
[ beta 0 0]
90
[ 0 1 0]
91
[ 0 0 3*beta],
92
[4*beta 4 1]
93
[ 4 4 0]
94
[ 1 0 0]
95
]
96
"""
97
if isinstance(F, (int, long, Integer)):
98
F = GF(F,var)
99
if is_FiniteField(F):
100
return GeneralUnitaryGroup_finite_field(n, F, var)
101
else:
102
raise NotImplementedError, "general unitary group only implemented over finite fields"
103
104
class UnitaryGroup_finite_field(MatrixGroup_gap_finite_field):
105
def field_of_definition(self):
106
"""
107
Return the field of definition of this general unity group.
108
109
EXAMPLES::
110
111
sage: G = GU(3,GF(5))
112
sage: G.field_of_definition()
113
Finite Field in a of size 5^2
114
sage: G.base_field()
115
Finite Field of size 5
116
"""
117
try:
118
return self._field_of_definition
119
except AttributeError:
120
if self.base_ring().degree() % 2 == 0:
121
k = self.base_ring()
122
else:
123
k = GF(self.base_ring().order()**2, names=self._var)
124
self._field_of_definition = k
125
return k
126
127
class GeneralUnitaryGroup_finite_field(UnitaryGroup_finite_field):
128
def _gap_init_(self):
129
"""
130
Return string that evaluates to creates this group as an element of
131
GAP.
132
133
EXAMPLES::
134
135
sage: G = GU(3,GF(7)); G
136
General Unitary Group of degree 3 over Finite Field of size 7
137
sage: G._gap_init_()
138
'GU(3, 7)'
139
sage: gap(G._gap_init_())
140
GU(3,7)
141
"""
142
return "GU(%s, %s)"%(self.degree(), self.base_ring().order())
143
144
def _latex_(self):
145
r"""
146
Return LaTeX string representation of this group.
147
148
EXAMPLES::
149
150
sage: G = GU(3,GF(7)); G
151
General Unitary Group of degree 3 over Finite Field of size 7
152
sage: latex(G)
153
\text{GU}_{3}(\Bold{F}_{7^{2}})
154
"""
155
return "\\text{GU}_{%s}(%s)"%(self.degree(), self.field_of_definition()._latex_())
156
157
def _repr_(self):
158
"""
159
Return text representation of self.
160
161
EXAMPLES::
162
163
sage: G = GU(3,GF(5))
164
sage: G
165
General Unitary Group of degree 3 over Finite Field of size 5
166
"""
167
return "General Unitary Group of degree %s over %s"%(self.degree(), self.base_ring())
168
169
170
###############################################################################
171
# Special Unitary Group
172
###############################################################################
173
174
def SU(n, F, var='a'):
175
"""
176
Return the special unitary group of degree `n` over
177
`F`.
178
179
EXAMPLES::
180
181
sage: SU(3,5)
182
Special Unitary Group of degree 3 over Finite Field of size 5
183
sage: SU(3,QQ)
184
Traceback (most recent call last):
185
...
186
NotImplementedError: special unitary group only implemented over finite fields
187
"""
188
if isinstance(F, (int, long, Integer)):
189
F = GF(F,var)
190
if is_FiniteField(F):
191
return SpecialUnitaryGroup_finite_field(n, F, var=var)
192
else:
193
raise NotImplementedError, "special unitary group only implemented over finite fields"
194
195
class SpecialUnitaryGroup_finite_field(UnitaryGroup_finite_field):
196
197
def _gap_init_(self):
198
"""
199
Return string that creates this group in GAP.
200
201
EXAMPLES::
202
203
sage: SU(3,5)._gap_init_()
204
'SU(3, 5)'
205
"""
206
return "SU(%s, %s)"%(self.degree(), self.base_ring().order())
207
208
def _latex_(self):
209
"""
210
Return latex representation of this group.
211
212
EXAMPLES::
213
214
sage: G = SU(3,GF(5))
215
sage: latex(G)
216
\text{SU}_{3}(\Bold{F}_{5^{2}})
217
"""
218
return "\\text{SU}_{%s}(%s)"%(self.degree(), self.field_of_definition()._latex_())
219
220
221
def _repr_(self):
222
"""
223
Return text representation of this special unitary group.
224
225
EXAMPLES::
226
227
sage: G = SU(3,GF(5))
228
sage: G
229
Special Unitary Group of degree 3 over Finite Field of size 5
230
"""
231
return "Special Unitary Group of degree %s over %s"%(self.degree(), self.base_ring())
232
233
234
235
236
237
238