Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

r""" 

Unitary Groups `GU(n,q)` and `SU(n,q)` 

 

These are `n \times n` unitary matrices with entries in 

`GF(q^2)`. 

 

EXAMPLES:: 

 

sage: G = SU(3,5) 

sage: G.order() 

378000 

sage: G 

Special Unitary Group of degree 3 over Finite Field in a of size 5^2 

sage: G.gens() 

( 

[ a 0 0] [4*a 4 1] 

[ 0 2*a + 2 0] [ 4 4 0] 

[ 0 0 3*a], [ 1 0 0] 

) 

sage: G.base_ring() 

Finite Field in a of size 5^2 

 

AUTHORS: 

 

- David Joyner (2006-03): initial version, modified from 

special_linear (by W. Stein) 

 

- David Joyner (2006-05): minor additions (examples, _latex_, __str__, 

gens) 

 

- William Stein (2006-12): rewrite 

 

- Volker Braun (2013-1) port to new Parent, libGAP, extreme refactoring. 

""" 

 

#********************************************************************************* 

# Copyright (C) 2006 David Joyner and William Stein 

# Copyright (C) 2013 Volker Braun <vbraun.name@gmail.com> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# http://www.gnu.org/licenses/ 

#********************************************************************************* 

 

from sage.rings.all import ZZ, GF 

from sage.rings.finite_rings.finite_field_base import is_FiniteField 

from sage.misc.latex import latex 

from sage.groups.matrix_gps.named_group import ( 

normalize_args_vectorspace, NamedMatrixGroup_generic, NamedMatrixGroup_gap ) 

 

 

def finite_field_sqrt(ring): 

""" 

Helper function. 

 

INPUT: 

 

A ring. 

 

OUTPUT: 

 

Integer q such that ``ring`` is the finite field with `q^2` elements. 

 

EXAMPLES:: 

 

sage: from sage.groups.matrix_gps.unitary import finite_field_sqrt 

sage: finite_field_sqrt(GF(4, 'a')) 

2 

""" 

if not is_FiniteField(ring): 

raise ValueError('not a finite field') 

q, rem = ring.cardinality().sqrtrem() 

if rem: 

raise ValueError('cardinality not a square') 

return q 

 

 

############################################################################### 

# General Unitary Group 

############################################################################### 

 

def GU(n, R, var='a'): 

r""" 

Return the general unitary group. 

 

The general unitary group `GU( d, R )` consists of all `d \times 

d` matrices that preserve a nondegenerate sesquilinear form over 

the ring `R`. 

 

.. note:: 

 

For a finite field the matrices that preserve a sesquilinear 

form over `F_q` live over `F_{q^2}`. So ``GU(n,q)`` for 

integer ``q`` constructs the matrix group over the base ring 

``GF(q^2)``. 

 

.. note:: 

 

This group is also available via ``groups.matrix.GU()``. 

 

INPUT: 

 

- ``n`` -- a positive integer. 

 

- ``R`` -- ring or an integer. If an integer is specified, the 

corresponding finite field is used. 

 

- ``var`` -- variable used to represent generator of the finite 

field, if needed. 

 

OUTPUT: 

 

Return the general unitary group. 

 

EXAMPLES:: 

 

sage: G = GU(3, 7); G 

General Unitary Group of degree 3 over Finite Field in a of size 7^2 

sage: G.gens() 

( 

[ a 0 0] [6*a 6 1] 

[ 0 1 0] [ 6 6 0] 

[ 0 0 5*a], [ 1 0 0] 

) 

sage: GU(2,QQ) 

General Unitary Group of degree 2 over Rational Field 

 

sage: G = GU(3, 5, var='beta') 

sage: G.base_ring() 

Finite Field in beta of size 5^2 

sage: G.gens() 

( 

[ beta 0 0] [4*beta 4 1] 

[ 0 1 0] [ 4 4 0] 

[ 0 0 3*beta], [ 1 0 0] 

) 

 

TESTS:: 

 

sage: groups.matrix.GU(2, 3) 

General Unitary Group of degree 2 over Finite Field in a of size 3^2 

""" 

degree, ring = normalize_args_vectorspace(n, R, var=var) 

if is_FiniteField(ring): 

