# Base group structures¶

The following classes provide basic structures for monoids/groups. All objects below inherit from Str / Obj / Domain, and thus provide pretty printing infrastructure, a Domain.eqv equality test method, and a Domain.sample method to generate a random element.

## Monoid¶

class replab.Monoid

Bases: replab.Domain

Describes a monoid

### Own members

identity

Monoid identity element

Type

element

areCommuting(self, x, y)

Returns whether the two given elements commute

Parameters
• x (element) – Monoid/Group element

• y (element) – Monoid/Group element

Returns

True if x y = y x, false otherwise

Return type

logical

compose(self, x, y)

Composes two monoid/group elements

Parameters
• x (element) – Left hand side of the binary operation

• y (element) – Right hand side of the binary operation

Returns

Result of the binary operation x op y

Return type

element

composeAll(self, elements)

Composes a sequence of monoid elements

For self.composeAll({x1 x2 ... xn}), returns x1*x2*...*xn (shown here in multiplaticative notation)

Parameters

elements (cell(1,*) of element) – Elements to compose

Returns

Composition of the given elements

Return type

element

composeN(self, x, n)

Computes the power of a given element by repeated squaring

Parameters
• x (element) – Monoid/group element

• n (integer) – Power; if this is not a group, we need n >= 0

Returns

The element x^n

Return type

element

isIdentity(self, x)

Tests if the given element is the identity

Parameters

x (element) – Monoid/Group element

Returns

True if x is the identity, false otherwise

Return type

logical

static lambda(header, eqvFun, sampleFun, composeFun, identity)

Constructs a monoid from function handles

Parameters
• header (char) – Header display string

• eqvFun (function_handle) – Handle implementing the eqv method

• sampleFun (function_handle) – Handle implementing the sample method

• composeFun (function_handle) – Handle implementing the compose method

• identity (element) – Identity element of this monoid

Returns

The constructed monoid

Return type

Monoid

## Group¶

class replab.Group

Bases: replab.Monoid

Describes a group

A group is a Monoid where each element has an inverse.

### Own members

automorphismGroup(self)

Returns the automorphism group of this group

commutator(self, x, y, startWithInverse)

Returns the commutator of two group elements

Parameters
• x (element) – First element

• y (element) – Second element

• startWithInverse (logical) – True if we compute x^-1 y^-1 x y, false if we compute x y x^-1 y^-1

Returns

Commutator

Return type

element

commutingMorphismsMorphism(self, target, morphisms)

Constructs a morphism from morphisms with commuting images

Parameters
Returns

The computed morphism

Return type

Morphism

composeFlat(self, array, letters)

Returns the composition of elements from an array picked according to the given indices/letters

Computes composeAll({array(letters(1)) ... array(letters(n))}) with the convention that

Parameters
• letters (integer(1,*)) – Letters composing word

• array (cell(1,*) of elements) – Elements to compose

Returns

The result of the composition

Return type

element

composeWithInverse(self, x, y)

Returns the composition of an element with the inverse of another element

Convenience method that can be overriden for speed optimizations

Parameters
• x (element) – First element

• y (element) – Second element

Returns

the result of x * y^-1 in multiplicative notation

Return type

element

innerAutomorphism(self, by)

Returns the inner automorphism given using conjugation by the given element

Parameters

by (element) – Conjugating element

Returns

Group automorphism (returns a FiniteMorphism if this group is finite)

Return type

Morphism

inverse(self, x)

Computes the inverse of an element

Given x, returns xInv such that

x xInv = identity

Example

>>> G = replab.S(3);
>>> g = [2 3 1];
>>> ginv = G.inverse(g);
>>> G.isIdentity(G.compose(g, ginv))
1

Parameters

x (element) – Group element to compute the inverse of

Returns

Inverse of x

Return type

element

isomorphismByFunctions(self, target, preimageElementFun, imageElementFun, torusMap)

Constructs a group isomorphism using preimage/image functions

Parameters
• target (replab.Group) – Target group

• preimageElementFun (function_handle) – Returns the source element for a target element

• imageElementFun (function_handle) – Returns the target element for a source element

• torusMap (integer(*,*) or [], optional) – Torus map used in the Morphism construction, default: []

Returns

Constructed isomorphism (returns a FiniteIsomorphism if this group is finite)

Return type

Isomorphism

static lambda(header, eqvFun, sampleFun, composeFun, identity, inverseFun)

Constructs a group from function handles

Parameters
• header (char) – Header display string

• eqvFun (function_handle) – Handle implementing the parent Domain.eqv method

• sampleFun (function_handle) – Handle implementing the parent Domain.sample method

• composeFun (function_handle) – Handle implementing the parent Monoid.compose method

• identity (element) – Identity element of this monoid

• inverseFun (function_handle) – Handle implementing the inverse method

Returns

The constructed group

Return type

replab.Group

leftConjugate(self, by, on)

Returns the left conjugate of a group element

Convenience method that can be overriden for speed optimizations

Parameters
• by (element) – Element conjugating

• on (element) – Element conjugated

Returns

left conjugate, i.e. by * on * by^-1 in multiplicative notation

Return type

element

morphismByFunction(self, target, imageElementFun, torusMap)

Constructs a group morphism using an image function

Parameters
• target (replab.Group) – Target group

• imageElementFun (function_handle) – Returns the target element for a source element

• torusMap (integer(*,*) or [], optional) – Torus map used in the Morphism construction, default: []

## CompactGroup¶

class replab.CompactGroup

Bases: replab.Group

A group equipped with a Haar measure

### Own members

commutingRepsRep(self, field, dimension, reps)

Constructs a representation from commuting representations

Parameters
• field ({'R', 'C'}) – Field

