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

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

r""" 

Elements of a semimonomial transformation group. 

  

The semimonomial transformation group of degree `n` over a ring `R` is 

the semidirect product of the monomial transformation group of degree `n` 

(also known as the complete monomial group over the group of units  

`R^{\times}` of `R`) and the group of ring automorphisms. 

  

The multiplication of two elements `(\phi, \pi, \alpha)(\psi, \sigma, \beta)` 

with 

  

- `\phi, \psi \in {R^{\times}}^n` 

  

- `\pi, \sigma \in S_n` (with the multiplication `\pi\sigma` 

done from left to right (like in GAP) --  

that is, `(\pi\sigma)(i) = \sigma(\pi(i))` for all `i`.) 

  

- `\alpha, \beta \in Aut(R)` 

  

is defined by 

  

.. MATH:: 

  

(\phi, \pi, \alpha)(\psi, \sigma, \beta) = 

(\phi \cdot \psi^{\pi, \alpha}, \pi\sigma, \alpha \circ \beta) 

  

with 

`\psi^{\pi, \alpha} = (\alpha(\psi_{\pi(1)-1}), \ldots, \alpha(\psi_{\pi(n)-1}))` 

and an elementwisely defined multiplication of vectors. (The indexing 

of vectors is `0`-based here, so `\psi = (\psi_0, \psi_1, \ldots, \psi_{n-1})`.) 

  

  

  

The parent is 

:class:`~sage.groups.semimonomial_transformations.semimonomial_transformation_group.SemimonomialTransformationGroup`. 

  

AUTHORS: 

  

- Thomas Feulner (2012-11-15): initial version 

- Thomas Feulner (2013-12-27): :trac:`15576` dissolve dependency on  

Permutations.options.mul 

  

EXAMPLES:: 

  

sage: S = SemimonomialTransformationGroup(GF(4, 'a'), 4) 

sage: G = S.gens() 

sage: G[0]*G[1] 

((a, 1, 1, 1); (1,2,3,4), Ring endomorphism of Finite Field in a of size 2^2 

Defn: a |--> a) 

  

TESTS:: 

  

sage: TestSuite(G[0]).run() 

""" 

from cpython.object cimport PyObject_RichCompare 

  

  

def _is_id(f, R): 

""" 

Test some automorphism `f` of a ring `R` if it is the identity 

automorphism. 

  

EXAMPLES:: 

  

sage: from sage.groups.semimonomial_transformations.semimonomial_transformation import _is_id 

sage: F.<a> = GF(8) 

sage: f = F.hom([a**2]) 

sage: _is_id(f, F) 

False 

""" 

for r in R.gens(): 

if r != f(r): 

return False 

return True 

  

  

def _inverse(f, R): 

""" 

Returns the inverse to the automorphism `f` of a ring `R`. 

  

EXAMPLES:: 

  

sage: from sage.groups.semimonomial_transformations.semimonomial_transformation import _inverse 

sage: F.<a> = GF(8) 

sage: f = F.hom([a**2]) 

sage: _inverse(f, F)*f == F.hom([a]) 

True 

""" 

g = f 

while not _is_id(g*f, R): 

g *= f 

return g 

  

cdef class SemimonomialTransformation(MultiplicativeGroupElement): 

r""" 

An element in the semimonomial group over a ring `R`. See 

:class:`~sage.groups.semimonomial_transformations.semimonomial_transformation_group.SemimonomialTransformationGroup` 

for the details on the multiplication of two elements. 

  

The init method should never be called directly. Use the call via the 

parent 

:class:`~sage.groups.semimonomial_transformations.semimonomial_transformation_group.SemimonomialTransformationGroup`. 

instead. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: S = SemimonomialTransformationGroup(F, 4) 

sage: g = S(v = [2, a, 1, 2]) 

sage: h = S(perm = Permutation('(1,2,3,4)'), autom=F.hom([a**3])) 

sage: g*h 

((2, a, 1, 2); (1,2,3,4), Ring endomorphism of Finite Field in a of size 3^2 Defn: a |--> 2*a + 1) 

sage: h*g 

((2*a + 1, 1, 2, 2); (1,2,3,4), Ring endomorphism of Finite Field in a of size 3^2 Defn: a |--> 2*a + 1) 

sage: S(g) 

((2, a, 1, 2); (), Ring endomorphism of Finite Field in a of size 3^2 Defn: a |--> a) 

sage: S(1) # the one element in the group 

((1, 1, 1, 1); (), Ring endomorphism of Finite Field in a of size 3^2 Defn: a |--> a) 

""" 

def __init__(self, parent, v, perm, alpha): 

r""" 

The init method should never be called directly. Use the call via the 

parent instead. See 

:meth:`sage.groups.semimonomial_transformations.semimonomial_transformation.SemimonomialTransformation.__call__`. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: S = SemimonomialTransformationGroup(F, 4) 

sage: g = S(v = [2, a, 1, 2]) #indirect doctest 

""" 

MultiplicativeGroupElement.__init__(self, parent) 

self.v = tuple(v) 

self.perm = perm 

self.alpha = alpha 

  

cdef _new_c(self): 

# Create a copy of self. 

cdef SemimonomialTransformation x 

x = SemimonomialTransformation.__new__(SemimonomialTransformation) 

x._parent = self._parent 

x.v = self.v 

x.perm = self.perm 

x.alpha = self.alpha 

return x 

  

def __copy__(self): 

""" 

Return a copy of ``self``. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: s = SemimonomialTransformationGroup(F, 4).an_element() 

sage: t = copy(s) #indirect doctest 

sage: t is s 

False 

sage: t == s 

True 

""" 

return self._new_c() 

  

def __hash__(self): 

