// examples of calculations -- takes about 2 minutes using Magma 2.24-4
// on  2.6GHz machine 
// EXCEPT for last command which uses intrinsic magma function 

SetEchoInput (true);
SetSeed (1);

// level 0, 1, 2 
SetVerbose ("GLConjugacy", 1);

Q := RationalField ();
Z := Integers ();

A1 := MatrixAlgebra(RationalField(), 10) ! [ RationalField() | 11, 1,
1, -3, -2, 1, 0, 0, 0, 0, 5, 0,
0, 0, -2, 0, 1, 0, 0, 0, -7, 1, 0, 1, 2, 0, 0, 1, 0, 0, -5, 0, 0, 1,
1, 0, 0, 0, 1, 0, -7, 0, 0,
1, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 11, 1, 1, -3, -2, 0, 0, 0, 0, 0,
5, 0, 0, 0, -2, 0, 0, 0, 0,
0, -7, 1, 0, 1, 2, 0, 0, 0, 0, 0, -5, 0, 0, 1, 1, 0, 0, 0, 0, 0, -7,
0, 0, 1, 2 ];
C1 := MatrixAlgebra(RationalField(), 10) ! [ RationalField() | 0, 0, 0,
-1, 1, -2, -1, -1, -2, -1, 0,
0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -1, -1, -2, -1, 0, 0,
0, -1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, -1, 0, 0,
-1, 0, 0, 0, 0, 0, 0, 0, 0, 1, -2, 2, 0, 0, 0, 0, 0, 0, 0, 1, -1, 1,
0, 0, 0, 0, 0, 0, 0 ];

B1 := C1 * A1 * C1^-1;

b1 := AreGLConjugate(A1, C1*A1*C1^-1);

// compute centraliser 
C := GLCentraliser (A1);
"Centraliser of matrix is ", C;
A1 := GL(10, Q) ! A1;
assert IsCentral (C, A1);

A2 := MatrixAlgebra(RationalField(), 6) ! Matrix(RationalField(), 6, 6, [ -1, 0, 0, 0,
-1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, -1, 0, 0, 0, 0, 1, 0, -1, 0,
0, -1, 0, 0, 0, 0 ])
;

B2:= MatrixAlgebra(RationalField(), 6) ! Matrix(RationalField(), 6, 6, [ -14225, 
-10192, -2568, -16221, 24257, -37925, 27, 20, 4, 27, -47, 72, 267, 195, 45, 294,
-459, 712, -156, -112, -28, -178, 267, -416, 476, 341, 86, 543, -811, 1269, 
5681, 4070, 1026, 6480, -9687, 15146 ])
;
b2 := AreGLConjugate (A2, B2);

"Result 1", b1;
"Result 2", b2;

// compute centraliser 
C := GLCentraliser (A2);
"Centraliser of matrix is ", C; 
A2 := GL(6, Q) ! A2;
assert IsCentral (C, A2);

/*
// random conjugates 
A := Random (GL(6, Z));
B := Random (GL(6, Z));
flag := AreGLConjugate (A, A^B);
flag;
*/

// some sample module computations 

M := OKymodule(MatrixAlgebra(RationalField(), 5) ! ScalarMatrix(RationalField(),
 5, 1),MatrixAlgebra(RationalField(), 5) ! ScalarMatrix(RationalField(), 5, 1),
MatrixAlgebra(RationalField(), 5) ! Matrix(RationalField(), 5, 5, [ 0, 0, 0, -4,
-2, 0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0 ]))
;

/*
B := 512;

L := AllStandardSubmodules (M, B);
S := Random (L);
S; 
A:= AutomorphismGroupStandardModule (S);     
"Aut group of standard module is ", A;

Mh :=
OKymodule(MatrixAlgebra(RationalField(), 5) ! ScalarMatrix(RationalField(), 5, 1
),MatrixAlgebra(RationalField(), 5) ! ScalarMatrix(RationalField(), 5, 1),
MatrixAlgebra(RationalField(), 5) ! Matrix(RationalField(), 5, 5, [ -10, 0, -8,
6, -2, 20, 0, 0, -4, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 50, 0, 44, -30, 10 ])) ;

Lh := AllStandardSubmodules (Mh, B);
T := Random (Lh);

flag, CB := IsomorphicAsOKyl (S, T);
flag;
*/
