Ad hoc Magma code

Magma packages

The documentation files in this section were produced from literate Magma scripts. The extracted code is installed in the current version of Magma.

Conjugacy classes in finite classical groups

The conjugacy classes of classical groups are parametrized by invariants, which in most cases can be computed rapidly. The Magma code documented here finds the conjugacy classes by first computing the invariants then finding a representative matrix for each invariant.

On invoking Classes(G) for a classical group G, Magma first attempts to compute the classes via invariants and if this is not possible it falls back to other (more time-consuming) methods.


  • Symplectic groups Sp(2n,q), the conformal symplectic groups CSp(2n,q) and all groups between these, provided q is a power of an odd prime.
  • General orthogonal groups GO(2n+1,q), GO+(2n,q) and GO(2n,q), provided q is a power of an odd prime. Magma also contains code to compute conjugacy classes in the conformal orthogonal groups.
  • Unitary groups GU(n,q), the special unitary groups SU(n,q) and all groups between, for all prime powers q.


This package illustrates the construction of user-defined types in Magma.

A nearfield satisfies all the axioms of a field except for the commutative law of multiplication and one of the distributive laws. The Magma code implements right-distributive nearfields.

Syntax highlighting for Magma