/*
Test file for  matrix package;
Latest version: EOB, 15/11/02
 */


/* imprimitive example */

M := GL (4, 7);
P := Sym (3);
G := WreathProduct (M, P);

IsPrimitive (G);

/* block system */

B := Blocks (G);

B;

/* permutation representation */
P := BlocksImage (G);

P;

/* semilinear example */

P := GL(6,3);
g1 := P![0,1,0,0,0,0,-1,0,0,0,0,0,
         0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1];
g2 := P![-1,0,0,0,1,0,0,-1,0,0,0,1,
         -1,0,0,0,0,0,0,-1,0,0,0,0,0,0,-1,0,0,0,0,0,0,-1,0,0];
g3 := P![1,0,0,0,0,0,0,-1,0,0,0,0,
         0,0,1,0,0,0,0,0,0,-1,0,0,0,0,0,0,1,0,0,0,0,0,0,-1];
G := sub <P | g1, g2, g3 >;

IsSemiLinear (G);
DegreeOfFieldExtension (G);
CentralisingMatrix (G);
FrobeniusAutomorphisms (G);

K, R, E := WriteOverLargerField (G);

/* kernel of homomorphism from G into E */
K;

/* now K rewritten as subgroup of GL(6/2, 32) */
R;

/* E is cyclic group of order e */

E;

///* sequence of images of G.i in E */
//phi;

/* tensor product example */
P := GL (6, 3);

g := P![ 0, 1, 1, 2, 1, 0, 2, 2, 1, 2, 1, 1, 1, 0, 2, 1, 2, 2, 1, 2, 2,
         2, 2, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 2, 2 ];

h := P![ 1, 0, 2, 1, 1, 2, 0, 0, 2, 0, 0, 2, 2, 0, 1, 0, 2, 1, 2, 1, 2,
         2, 1, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, 2, 1, 2 ];

G := sub < P | g, h >;
IsTensor (G);

/* change-of-basis matrix */
C := TensorBasis (G);

/* if we conjugate G.1 by C, we obtain a visible Kronecker product */
G.1^C;

/* verify that G.1^C is a Kronecker product */
IsProportional (G.1^C, 2);

/* tensor factors */

A := TensorFactors (G);
 
A[1];

A[2];

/* no decomposition found */
G := GL(4, 5);
SearchForDecomposition (G, [G.1]);

/* imprimitive decomposition */
M := GL (4, 7);
P := Sym (3);
G := WreathProduct (M, P);
SearchForDecomposition (G, [G.1, G.2]);
IsPrimitive (G);
Blocks (G);
BlocksImage (G);

/* semilinear decomposition */
P := GL(6,3);
g1 := P![0,1,0,0,0,0,-1,0,0,0,0,0,
         0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1];
g2 := P![-1,0,0,0,1,0,0,-1,0,0,0,1,
         -1,0,0,0,0,0,0,-1,0,0,0,0,0,0,-1,0,0,0,0,0,0,-1,0,0];
g3 := P![1,0,0,0,0,0,0,-1,0,0,0,0,
         0,0,1,0,0,0,0,0,0,-1,0,0,0,0,0,0,1,0,0,0,0,0,0,-1];
G := sub <P | g1, g2, g3 >;

IsSemiLinear (G);
SearchForDecomposition (G, [g1]);
DegreeOfFieldExtension (G);
CentralisingMatrix (G);
FrobeniusAutomorphisms (G);

/* tensor product */
F := GF(5);
G := GL(5, F);
H := GL(3, F);
P := GL(15, F);
A := MatrixAlgebra (F, 5);
B := MatrixAlgebra (F, 3);
g1 := A!G.1; g2 := A!G.2;  g3 := A!Identity(G);
h1 := B!H.1; h2 := B!H.2; h3 := B!Identity(H);
w := TensorProduct (g1, h3);
x := TensorProduct (g2, h3);
y := TensorProduct (g3, h1);
z := TensorProduct (g3, h2);
G := sub < P | w, x, y, z>;
SearchForDecomposition (G, [G.1, G.2]);

IsTensor (G);
TensorBasis (G);
TensorFactors (G);

/* symmetric tensor power */
M := GL (3, GF(2));
P := Sym (3);
G := TensorWreathProduct (M, P);
SearchForDecomposition (G, [G.1]);

IsTensorInduced (G);
TensorInducedBasis (G);
TensorInducedPermutations (G);

/* normaliser of a symplectic group */
F := GF(5);
P := GL(4,F);
g1 := P![ 1,0,0,0,0,4,0,0,2,0,2,3,3,0,4,3];
g2 := P![ 4,0,0,1,2,4,4,0,1,0,1,2,0,0,0,1];
g3 := P![ 4,0,1,1,0,1,0,0,0,1,3,4,0,4,3,2];
g4 := P![ 2,0,4,3,4,4,2,4,0,1,3,4,4,2,0,1];
g5 := P![ 1,1,3,4,0,0,3,4,2,0,0,4,3,1,3,4];
g6 := P![ 2,0,0,0,0,2,0,0,0,0,2,0,0,0,0,2];
G := sub < P | g1, g2, g3, g4, g5, g6 >;
SearchForDecomposition (G, [G.4]);

IsExtraSpecialNormaliser (G);
ExtraSpecialParameters (G);
E := ExtraSpecialGroup (G);
#E;

