Documentation
¶
Overview ¶
Package grouprep implements the ordinary representation theory of finite groups over the complex numbers, built entirely on the Go standard library.
A (matrix) representation of a finite group G is a homomorphism ρ: G → GL(d, ℂ) assigning to every group element an invertible d×d complex matrix such that ρ(gh) = ρ(g)ρ(h). This package provides the concrete data structures and algorithms of the classical theory: complex matrices (Matrix), finite groups given by their Cayley table (Group), matrix representations (Rep), characters (Character) and character tables (CharacterTable).
Groups ¶
A Group is stored as an explicit multiplication (Cayley) table together with an inverse map and identity index. Standard families are provided: CyclicGroup, DihedralGroup, SymmetricGroup, AlternatingGroup, QuaternionGroup, KleinFourGroup, TrivialGroup and the DirectProduct of two groups. Structural queries include Group.ConjugacyClasses, Group.Center, Group.IsAbelian, Group.ElementOrder and subgroup closures via Group.GeneratedBy.
Representations ¶
A Rep pins a group and a matrix for every element. Constructions include TrivialRep, RegularRep, CyclicRep, DihedralRep2D, NaturalRepSymmetric, SignRepSymmetric and QuaternionRep. Reps combine under Rep.DirectSum and Rep.TensorProduct and can be dualised with Rep.Dual. Every rep is validated as a genuine homomorphism.
Characters ¶
The character of a rep is the trace class function χ(g) = tr ρ(g), obtained with Rep.Character. Characters live in the Hermitian inner product space of class functions with 〈χ, ψ〉 = (1/|G|) Σ χ(g)⁻ ψ(g), computed by InnerProduct. A character is irreducible exactly when its norm squared is one (IsIrreducible); an arbitrary character decomposes uniquely into irreducibles (DecomposeCharacter) — the numerical content of Maschke's theorem and complete reducibility. Restriction and induction between a group and a subgroup are provided by RestrictCharacter and InduceCharacter, and satisfy Frobenius reciprocity.
Character tables ¶
A CharacterTable assembles a complete set of irreducible characters against the conjugacy classes of the group. Tables for the standard families are produced by CharacterTableCyclic, CharacterTableDihedral, CharacterTableSymmetric, CharacterTableQuaternion and CharacterTableKleinFour. Each table satisfies the row and column orthogonality relations (CharacterTable.RowOrthogonality, CharacterTable.ColumnOrthogonality) and the dimension identity Σ dᵢ² = |G| (CharacterTable.SumOfSquaresOfDims).
All results are deterministic. Any randomness used by helper routines takes a caller-supplied seed through math/rand. Floating-point comparisons take an explicit tolerance; a value near 1e-9 is appropriate for the small groups the package targets.
Index ¶
- func AbsC(z complex128) float64
- func ApproxEqualC(a, b complex128, tol float64) bool
- func ApproxZeroC(z complex128, tol float64) bool
- func CharacterDimension(chi Character) int
- func ClassValues(g *Group, chi Character, tol float64) ([]complex128, error)
- func Conj(z complex128) complex128
- func Cplx(re, im float64) complex128
- func DecomposeCharacter(g *Group, chi Character, irrs []Character) []int
- func Imag(z complex128) float64
- func InnerProduct(g *Group, a, b Character) complex128
- func IsCharacter(g *Group, chi Character, irrs []Character, tol float64) bool
- func IsIntegerC(z complex128, tol float64) bool
- func IsIrreducible(g *Group, chi Character, tol float64) bool
- func IsRealC(z complex128, tol float64) bool
- func Multiplicity(g *Group, chi, irr Character) int
- func NormSquared(g *Group, chi Character) float64
- func PrimitiveRootOfUnity(n int) complex128
- func Real(z complex128) float64
- func RootOfUnity(n, k int) complex128
- func RoundC(z complex128, decimals int) complex128
- func RoundToInteger(z complex128) complex128
- type Character
- func AddCharacters(a, b Character) Character
- func CharacterFromRep(r *Rep) Character
- func ConjugateCharacter(chi Character) Character
- func InduceCharacter(gG *Group, gH *Group, emb []int, psi Character) (Character, error)
- func RegularCharacter(g *Group) Character
- func RestrictCharacter(chi Character, emb []int) Character
- func ScaleCharacter(z complex128, chi Character) Character
- func SubCharacters(a, b Character) Character
- func TensorCharacters(a, b Character) Character
- func TrivialCharacter(g *Group) Character
- func ZeroCharacter(g *Group) Character
- type CharacterTable
- func BuildCharacterTable(g *Group, irrs []Character) *CharacterTable
- func CharacterTableCyclic(n int) *CharacterTable
- func CharacterTableDihedral(n int) *CharacterTable
- func CharacterTableKleinFour() *CharacterTable
- func CharacterTableQuaternion() *CharacterTable
- func CharacterTableSymmetric(n int) *CharacterTable
- func (ct *CharacterTable) ClassElementOrders() []int
- func (ct *CharacterTable) ClassRepresentatives() []int
- func (ct *CharacterTable) ClassSizes() []int
- func (ct *CharacterTable) ColumnOrthogonality(tol float64) bool
- func (ct *CharacterTable) Decompose(chi Character) []int
- func (ct *CharacterTable) Dimensions() []int
- func (ct *CharacterTable) Group() *Group
- func (ct *CharacterTable) Irreducible(i int) Character
- func (ct *CharacterTable) Irreducibles() []Character
- func (ct *CharacterTable) IsComplete() bool
- func (ct *CharacterTable) NumClasses() int
- func (ct *CharacterTable) NumIrreducibles() int
- func (ct *CharacterTable) RowOrthogonality(tol float64) bool
- func (ct *CharacterTable) String() string
- func (ct *CharacterTable) SumOfSquaresOfDims() int
- func (ct *CharacterTable) Value(i, c int) complex128
- type Group
- func (g *Group) CayleyTable() [][]int
- func (g *Group) Center() []int
- func (g *Group) Centralizer(x int) []int
- func (g *Group) ClassOf(x int) []int
- func (g *Group) Commutator(i, j int) int
- func (g *Group) ConjugacyClasses() [][]int
- func (g *Group) Conjugate(a, x int) int
- func (g *Group) ElementName(i int) string
- func (g *Group) ElementOrder(i int) int
- func (g *Group) Elements() []int
- func (g *Group) Exponent() int
- func (g *Group) GeneratedBy(gens []int) []int
- func (g *Group) Identity() int
- func (g *Group) Inverse(i int) int
- func (g *Group) IsAbelian() bool
- func (g *Group) IsSubgroup(elems []int) bool
- func (g *Group) IsValid() error
- func (g *Group) Mul(i, j int) int
- func (g *Group) Name() string
- func (g *Group) NumConjugacyClasses() int
- func (g *Group) Order() int
- func (g *Group) Pow(i, k int) int
- type Matrix
- func Commutator(a, b Matrix) Matrix
- func DiagMatrix(diag []complex128) Matrix
- func IdentityMatrix(n int) Matrix
- func MatAdd(a, b Matrix) (Matrix, error)
- func MatDirectSum(a, b Matrix) Matrix
- func MatKronecker(a, b Matrix) Matrix
- func MatMul(a, b Matrix) (Matrix, error)
- func MatSub(a, b Matrix) (Matrix, error)
- func MatrixFromReal(rows [][]float64) Matrix
- func MatrixFromRows(rows [][]complex128) Matrix
- func NewMatrix(r, c int) Matrix
- func PermutationMatrix(p []int) Matrix
- func ReflectionMatrix(theta float64) Matrix
- func RotationMatrix(theta float64) Matrix
- func ScalarMatrix(n int, z complex128) Matrix
- func ZeroMatrix(r, c int) Matrix
- func (m Matrix) Add(n Matrix) (Matrix, error)
- func (m Matrix) ApproxEqual(n Matrix, tol float64) bool
- func (m Matrix) At(i, j int) complex128
- func (m Matrix) Clone() Matrix
- func (m Matrix) Col(j int) []complex128
- func (m Matrix) Cols() int
- func (m Matrix) Conjugate() Matrix
- func (m Matrix) ConjugateTranspose() Matrix
- func (m Matrix) Det() complex128
- func (m Matrix) DirectSum(n Matrix) Matrix
- func (m Matrix) Equal(n Matrix) bool
- func (m Matrix) FrobeniusNorm() float64
- func (m Matrix) Inverse() (Matrix, error)
- func (m Matrix) IsDiagonal(tol float64) bool
- func (m Matrix) IsHermitian(tol float64) bool
- func (m Matrix) IsIdentity(tol float64) bool
- func (m Matrix) IsSquare() bool
- func (m Matrix) IsUnitary(tol float64) bool
- func (m Matrix) IsZero(tol float64) bool
- func (m Matrix) Kronecker(n Matrix) Matrix
- func (m Matrix) MaxAbsDiff(n Matrix) float64
- func (m Matrix) Mul(n Matrix) (Matrix, error)
- func (m Matrix) MulVec(v []complex128) ([]complex128, error)
- func (m Matrix) Pow(k int) (Matrix, error)
- func (m Matrix) Rank(tol float64) int
- func (m Matrix) Round(decimals int) Matrix
- func (m Matrix) Row(i int) []complex128
- func (m Matrix) Rows() int
- func (m Matrix) Scale(z complex128) Matrix
- func (m Matrix) Set(i, j int, z complex128)
- func (m Matrix) String() string
- func (m Matrix) Sub(n Matrix) (Matrix, error)
- func (m Matrix) Submatrix(rows, cols []int) Matrix
- func (m Matrix) Trace() complex128
- func (m Matrix) Transpose() Matrix
- type Perm
- func (p Perm) Apply(i int) int
- func (p Perm) Compose(q Perm) Perm
- func (p Perm) CycleDecomposition() [][]int
- func (p Perm) CycleType() []int
- func (p Perm) Degree() int
- func (p Perm) Equal(q Perm) bool
- func (p Perm) Inverse() Perm
- func (p Perm) IsValid() bool
- func (p Perm) Order() int
- func (p Perm) PermMatrix() Matrix
- func (p Perm) Sign() int
- type Rep
- func CyclicRep(n, k int) *Rep
- func DihedralRep2D(n, h int) *Rep
- func DirectSumReps(reps ...*Rep) *Rep
- func NaturalRepSymmetric(n int) *Rep
- func NewRep(g *Group, mats []Matrix, tol float64) (*Rep, error)
- func QuaternionRep() *Rep
- func RegularRep(g *Group) *Rep
- func SignRepSymmetric(n int) *Rep
- func TrivialRep(g *Group) *Rep
- func (r *Rep) Character() Character
- func (r *Rep) Dim() int
- func (r *Rep) DirectSum(s *Rep) *Rep
- func (r *Rep) Dual() *Rep
- func (r *Rep) Group() *Group
- func (r *Rep) IsHomomorphism(tol float64) bool
- func (r *Rep) IsUnitary(tol float64) bool
- func (r *Rep) Matrix(i int) Matrix
- func (r *Rep) RepString() string
- func (r *Rep) TensorProduct(s *Rep) *Rep
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApproxEqualC ¶
func ApproxEqualC(a, b complex128, tol float64) bool
ApproxEqualC reports whether a and b are within tol of each other in modulus, i.e. |a-b| <= tol.
func ApproxZeroC ¶
func ApproxZeroC(z complex128, tol float64) bool
ApproxZeroC reports whether |z| <= tol.
func CharacterDimension ¶
CharacterDimension returns the dimension of the representation affording chi, the rounded real part of chi on the identity.
func ClassValues ¶
func ClassValues(g *Group, chi Character, tol float64) ([]complex128, error)
ClassValues reduces chi to one value per conjugacy class of g, taking the value on each class representative (the smallest element). It errors if chi is not a class function to within tol.
func Cplx ¶
func Cplx(re, im float64) complex128
Cplx builds a complex128 from its real and imaginary parts. It is a thin convenience wrapper around the built-in complex.
func DecomposeCharacter ¶
DecomposeCharacter returns the multiplicities of chi against the given list of irreducible characters, so that chi = Σ mult[i]·irrs[i]. This is the numerical form of complete reducibility (Maschke's theorem). The multiplicity is the rounded inner product 〈irrs[i], chi〉.
func InnerProduct ¶
func InnerProduct(g *Group, a, b Character) complex128
InnerProduct returns the Hermitian inner product of two characters of g,
〈a, b〉 = (1/|G|) Σ_{x∈G} conj(a(x)) · b(x).
For irreducible characters this is 1 when the characters are equal and 0 otherwise (the first orthogonality relation). It panics if the lengths do not match |G|.
Example ¶
ExampleInnerProduct demonstrates the first orthogonality relation on the irreducible characters of S3.
g := SymmetricGroup(3)
ct := CharacterTableSymmetric(3)
std := ct.Irreducible(2)
fmt.Printf("%.0f %.0f\n",
real(InnerProduct(g, std, std)),
real(InnerProduct(g, ct.Irreducible(0), std)))
Output: 1 0
func IsCharacter ¶
IsCharacter reports whether chi is a (non-virtual) character with respect to the given complete list of irreducibles: all multiplicities are non-negative integers to within tol, and the reconstruction matches chi.
func IsIntegerC ¶
func IsIntegerC(z complex128, tol float64) bool
IsIntegerC reports whether z is a (real) integer to within tol.
func IsIrreducible ¶
IsIrreducible reports whether chi is an irreducible character, i.e. its norm squared is 1 to within tol.
func IsRealC ¶
func IsRealC(z complex128, tol float64) bool
IsRealC reports whether z is real to within tol, i.e. |Imag(z)| <= tol.
func Multiplicity ¶
Multiplicity returns the multiplicity of the irreducible character irr in the character chi, the rounded value of 〈irr, chi〉.
func NormSquared ¶
NormSquared returns the real number 〈chi, chi〉, the squared norm of chi in the character inner product. It equals the sum of the squares of the multiplicities of the irreducible constituents.
func PrimitiveRootOfUnity ¶
func PrimitiveRootOfUnity(n int) complex128
PrimitiveRootOfUnity returns exp(2πi / n), the standard primitive n-th root of unity. It panics if n <= 0.
func RootOfUnity ¶
func RootOfUnity(n, k int) complex128
RootOfUnity returns the primitive-n-th root exp(2πi k / n), the k-th power of the standard primitive n-th root of unity. It panics if n <= 0.
func RoundC ¶
func RoundC(z complex128, decimals int) complex128
RoundC rounds both the real and imaginary parts of z to the given number of decimal places. It is useful for presenting otherwise noisy floating-point results.
func RoundToInteger ¶
func RoundToInteger(z complex128) complex128
RoundToInteger returns the nearest Gaussian integer to z. It is used to snap character inner products, which are known to be integers, to exact values.
Types ¶
type Character ¶
type Character []complex128
Character is a class function on a group, stored as one complex value per element index: chi[i] is the value on element i. The character of a representation is the class function i ↦ tr ρ(i), obtained from Rep.Character.
func AddCharacters ¶
AddCharacters returns the pointwise sum a+b, the character of the direct sum.
func CharacterFromRep ¶
CharacterFromRep returns the character of the representation r; it is a free function equivalent to r.Character().
func ConjugateCharacter ¶
ConjugateCharacter returns the complex conjugate of chi, the character of the dual representation.
func InduceCharacter ¶
InduceCharacter induces a character psi of a subgroup H up to the group G, using the embedding emb (emb[h] the index in G of the H-element h). It applies the Frobenius formula
Ind(psi)(y) = (1/|H|) Σ_{x∈G} psi°(x⁻¹ y x),
where psi° extends psi by zero off H. It returns an error if emb is not a valid injection of a subgroup of G.
func RegularCharacter ¶
RegularCharacter returns the character of the regular representation of g: |G| on the identity and 0 elsewhere. It decomposes as Σ dᵢ·χᵢ over the irreducibles, each appearing with multiplicity equal to its degree.
func RestrictCharacter ¶
RestrictCharacter restricts a character of a group G to a subgroup H given by an embedding emb, where emb[h] is the index in G of the element h of H. The result is the class function on H with value chi(emb[h]).
func ScaleCharacter ¶
func ScaleCharacter(z complex128, chi Character) Character
ScaleCharacter returns z·chi.
func SubCharacters ¶
SubCharacters returns the pointwise difference a-b (a virtual character).
func TensorCharacters ¶
TensorCharacters returns the pointwise product a·b, the character of the tensor product representation.
func TrivialCharacter ¶
TrivialCharacter returns the character of the trivial representation of g, identically 1.
func ZeroCharacter ¶
ZeroCharacter returns the identically zero class function on g.
func (Character) ApproxEqual ¶
ApproxEqual reports whether chi and psi agree entrywise to within tol.
func (Character) Degree ¶
Degree returns the degree (dimension) of the character, its value on the identity element, as a real number.
func (Character) IsClassFunction ¶
IsClassFunction reports whether chi is constant on the conjugacy classes of g to within tol. Every character is a class function; this checks a candidate.
func (Character) Value ¶
func (chi Character) Value(i int) complex128
Value returns the value of chi on element i.
type CharacterTable ¶
type CharacterTable struct {
// contains filtered or unexported fields
}
CharacterTable holds a complete set of irreducible characters of a group, tabulated against its conjugacy classes. The number of irreducibles equals the number of conjugacy classes. Rows are irreducible characters and columns are classes.
func BuildCharacterTable ¶
func BuildCharacterTable(g *Group, irrs []Character) *CharacterTable
BuildCharacterTable assembles a character table for g from a list of irreducible characters (each a full class function over all |G| elements). The characters are sorted by degree (ascending), then lexicographically, so the trivial character comes first. The rows are reduced to one value per conjugacy class.
func CharacterTableCyclic ¶
func CharacterTableCyclic(n int) *CharacterTable
CharacterTableCyclic returns the character table of the cyclic group C_n. Its n irreducible characters send the generator to each n-th root of unity. It panics if n < 1.
func CharacterTableDihedral ¶
func CharacterTableDihedral(n int) *CharacterTable
CharacterTableDihedral returns the character table of the dihedral group D_n. It is assembled from the one-dimensional characters and the two-dimensional characters χ_h(r^j) = 2cos(2πhj/n), χ_h(reflection) = 0. It panics if n < 1.
func CharacterTableKleinFour ¶
func CharacterTableKleinFour() *CharacterTable
CharacterTableKleinFour returns the character table of the Klein four-group.
func CharacterTableQuaternion ¶
func CharacterTableQuaternion() *CharacterTable
CharacterTableQuaternion returns the character table of the quaternion group Q8: four one-dimensional characters and one two-dimensional character with values (2, -2, 0, 0, 0) on the classes {1}, {-1}, {±i}, {±j}, {±k}.
func CharacterTableSymmetric ¶
func CharacterTableSymmetric(n int) *CharacterTable
CharacterTableSymmetric returns the character table of the symmetric group S_n for 1 <= n <= 4. It panics for n outside this range (the general case is governed by the Murnaghan-Nakayama rule and is not implemented here).
func (*CharacterTable) ClassElementOrders ¶
func (ct *CharacterTable) ClassElementOrders() []int
ClassElementOrders returns the order of a representative element of each conjugacy class, in column order.
func (*CharacterTable) ClassRepresentatives ¶
func (ct *CharacterTable) ClassRepresentatives() []int
ClassRepresentatives returns the smallest element index of each conjugacy class, in column order.
func (*CharacterTable) ClassSizes ¶
func (ct *CharacterTable) ClassSizes() []int
ClassSizes returns the number of elements in each conjugacy class, in column order.
func (*CharacterTable) ColumnOrthogonality ¶
func (ct *CharacterTable) ColumnOrthogonality(tol float64) bool
ColumnOrthogonality reports whether the columns satisfy the second orthogonality relation: for classes c and d with representatives of centralizer order |G|/|class|,
Σᵢ conj(χᵢ(c))·χᵢ(d) = δ_{cd}·|G|/|class c|,
to within tol.
func (*CharacterTable) Decompose ¶
func (ct *CharacterTable) Decompose(chi Character) []int
Decompose returns the multiplicities of an arbitrary character chi against the irreducibles of the table, so that chi = Σ mult[i]·χᵢ.
Example ¶
ExampleDecomposeCharacter shows that the regular representation of S3 decomposes with each irreducible appearing with multiplicity equal to its degree: the trivial (1), the sign (1) and the two-dimensional standard representation (2).
g := SymmetricGroup(3) ct := CharacterTableSymmetric(3) reg := RegularCharacter(g) fmt.Println(ct.Decompose(reg))
Output: [1 1 2]
func (*CharacterTable) Dimensions ¶
func (ct *CharacterTable) Dimensions() []int
Dimensions returns the degrees of the irreducible characters, in row order.
func (*CharacterTable) Group ¶
func (ct *CharacterTable) Group() *Group
Group returns the group of the table.
func (*CharacterTable) Irreducible ¶
func (ct *CharacterTable) Irreducible(i int) Character
Irreducible returns the i-th irreducible character as a full class function over the group.
func (*CharacterTable) Irreducibles ¶
func (ct *CharacterTable) Irreducibles() []Character
Irreducibles returns all irreducible characters as full class functions.
func (*CharacterTable) IsComplete ¶
func (ct *CharacterTable) IsComplete() bool
IsComplete reports whether the table has as many irreducibles as classes and satisfies Σ dᵢ² = |G|.
func (*CharacterTable) NumClasses ¶
func (ct *CharacterTable) NumClasses() int
NumClasses returns the number of conjugacy classes (columns). It equals NumIrreducibles for a complete table.
func (*CharacterTable) NumIrreducibles ¶
func (ct *CharacterTable) NumIrreducibles() int
NumIrreducibles returns the number of irreducible characters (rows).
func (*CharacterTable) RowOrthogonality ¶
func (ct *CharacterTable) RowOrthogonality(tol float64) bool
RowOrthogonality reports whether the rows satisfy the first orthogonality relation: 〈χᵢ, χⱼ〉 = δᵢⱼ to within tol, using the weighted class sum (1/|G|) Σ_c |class c|·conj(χᵢ)·χⱼ.
func (*CharacterTable) String ¶
func (ct *CharacterTable) String() string
String renders the character table as an aligned text grid: one row per irreducible, one column per class, values rounded to two decimals.
func (*CharacterTable) SumOfSquaresOfDims ¶
func (ct *CharacterTable) SumOfSquaresOfDims() int
SumOfSquaresOfDims returns Σ dᵢ², which for a complete table equals the group order |G|.
func (*CharacterTable) Value ¶
func (ct *CharacterTable) Value(i, c int) complex128
Value returns the value of irreducible i on conjugacy class c.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is a finite group given by an explicit Cayley (multiplication) table. Elements are the integers 0,...,n-1; element 0 is always the identity. The table satisfies table[i][j] = index of the product i·j. Construct groups with the family constructors (CyclicGroup, DihedralGroup, ...) rather than by hand.
func AlternatingGroup ¶
AlternatingGroup returns the alternating group A_n of even permutations of n points, of order n!/2 for n >= 2. It panics if n < 1.
func CyclicGroup ¶
CyclicGroup returns the cyclic group Z/nZ of order n written additively: element i is i mod n and i·j = (i+j) mod n. It panics if n < 1.
func DihedralGroup ¶
DihedralGroup returns the dihedral group D_n of order 2n, the symmetry group of a regular n-gon. Element a·n+b denotes s^a r^b with r a rotation of order n, s a reflection, and s r s = r⁻¹. It panics if n < 1.
func DirectProduct ¶
DirectProduct returns the external direct product g×h. Element a·|h|+b denotes the pair (a, b) with componentwise multiplication.
func KleinFourGroup ¶
func KleinFourGroup() *Group
KleinFourGroup returns the Klein four-group V = C2×C2 of order 4.
func QuaternionGroup ¶
func QuaternionGroup() *Group
QuaternionGroup returns the quaternion group Q8 = {±1, ±i, ±j, ±k} of order 8. Elements are indexed 0:1, 1:-1, 2:i, 3:-i, 4:j, 5:-j, 6:k, 7:-k.
func SymmetricGroup ¶
SymmetricGroup returns the symmetric group S_n of all permutations of n points, of order n!. It panics if n < 1. Practical use is limited to small n.
func (*Group) CayleyTable ¶
CayleyTable returns a copy of the multiplication table of g.
func (*Group) Center ¶
Center returns the sorted indices of the elements commuting with every element of g.
func (*Group) Centralizer ¶
Centralizer returns the sorted indices of the elements commuting with x.
func (*Group) Commutator ¶
Commutator returns the group commutator i j i⁻¹ j⁻¹.
func (*Group) ConjugacyClasses ¶
ConjugacyClasses returns the conjugacy classes of g, each a sorted slice of element indices. The classes are ordered by their smallest element, so the identity class {0} comes first.
func (*Group) Conjugate ¶
Conjugate returns the conjugate g x g⁻¹ (with a the conjugator and x the element), i.e. a·x·a⁻¹.
func (*Group) ElementName ¶
ElementName returns a human-readable label for element i.
func (*Group) ElementOrder ¶
ElementOrder returns the order of element i, the least positive k with i^k = identity.
func (*Group) Exponent ¶
Exponent returns the exponent of g, the least common multiple of all element orders.
func (*Group) GeneratedBy ¶
GeneratedBy returns the sorted set of elements of the subgroup generated by gens (the closure under multiplication and inverses).
func (*Group) IsSubgroup ¶
IsSubgroup reports whether the given set of element indices is closed under the group operation and inverses (and hence forms a subgroup).
func (*Group) IsValid ¶
IsValid re-checks that g really is a group. It returns nil for the groups the constructors produce.
func (*Group) NumConjugacyClasses ¶
NumConjugacyClasses returns the number of conjugacy classes of g, which equals the number of complex irreducible representations.
type Matrix ¶
type Matrix [][]complex128
Matrix is a dense complex matrix stored row-major: m[i][j] is the entry in row i and column j. The zero value is not usable; construct matrices with NewMatrix, MatrixFromRows and friends.
func Commutator ¶
Commutator returns the matrix commutator ab-ba. It panics if the products are undefined.
func DiagMatrix ¶
func DiagMatrix(diag []complex128) Matrix
DiagMatrix returns the square diagonal matrix whose diagonal entries are the elements of diag.
func IdentityMatrix ¶
IdentityMatrix returns the n×n identity matrix. It panics if n is negative.
func MatDirectSum ¶
MatDirectSum returns the block-diagonal direct sum a⊕b.
func MatKronecker ¶
MatKronecker returns the Kronecker product a⊗b.
func MatMul ¶
MatMul returns the product a·b. It returns an error on a dimension mismatch; it is the free-function form of Matrix.Mul.
func MatrixFromReal ¶
MatrixFromReal builds a complex matrix whose entries are the given real numbers (with zero imaginary part). It panics if the input is ragged.
func MatrixFromRows ¶
func MatrixFromRows(rows [][]complex128) Matrix
MatrixFromRows builds a matrix from an explicit slice of rows. The input is deep-copied. It panics if the rows are ragged.
func NewMatrix ¶
NewMatrix returns an r×c matrix with every entry equal to zero. It panics if r or c is negative.
func PermutationMatrix ¶
PermutationMatrix returns the n×n permutation matrix P of the permutation p (in one-line notation, p[i] the image of i), defined by P[p[i]][i] = 1. Thus P acts on a standard basis vector e_i by sending it to e_{p[i]}. It panics if p is not a permutation of {0,...,n-1}.
func ReflectionMatrix ¶
ReflectionMatrix returns the 2×2 real matrix reflecting the plane across the line through the origin at angle theta to the x-axis.
func RotationMatrix ¶
RotationMatrix returns the 2×2 real rotation matrix through angle theta (counter-clockwise).
func ScalarMatrix ¶
func ScalarMatrix(n int, z complex128) Matrix
ScalarMatrix returns the n×n diagonal matrix with z on the diagonal, i.e. z times the identity.
func ZeroMatrix ¶
ZeroMatrix is an alias for NewMatrix returning the r×c zero matrix.
func (Matrix) ApproxEqual ¶
ApproxEqual reports whether m and n have the same shape and entries agreeing to within tol in modulus.
func (Matrix) ConjugateTranspose ¶
ConjugateTranspose returns the conjugate transpose (Hermitian adjoint) m†.
func (Matrix) Det ¶
func (m Matrix) Det() complex128
Det returns the determinant of the square matrix m, computed by Gaussian elimination with partial pivoting. It panics if m is not square.
func (Matrix) DirectSum ¶
DirectSum returns the block-diagonal matrix diag(m, n), the direct sum m⊕n.
func (Matrix) FrobeniusNorm ¶
FrobeniusNorm returns the Frobenius norm of m, the square root of the sum of the squared moduli of all entries.
func (Matrix) Inverse ¶
Inverse returns the inverse of the square matrix m via Gauss-Jordan elimination. It returns an error if m is not square or is singular.
func (Matrix) IsDiagonal ¶
IsDiagonal reports whether all off-diagonal entries of the square matrix m vanish to within tol.
func (Matrix) IsHermitian ¶
IsHermitian reports whether m equals its conjugate transpose to within tol.
func (Matrix) IsIdentity ¶
IsIdentity reports whether m is the identity matrix to within tol.
func (Matrix) IsUnitary ¶
IsUnitary reports whether m is unitary, i.e. m†m is the identity to within tol.
func (Matrix) Kronecker ¶
Kronecker returns the Kronecker (tensor) product m⊗n, an (r_m·r_n)×(c_m·c_n) matrix. It underlies the tensor product of representations.
func (Matrix) MaxAbsDiff ¶
MaxAbsDiff returns the largest modulus |m[i][j]-n[i][j]| over all entries. It panics if the shapes differ.
func (Matrix) Mul ¶
Mul returns the matrix product m·n. It returns an error if the inner dimensions do not match.
func (Matrix) MulVec ¶
func (m Matrix) MulVec(v []complex128) ([]complex128, error)
MulVec returns the matrix-vector product m·v. It returns an error if the dimensions are incompatible.
func (Matrix) Pow ¶
Pow returns m raised to the non-negative integer power k. Pow(m, 0) is the identity. It returns an error if m is not square.
func (Matrix) Rank ¶
Rank returns the numerical rank of m, the number of pivots found by Gaussian elimination with entries below tol treated as zero.
func (Matrix) Round ¶
Round returns a copy of m with every entry rounded to the given number of decimal places.
func (Matrix) Scale ¶
func (m Matrix) Scale(z complex128) Matrix
Scale returns z·m, the matrix with every entry multiplied by z.
func (Matrix) Submatrix ¶
Submatrix returns the matrix formed by selecting the given rows and columns in the given order.
func (Matrix) Trace ¶
func (m Matrix) Trace() complex128
Trace returns the sum of the diagonal entries of the square matrix m. It panics if m is not square.
type Perm ¶
type Perm []int
Perm is a permutation of {0,...,n-1} in one-line notation: p[i] is the image of i. A valid Perm of length n contains each value in [0,n) exactly once.
func AllPermutations ¶
AllPermutations returns every permutation of {0,...,n-1} in lexicographic order. It panics if n is negative.
func IdentityPerm ¶
IdentityPerm returns the identity permutation of degree n.
func (Perm) Compose ¶
Compose returns the composition p∘q, applying q first: (p∘q)[i] = p[q[i]]. It panics if the degrees differ.
func (Perm) CycleDecomposition ¶
CycleDecomposition returns the disjoint cycles of p as a slice of slices, including fixed points as length-one cycles. Each cycle begins with its smallest element and the cycles are ordered by that element.
func (Perm) CycleType ¶
CycleType returns the multiset of cycle lengths of p in non-increasing order, a partition of the degree. It is the conjugacy-class invariant for symmetric groups.
func (Perm) Order ¶
Order returns the multiplicative order of p, the least positive k with p^k = identity. It equals the least common multiple of the cycle lengths.
func (Perm) PermMatrix ¶
PermMatrix returns the permutation matrix of p; see PermutationMatrix.
type Rep ¶
type Rep struct {
// contains filtered or unexported fields
}
Rep is a finite-dimensional complex matrix representation of a Group: a map assigning to every element i an invertible dim×dim matrix mats[i] such that mats[i·j] = mats[i]·mats[j]. Build reps with the constructors below or with NewRep, which validates the homomorphism property.
func CyclicRep ¶
CyclicRep returns the one-dimensional representation of the cyclic group C_n sending the generator r to the k-th root of unity ω^k = exp(2πik/n). For k ranging over 0..n-1 these are all the irreducible representations of C_n. It panics if n < 1.
func DihedralRep2D ¶
DihedralRep2D returns the two-dimensional representation of the dihedral group D_n in which the rotation r acts by rotation through 2πh/n and the reflection s acts by a reflection. For 1 <= h < n/2 these are irreducible; its character is 2cos(2πhj/n) on r^j and 0 on every reflection. It panics if n < 1.
func DirectSumReps ¶
DirectSumReps returns the direct sum of several representations of the same group, in order. It panics if fewer than one rep is given.
func NaturalRepSymmetric ¶
NaturalRepSymmetric returns the natural n-dimensional permutation representation of the symmetric group S_n, in which each permutation acts by its permutation matrix. It is reducible for n >= 2, decomposing as the trivial representation plus the (n-1)-dimensional standard representation. It panics if n < 1.
func NewRep ¶
NewRep builds a representation of g from an explicit matrix per element and verifies that it is a genuine homomorphism to within tol. The slice mats must have length g.Order() and every matrix must be square of the same size. It returns an error otherwise.
func QuaternionRep ¶
func QuaternionRep() *Rep
QuaternionRep returns the two-dimensional irreducible representation of the quaternion group Q8 by Pauli-like matrices, with i, j, k acting as the standard unit-quaternion matrices. Its character is (2, -2, 0, 0, 0) on the classes {1}, {-1}, {±i}, {±j}, {±k}.
func RegularRep ¶
RegularRep returns the left regular representation of g, of dimension |G|: element x acts on the basis {e_y} by e_y ↦ e_{x·y}. Its character is |G| at the identity and 0 elsewhere.
func SignRepSymmetric ¶
SignRepSymmetric returns the one-dimensional sign representation of S_n, sending each permutation to its sign (+1 or -1). It panics if n < 1.
func TrivialRep ¶
TrivialRep returns the one-dimensional representation sending every element to [1].
func (*Rep) DirectSum ¶
DirectSum returns the direct sum r⊕s, the block-diagonal representation of dimension Dim(r)+Dim(s). It panics if the two reps are of different groups.
func (*Rep) Dual ¶
Dual returns the dual (contragredient) representation, sending g to the inverse transpose of mats[g]. Its character is the complex conjugate of the original character.
func (*Rep) IsHomomorphism ¶
IsHomomorphism reports whether mats[i·j] = mats[i]·mats[j] for all i, j to within tol.
func (*Rep) IsUnitary ¶
IsUnitary reports whether every representing matrix is unitary to within tol. Every representation of a finite group is equivalent to a unitary one (Weyl's unitarian trick); the standard constructions here are unitary.
func (*Rep) TensorProduct ¶
TensorProduct returns the tensor (Kronecker) product r⊗s, of dimension Dim(r)·Dim(s). Its character is the pointwise product of the two characters. It panics if the reps are of different groups.