# Classical Groups

Given the matrix $F$ of a bilinear or sesquilinear form, the functions described in the previous section can be used to construct classical groups which preserve $F$ or preserve $F$ up to a scalar.

## `Example: fixaltform (ex-1225d3)`

For example the following code constructs the symplectic group $G$ and the conformal symplectic group $C$ preserving the non-degenerate alternating form $F$.

```magma
> F := Matrix(GF(5),4,4,[0,-1,-1,1, 1,0,1,-1, 1,-1,0,1, -1,1,-1,0]);
> V := SymplecticSpace(F);
> G := IsometryGroup(V);
> C := SimilarityGroup(V);
> f1, _ := IsIsomorphic(G,Sp(4,5));
> f2, _ := IsIsomorphic(C,CSp(4,5));
> f1, f2;
true true

```

If only the symplectic group is needed this can be obtained on one line

```magma
> G := IsometryGroup(SymplecticSpace(F));

```

Similar code can be used to construct the orthogonal group and the conformal orthogonal group preserving a quadratic form or the unitary group and conformal unitary group preserving an hermitian form.

However, to construct a group strictly between the isometry group and the similarity group of a form some more work is needed. The following example illustrates how this may be carried out for an hermitian form.

## `Example: fixhermform (ex-e06cca)`

This example constructs the group of unitary matrices of determinant 1 which preserve an hermitian form $F$. The first step is to define a Magma function which takes the form as its only argument. The base field and dimension of $F$ can be recovered from $F$ itself and then an isometry $\varphi$ is constructed from the unitary space of the standard form to the unitary space of $F$. This is used to transform the generators of a standard copy of the special unitary group to the group preserving the form.

```magma
> specialUnitaryGrp := function(F)
>   K := BaseRing(F); n := NumberOfRows(F);
>   J, sigma := StandardHermitianForm(n,K);
>   V := UnitarySpace(F,sigma);
>   S := UnitarySpace(J,sigma);
>   flag, phi := IsIsometric(S,V);
>   assert flag;
>   T := Matrix(K,n,n,[phi(S.i) : i in [1..n]]);
>   H := SpecialUnitaryGroup(n,K);
>   return sub<IsometryGroup(V) | [T^-1*H.i*T : i in [1..NumberOfGenerators(H)]]>;
> end function;

```

To complete the example we define an hermitian form $F$ and then use the above function to find the special unitary group that preserves $F$.

```magma
> K<z> := GF(9);
> F := Matrix(K,4,4,[1,z^7,z^6,2, z^5,2,z^6,z^6,  z^2,z^2,1,z^3, 2,z^2,z,0]);
> G := specialUnitaryGrp(F);
> flag where flag is IsIsomorphic(G,SU(4,3));
true

```
