# Examples

## `Example: Z Classes (ex-000ead)`

We split the ${\operatorname{GL}}_3({\mathbb{Q}})$-conjugacy class of the following faithful representation of the dihedral group with $12$ elements.

```magma
> G := MatrixGroup< 3, Integers() |
>  [ 1, -1, 0, 0, -1, 0, 0, 0, 1 ],
>  [ 1, -1, 0, 1, 0, 0, 0, 0, -1 ] >;
> Z, T:= ZClasses(G);
> #Z;
3
> < #t : t in T >;
<1, 2>

```

So there are 2 classes of homogeneously decomposable lattices represented by `T[1,1]` and `T[2,1]`. The third lattice `T[2,2]` belongs to `T[2,1]` as we check.

```magma
> Q := Rationals();
> GQ := ChangeRing(G, Q);
> Ids := CentralIdempotents(EndomorphismRing(GQ));
> L := VerticalJoin([ Matrix(Integers(), T[2,2] * i) : i in Ids]);
> Image(L) eq Image(Matrix(Integers(), T[2,1]));
true

```

Finally, we check that the $3$ ${\operatorname{GL}}_3({\mathbb{Z}})$-conjugacy classes stored in `Z` correspond to the $3$ lattices in `T`.

```magma
> TT := &cat T;
> [ GQ eq ChangeRing(Z[i], Q)^(GL(3, Q) ! TT[i]) : i in [1..#Z] ];
[ true, true, true ]

```

## `Example: conjugacy (ex-0cc747)`

We test that the automorphism groups of the lattices $B_{8}$ and $D_{8}$ are conjugate in ${\operatorname{GL}}_{8}({\mathbb{Q}})$ but not in ${\operatorname{GL}}_{8}({\mathbb{Z}})$.

```magma
> G := AutomorphismGroup( Lattice("B", 8) );
> H := AutomorphismGroup( Lattice("D", 8) );
> ok, x := IsGLQConjugate(G, H); ok, x;
true
[ 1 -1  0  0  0  0  0  0]
[ 1 -1 -2  0  0  0  0  0]
[-1  1  2  2  2  2  2  2]
[ 1  1  0  0  0  0  0  0]
[-1  1  2  2  2  2  2  0]
[ 1 -1 -2 -2 -2  0  0  0]
[-1  1  2  2  2  2  0  0]
[-1  1  2  2  0  0  0  0]
> Determinant(x);
-128
> IsGLZConjugate(G,H);
false

```

## `Example: Conjugacy Matrices (ex-7ed711)`

Let $C$ be the companion matrix of the fifth cyclotomic polynomial. We find a unimodular matrix that induces the automorphism $C -> C^2$.

```magma
> C:= CompanionMatrix(CyclotomicPolynomial(5));
> ok, h:= IsGLZConjugate(C, C^2); ok;
true
> C^2 eq h^-1 * C * h;
true

```

We now check by hand that this automorphism cannot be realized by a matrix of determinant $1$.

```magma
> Determinant(h);
-1
> G:= CentralizerGLZ(C);
> [ Determinant(g) : g in Generators(G) ];
[1, 1, 1]

```

Of course, we could also just ask:

```magma
> IsSLZConjugate(C, C^2);
false

```

## `Example: GLnZClasses EHOB (ex-2c3b15)`

We use the algorithm of Eick *et al.* [[Eick *et al.*, 2019](../../references.md#cite-eick-hofmann-obrien)] to decide integral conjugacy and to construct integral centralisers.

```magma
> A := GL(4, Integers ())!
>  [ 1, 0, 0, -3, 1, 1, -4, -3,
>    0, 0, -1, 0, 5, 5, -21, -14 ];
> B := GL(4, Integers ())!
> [-104, -21, -8, -3, 7729, 1552, 253, 218,
>   0, 0, -1, 0, -51848, -10407, -1532, -1460 ];
> flag, C := AreGLConjugate (A, B);
> flag;
true
> assert C^-1 * A * C eq B;
> C := GLCentraliser (A);
> assert forall{c * A eq A * c: c in Generators (C)};
>
> // another example with rational entries
> Q := Rationals ();
> A := GL(3,Q)!
> [ -5/3, -13/3, 25/3,
>   -7/3, 19/3, -16/3,
>   -5/3, 5/3, -2/3 ];
> B := GL(3, Q) !
> [ -19/3, -21, -119/3,
>    -1, 1, -2,
>    5/3, 5, 28/3 ];
> f, C := AreGLConjugate (A, B);
> C;
[ 1  2  4]
[ 0 -1 -2]
[ 0  0 -1]
> C := GL(3, Q) ! C;
> assert A^C eq B;
> C := GLCentraliser (A);
> C := sub<GL(3, Q) | Generators (C)>;
> assert forall{c * A eq A * c: c in Generators (C)};

```
