We now move to symmetries of the Euclidean space, including continuous symmetries. RepLAB provide two types of matrix groups.

Finite matrix groups are described by MatrixGroup, and their coefficients must belong to the field of cyclotomics. Matrix group elements are cyclotomic matrices of type cyclotomic. RepLAB provides an implementation of exact arithmetic in the field of cyclotomics using a Java library.

Classical compact Lie groups are provided by ClassicalCompactGroup. Their elements are matrices with floating-point coefficients, and thus all the operations on those group elements are approximate.

Here, we define a finite matrix group with two generators. The first one is a permutation matrix, and can thus be represented exactly using floating-point numbers (i.e, the standard MATLAB/Octave notation). The second, however, cannot, and needs to be constructed as an exact cyclotomic matrix. Note that the argument to cyclotomic is given as a string, and it is parsed inside RepLAB.

```
M1 = [0 1; 1 0];
M2 = replab.cyclotomic('[1/sqrt(2), 1/sqrt(2); 1/sqrt(2), -1/sqrt(2)]');
G = replab.MatrixGroup(2, {M1, M2})
```

```
G =
Finite group of order 16
identity: [1, 0; 0, 1]
generator(1 or 'x1'): [0, 1; 1, 0]
generator(2 or 'x2'): [sqrt(2)/2, sqrt(2)/2; sqrt(2)/2, -sqrt(2)/2]
recognize.source: Dihedral group of order 16
```

One can use most of the methods already discussed for permutation groups on matrix groups.

```
M3 = replab.cyclotomic('[i, 0; 0, 1]');
H = replab.MatrixGroup(2, {M3});
G_inter_H = G.intersection(H)
```

```
G_inter_H =
Finite group of order 2
identity: [1, 0; 0, 1]
generator(1 or 'x1'): [-1, 0; 0, 1]
recognize.source: Cyclic group C(2) of order 2 < x | x^2 = 1 >
```

Finite, exact, matrix groups are provided for convenience and pedagogical purposes. As of December 2021, they are implemented using brute-force enumeration algorithms, and are limited to group orders in the low hundreds.

The following continuous groups are available in RepLAB.

Over real \(n \times n\) matrices, the orthogonal group O(n) and the special orthogonal SO(n) group.

Over complex \(n \times n\) matrices, the unitary group U(n) and the special unitary SU(n) group.

Over quaternionic \(n \times n\) matrices, the compact symplectic group Sp(n). Its elements are quaternionic matrices of type replab.H. But usually, one works with an encoding of its elements over the complex numbers.

By themselves, those groups provide one useful operation: sampling from their Haar measure.

For the (special) orthogonal group:

```
O3 = replab.O(3);
sample_O3 = O3.sample
SO3 = replab.SO(3);
sample_SO3 = SO3.sample
det_SO3 = det(sample_SO3)
```

```
sample_O3 =
-0.662596 -0.748145 0.035286
0.109632 -0.143485 -0.983561
0.740910 -0.647836 0.177093
sample_SO3 =
0.8906 0.4331 -0.1387
-0.3056 0.7960 0.5225
0.3367 -0.4230 0.8413
det_SO3 = 1.0000
```

For the (special) unitary group:

```
U2 = replab.U(2);
sample_U2 = U2.sample
SU2 = replab.SU(2);
sample_SU2 = SU2.sample
det_U2 = det(sample_U2)
det_SU2 = det(sample_SU2)
```

```
sample_U2 =
0.1039 + 0.9735i 0.0940 + 0.1807i
0.1344 - 0.1530i -0.3334 + 0.9205i
sample_SU2 =
0.5174 + 0.7178i -0.4656 + 0.0160i
0.4656 + 0.0160i 0.5174 - 0.7178i
det_U2 = -0.9711 - 0.2388i
det_SU2 = 1.0000e+00 - 5.5511e-17i
```

For the compact symplectic group:

```
Sp2 = replab.Sp(2);
sample_Sp2 = Sp2.sample
```

```
sample_Sp2 =
0.11756 + 0.70518i + 0.045256j - ... -0.27846 + 0.27367i + 0.0047567j ...
-0.13089 - 0.27963i - 0.6226j + 0... -0.63939 + 0.2274i + 0.23656j + 0...
```

We will find more applications of continuous groups when we study group representations.