""" 

Return hash of this element. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: hash( SemimonomialTransformationGroup(F, 4).an_element() ) #random #indirect doctest 

6279637968393375107 

""" 

return hash(self.v) + hash(self.perm) + hash(self.get_autom()) 

  

cpdef _mul_(left, _right): 

r""" 

Multiplication of elements. 

 

The multiplication of two elements `(\phi, \pi, \alpha)` and  

`(\psi, \sigma, \beta)` with 

 

- `\phi, \psi \in {R^{\times}}^n` 

 

- `\pi, \sigma \in S_n` 

 

- `\alpha, \beta \in Aut(R)` 

 

is defined by: 

 

.. MATH:: 

  

(\phi, \pi, \alpha)(\psi, \sigma, \beta) = 

(\phi \cdot \psi^{\pi, \alpha}, \pi\sigma, \alpha \circ \beta) 

  

with 

`\psi^{\pi, \alpha} = (\alpha(\psi_{\pi(1)-1}), \ldots, \alpha(\psi_{\pi(n)-1}))` 

and an elementwisely defined multiplication of vectors. (The indexing 

of vectors is `0`-based here, so `\psi = (\psi_0, \psi_1, \ldots, \psi_{n-1})`.) 

Furthermore, the multiplication `\pi\sigma` is done from left to right 

(like in GAP) -- that is, `(\pi\sigma)(i) = \sigma(\pi(i))` for all `i`. 

 

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: s = SemimonomialTransformationGroup(F, 4).an_element() 

sage: s*s #indirect doctest 

((a, 2*a + 1, 1, 1); (1,3)(2,4), Ring endomorphism of Finite Field in a of size 3^2 Defn: a |--> a) 

""" 

cdef SemimonomialTransformation right = <SemimonomialTransformation> _right 

cdef i 

v = left.perm.action(right.v) 

alpha = left.get_autom() 

v = [left.v[i]*alpha(v[i]) for i in range(left.parent().degree())] 

return left.parent()(v=v, perm=left.perm.right_action_product(right.perm), 

autom=alpha*right.get_autom(), check=False) 

  

def __invert__(self): 

""" 

Return the inverse of ``self``. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: S = SemimonomialTransformationGroup(F, 4) 

sage: s = S.an_element() 

sage: s*s**(-1) == S(1) # indirect doctest 

True 

""" 

cdef i 

alpha = _inverse(self.get_autom(), self.get_autom().domain()) 

inv_perm = self.perm.inverse() 

v = [alpha(self.v[i]**(-1)) for i in range(len(self.v))] 

return self.parent()(v=inv_perm.action(v), perm=inv_perm, autom=alpha, 

check=False) 

  

def __repr__(self): 

""" 

String representation of `self`. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: SemimonomialTransformationGroup(F, 4).an_element() # indirect doctest 

((a, 1, 1, 1); (1,4,3,2), Ring endomorphism of Finite Field in a of size 3^2 Defn: a |--> 2*a + 1) 

""" 

return "(%s; %s, %s)"%(self.v, self.perm.cycle_string(), 

self.get_autom()) 

  

cpdef _richcmp_(left, _right, int op): 

""" 

Compare group elements ``self`` and ``right``. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: g = SemimonomialTransformationGroup(F, 4).gens() 

sage: g[0] > g[1] # indirect doctest 

True 

sage: g[1] != g[2] # indirect doctest 

True 

""" 

cdef SemimonomialTransformation right = <SemimonomialTransformation> _right 

return PyObject_RichCompare([left.v, left.perm, left.get_autom()], 

[right.v, right.perm, right.get_autom()], 

op) 

  

def __reduce__(self): 

""" 

Returns a function and its arguments needed to create this 

semimonomial group element. This is used in pickling. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: SemimonomialTransformationGroup(F, 4).an_element().__reduce__() 

(Semimonomial transformation group over Finite Field in a of size 3^2 of degree 4, (0, (a, 1, 1, 1), [4, 1, 2, 3], Ring endomorphism of Finite Field in a of size 3^2 

Defn: a |--> 2*a + 1)) 

""" 

return (self.parent(), (0, self.v, self.perm, self.get_autom())) 

  

def get_v(self): 

""" 

Returns the component corresponding to `{R^{\times}}^n` of ``self``. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: SemimonomialTransformationGroup(F, 4).an_element().get_v() 

(a, 1, 1, 1) 

""" 

return self.v 

  

def get_v_inverse(self): 

""" 

Returns the (elementwise) inverse of the component corresponding to 

`{R^{\times}}^n` of ``self``. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: SemimonomialTransformationGroup(F, 4).an_element().get_v_inverse() 

(a + 2, 1, 1, 1) 

""" 

return tuple(x**(-1) for x in self.v) 

  

def get_perm(self): 

""" 

Returns the component corresponding to `S_n` of ``self``. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: SemimonomialTransformationGroup(F, 4).an_element().get_perm() 

[4, 1, 2, 3] 

""" 

return self.perm 

  

def get_autom(self): 

""" 

Returns the component corresponding to `Aut(R)` of ``self``. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: SemimonomialTransformationGroup(F, 4).an_element().get_autom() 

Ring endomorphism of Finite Field in a of size 3^2 Defn: a |--> 2*a + 1 

""" 

return self.alpha 

  

def invert_v(self): 

""" 

Elementwisely inverts all entries of ``self`` which 

correspond to the component `{R^{\times}}^n`. 

  

The other components of ``self`` keep unchanged. 

  

EXAMPLES:: 

  

sage: F.<a> = GF(9) 

sage: x = copy(SemimonomialTransformationGroup(F, 4).an_element()) 

sage: x.invert_v(); 

sage: x.get_v() == SemimonomialTransformationGroup(F, 4).an_element().get_v_inverse() 

True 

""" 

self.v = tuple([x**(-1) for x in self.v])