1#############################################################################
2##
3##  affinegroup.gi              FinInG package
4##                                                              John Bamberg
5##                                                              Anton Betten
6##                                                              Jan De Beule
7##                                                             Philippe Cara
8##                                                            Michel Lavrauw
9##                                                           Max Neunhoeffer
10##
11##  Copyright 2018	Colorado State University
12##                  Sabancı Üniversitesi
13##					Università degli Studi di Padova
14##					Universiteit Gent
15##					University of St. Andrews
16##					University of Western Australia
17##                  Vrije Universiteit Brussel
18##
19##
20##  Implementation stuff for affine groups
21##
22#############################################################################
23
24# **** The way it works ****
25#
26# An affine transformation of the form x+A
27# can be written as a matrix...
28#   |     0|
29#   |  A  0|
30#   |     0|
31#   |  x  1|
32# where the matrix A occurs in all but the last row and column of the matrix,
33# x sits in all but the last element of the last row, and the rest is filled
34# with 0's and a 1 in the last spot. We can then just use ProjElWithFrob
35# wrapping in order to incoorporate the Frobenius map.
36
37# CHECKED 25/3/14 jdb
38#############################################################################
39#O  AffineGroup( <as> )
40# returns AGL(d,q)
41##
42InstallMethod( AffineGroup,
43	"for an affine space",
44	[ IsAffineSpace ],
45	function( as )
46
47  ## This operation returns the group commonly known as AGL(d,F)
48
49    local d, gf, vec, semi, gens, frob, newgens, agl, q;
50    d := as!.dimension;
51    gf := as!.basefield;
52    q := Size(gf);
53    vec := as!.vectorspace;
54    semi := SemidirectProduct(GL(d, gf), vec);
55    gens := GeneratorsOfGroup(semi);
56    frob := FrobeniusAutomorphism( gf );
57    newgens := List(gens, x -> [x, frob^0]);
58    newgens := ProjElsWithFrob(newgens);
59    agl := GroupWithGenerators(newgens);
60    SetName(agl, Concatenation("AGL(",String(d),",",String(q),")") );
61    SetSize(agl, q^d * Size(GL(d,q)));
62    return agl;
63  end );
64
65# CHECKED 27/3/2012 jdb
66#############################################################################
67#O  CollineationGroup( <as> )
68# returns AGammaL(d,q)
69##
70InstallMethod( CollineationGroup,
71	"for an affine space",
72	[ IsAffineSpace ],
73	function( as )
74
75    ## This operation returns the group commonly known as AGammaL(d,F)
76
77    local d, gf, vec, semi, gens, frob, newgens, coll, q;
78    d := as!.dimension;
79    gf := as!.basefield;
80    q := Size(gf);
81    vec := as!.vectorspace;
82    semi := SemidirectProduct(GL(d, gf), vec);
83    gens := GeneratorsOfGroup(semi);
84    frob := FrobeniusAutomorphism( gf );
85    newgens := List(gens, x -> [x, frob^0]);
86    Add(newgens, [One(semi), frob]);
87    newgens := ProjElsWithFrob(newgens);
88    coll := GroupWithGenerators(newgens);
89    if LogInt(q, Characteristic(gf)) > 1 then
90       SetName( coll, Concatenation("AGammaL(",String(d),",",String(q),")") );
91    else
92       SetName( coll, Concatenation("AGL(",String(d),",",String(q),")") );
93    fi;
94    SetSize(coll, q^d * Size(GL(d,q)) * Order(frob));
95    return coll;
96  end );
97
98# CHECKED 27/3/2012 jdb
99# cvec changed 25/3/14.
100#############################################################################
101#F  OnAffinePoints( <y>, <el> )
102# implements action of projective semilinear elements on affine points.
103# <y> is subspace
104# <el> is group element.
105##
106InstallGlobalFunction( OnAffinePoints,
107  function( y, el )
108       # Note that
109       #        |     0|
110       # [y, 1] |  A  0| = [yA + x, 1]
111       #        |     0|
112       #        |  x  1|
113    local yobj, new, d, geo, bf;
114	geo := y!.geo;
115    bf := geo!.basefield;
116    d := geo!.dimension;
117    yobj := Unpack(y!.obj);
118    yobj := CVec(Concatenation(yobj, [ One(bf) ]),bf); #Concatenation will make this a real lis, so CVec is applicable.
119    new := yobj * el!.mat;
120    new := new^el!.frob;
121    new := new{[1..d]};
122    return Wrap(geo, y!.type, new);
123  end );
124
125# CHECKED 27/3/2012 jdb
126# cvec/cmat change 25/3/14.
127# unpacking three times, and using AffineSubspace seems to be the easiest solution.
128#############################################################################
129#F  OnAffineNotPoints( <subspace>, <el> )
130# implements action of projective semilinear elements on affine subspaces different
131# from points.
132##
133# CHANGED 12/03/12 jdb
134# new directions at infinity should be normalized, otherwise you get the orbits q-1 times.
135##
136InstallGlobalFunction( OnAffineNotPoints,
137  function( subspace, el )
138     local dir, v, vec, newv, ag, mat, newdir, d, frob, bf;
139     ag := subspace!.geo;
140     d := ag!.dimension;
141     vec := ag!.vectorspace;
142     v := Unpack(subspace!.obj[1]);
143     dir := Unpack(subspace!.obj[2]);
144     mat := Unpack(el!.mat);
145     frob := el!.frob;
146     newdir := dir * mat{[1..d]}{[1..d]};
147     newdir := newdir^frob;
148	 TriangulizeMat(newdir);
149     newv := Concatenation(v, [ One(ag!.basefield) ]); #will be a plain list.
150     newv := newv * mat;
151     newv := newv^frob;
152     newv := newv{[1..d]};
153     newv := VectorSpaceTransversalElement(vec, newdir, newv);
154     return AffineSubspace(ag,newv,newdir);
155	 #return Wrap(ag, subspace!.type, [newv, newdir]);
156  end );
157
158# CHECKED 27/3/2012 jdb
159#############################################################################
160#F  OnAffineSubspaces( <y>, <el> )
161# This is the group action of an affine group on affine subspaces that
162# the user should use.
163##
164InstallGlobalFunction( OnAffineSubspaces,
165  function( v, el )
166    if v!.type = 1 then
167        return OnAffinePoints(v, el);
168    else
169        return OnAffineNotPoints(v, el);
170    fi;
171  end );
172
173# CHECKED 27/3/2012 jdb
174#############################################################################
175#F  \^( <x>, <em> )
176# shorcut to OnAffineSubspaces.
177##
178InstallOtherMethod( \^,
179	"for a subspace of an affine space and a projective element with frob",
180	[IsSubspaceOfAffineSpace, IsProjGrpElWithFrob],
181	function(x, em)
182		return OnAffineSubspaces(x,em);
183	end );
184
185