• dimension (integer) – Dimension of the representation

• reps (cell(1,*) of Rep) – Commuting representations with the given field and dimension

Returns

A representation computed from the product of representations

Return type

replab.Rep

directPower(self, n)

Returns the direct product of this group with itself a number of times

Parameters

n (integer) – Number of copies

Returns

The direct product self x ...(n times)... x self

The return type is specialized as in directProduct.

Return type

DirectProductGroup

directProduct(varargin)

Returns the direct product of groups

Example

>>> S3 = replab.S(3);
>>> G = S3.directProduct(S3, S3);
>>> G.order
216

Parameters

varargin – Variable number of arguments of type CompactGroup

Returns

The direct product group

If all groups are of type FiniteGroup, the return type FiniteGroup as well.

Return type

DirectProductGroup

directSumRep(self, field, reps)

Computes the direct sum of representations on this group

Parameters
• field ({'R', 'C'}) – Field

• reps (cell(1,*) of Rep) – Representation of this group over the given field

Returns

Direct sum of the representations

Return type

Rep

hasReconstruction(self)

Returns whether the group has a “reconstruction”

Returns

True if the call to reconstruction would succeed

Return type

logical

static lambda(header, eqvFun, sampleFun, composeFun, identity, inverseFun)

Constructs a compact group from function handles

Parameters
• header (char) – Header display string

• eqvFun (function_handle) – Handle implementing the eqv method

• sampleFun (function_handle) – Handle implementing the sample method

• composeFun (function_handle) – Handle implementing the compose method

• identity (element) – Identity element of this monoid

• inverseFun (function_handle) – Handle implementing the inverse method

Returns

The constructed compact group

Return type

replab.CompactGroup

maximalTorusDimension(self)

Returns, if available, the dimension of the maximal torus contained in the connected component of this group

Returns

Maximal torus dimension if available, or [] if no reconstruction is available

Return type

integer or []

reconstruction(self)

Returns a reconstruction of the group used to speed up group averaging

When G is a compact Lie group, we consider the chain of subgroups G >= G0 >= T, where:

• G0 is the connected component of the group around the identity; we also know that the number of left cosets of G0 in G is finite; see the group of components, or, for example: https://mathoverflow.net/questions/378160/improved-classification-of-compact-lie-groups .

We write R a (finite) set of left coset representatives. Thus any element g of G can be written g = r g0 where r \in R and g0 \in G0.

• G0 contains a maximal torus T.

To average over the action of a representation rho of G on x, we write x1 = \int_G d\mu(g) \rho(g) x.

However, this is equivalent to x1 = 1/|R| \sum_{r \in R} \int_G0 d\mu(g) \rho(g) x.

We finally write x1 = 1/{R} \sum_{r \in R} \int_G0 d\mu(g) \rho(g) \int_T d\mu(t) \rho(t) x; again, the fact that we integrate first over the maximal torus subgroup does not affect the result. However, integration over the maximal torus can often be done very quickly, and the reconstruction speeds up the computation of various equivariant subspaces dramatically.

This method returns R as a SetProduct, and T as a Morphism from T to G.

semidirectProduct(self, N, phi)

Describes an external semidirect product of groups

See the construction in https://en.wikipedia.org/wiki/Semidirect_product

Let H = self be a group, N a group.

The semidirect product is defined using a homomorphism

 phi: H -> Aut(N) 

which we write here in uncurried form:

phi: H x N -> N , n1 = phi(h, n).

We describe this homomorphism by a function handle with parameters of type H x N, which returns an element of type N.

We write each semidirect group element as a cell array of two elements {h, n}.

The basic law of a semidirect product construction is the following. Let h \in H, n \in N, h1 = {h, N.identity}, n1 = {H.identity, n}. Then phi(h, n) == h1 n1 h1^-1.

The type of the return value depends on the most refined type at the intersection of the type of self and N, with possible types CompactGroup/FiniteGroup.

Parameters
• N (CompactGroup) – Group acted upon

• phi (function_handle) – Function describing a homomorphism as described above

Returns

Semidirect product group

Return type

SemidirectProductGroup

tensorRep(self, field, reps)

Computes the tensor product of representations

Parameters

reps (cell(1,*) of Rep) – Representation of the same group over the same field

Returns

Tensor product of the representations

Return type

Rep

trivialRep(self, field, dimension)

Returns the trivial representation of this group on a finite dimensional vector space

For convenience, either the representation can act on a real or complex vector space, and multiple copies of the 1-dimensional trivial representation can be included, when dimension > 1.

Parameters
• field ({'R', 'C'}) – Whether the representation is real (R) or complex (C)

• dimension (integer, optional) – Representation dimension Default value 1

Returns

An instance of the trivial representation

Return type

Rep

## AutomorphismGroup¶

class replab.AutomorphismGroup(object)

Bases: replab.Group

Describes the automorphism group of a group

### Own members

object

Group

Type

Group

## Action¶

class replab.Action

Bases: replab.Obj

A group action describing the action of a group on a set

Elements of the group G act upon elements of type P.

### Own members

G

Group acting

Type

Group

P

Set acted upon

Type

Domain

Constructs an action from a function handle

Parameters
Returns

The action

Return type

Action

leftAction(self, g, p)

Computes the left action of a group element on a set element

Returns the left action, often denoted by p1 = g(p) of G over P, which is compatible with group composition as in:

 p2 = g(h(p)) = (g compose h)(p) 

Parameters
Returns

Result of the left action

Return type

element of P

rightAction(self, p, g)

Computes the right action of a group element on a set element

Returns the right action, often denoted p1 = p^g, compatible with the group composition as in

p2 = (p^g)^h = p^(g compose h)

Parameters
Returns

Result of the right action

Return type

element of P