q = ring.cardinality() 

ring = GF(q ** 2, name=var) 

name = 'General Unitary Group of degree {0} over {1}'.format(degree, ring) 

ltx = r'\text{{GU}}_{{{0}}}({1})'.format(degree, latex(ring)) 

if is_FiniteField(ring): 

cmd = 'GU({0}, {1})'.format(degree, q) 

return UnitaryMatrixGroup_gap(degree, ring, False, name, ltx, cmd) 

else: 

return UnitaryMatrixGroup_generic(degree, ring, False, name, ltx) 

 

 

 

############################################################################### 

# Special Unitary Group 

############################################################################### 

 

def SU(n, R, var='a'): 

""" 

The special unitary group `SU( d, R )` consists of all `d \times d` 

matrices that preserve a nondegenerate sesquilinear form over the 

ring `R` and have determinant one. 

 

.. note:: 

 

For a finite field the matrices that preserve a sesquilinear 

form over `F_q` live over `F_{q^2}`. So ``SU(n,q)`` for 

integer ``q`` constructs the matrix group over the base ring 

``GF(q^2)``. 

 

.. note:: 

 

This group is also available via ``groups.matrix.SU()``. 

 

INPUT: 

 

- ``n`` -- a positive integer. 

 

- ``R`` -- ring or an integer. If an integer is specified, the 

corresponding finite field is used. 

 

- ``var`` -- variable used to represent generator of the finite 

field, if needed. 

 

OUTPUT: 

 

Return the special unitary group. 

 

EXAMPLES:: 

 

sage: SU(3,5) 

Special Unitary Group of degree 3 over Finite Field in a of size 5^2 

sage: SU(3, GF(5)) 

Special Unitary Group of degree 3 over Finite Field in a of size 5^2 

sage: SU(3,QQ) 

Special Unitary Group of degree 3 over Rational Field 

 

TESTS:: 

 

sage: groups.matrix.SU(2, 3) 

Special Unitary Group of degree 2 over Finite Field in a of size 3^2 

""" 

degree, ring = normalize_args_vectorspace(n, R, var=var) 

if is_FiniteField(ring): 

q = ring.cardinality() 

ring = GF(q ** 2, name=var) 

name = 'Special Unitary Group of degree {0} over {1}'.format(degree, ring) 

ltx = r'\text{{SU}}_{{{0}}}({1})'.format(degree, latex(ring)) 

if is_FiniteField(ring): 

cmd = 'SU({0}, {1})'.format(degree, q) 

return UnitaryMatrixGroup_gap(degree, ring, True, name, ltx, cmd) 

else: 

return UnitaryMatrixGroup_generic(degree, ring, True, name, ltx) 

 

 

######################################################################## 

# Unitary Group class 

######################################################################## 

 

class UnitaryMatrixGroup_generic(NamedMatrixGroup_generic): 

r""" 

General Unitary Group over arbitrary rings. 

 

EXAMPLES:: 

 

sage: G = GU(3, GF(7)); G 

General Unitary Group of degree 3 over Finite Field in a of size 7^2 

sage: latex(G) 

\text{GU}_{3}(\Bold{F}_{7^{2}}) 

 

sage: G = SU(3, GF(5)); G 

Special Unitary Group of degree 3 over Finite Field in a of size 5^2 

sage: latex(G) 

\text{SU}_{3}(\Bold{F}_{5^{2}}) 

""" 

 

def _check_matrix(self, x, *args): 

"""a 

Check whether the matrix ``x`` is unitary. 

 

See :meth:`~sage.groups.matrix_gps.matrix_group._check_matrix` 

for details. 

 

EXAMPLES:: 

 

sage: G = GU(2, GF(5)) 

sage: G._check_matrix(G.an_element().matrix()) 

sage: G = SU(2, GF(5)) 

sage: G._check_matrix(G.an_element().matrix()) 

""" 

if self._special and x.determinant() != 1: 

raise TypeError('matrix must have determinant one') 

if not x.is_unitary(): 

raise TypeError('matrix must be unitary') 

 

 

class UnitaryMatrixGroup_gap(UnitaryMatrixGroup_generic, NamedMatrixGroup_gap): 

pass