Group elements

GroupsCore defines abstract types GroupElement <: MonoidElement, which all implementations of group/monoid elements should subtype.

Obligatory methods

Base.parentMethod
parent(g::MonoidElement)

Return the parent object of the group element.

source
Base.:==Method
==(g::El, h::El) where {El <: MonoidElement}

Return the best effort equality for monoid elements.

If ==(g, h) returns truethen the mathematical equalityg == hholds. However==(g, h)may returnfalseeven ifgandh` represent mathematically equal group elements.

For example, in a finitely presented group, == may return the equality of words.

Note

This function may not return due to unsolvable word problem.

source
GroupsCore.isfiniteorderMethod
isfiniteorder(m::MonoidElement)

Return true if m is of finite order, possibly without computing it.

Note

If finiteness of a group or monoid can be decided based on its type there is no need to extend isfiniteorder for its elements.

source

As well as the two arithmetic operations:

Base.:(*)(::El, ::El) where {El <: MonoidElement}
Base.inv(::GroupElement)

A note on deepcopy

The elements which are not of isbitstype should extend

Base.deepcopy_internal(g::MonoidElement, ::IdDict)

according to Base.deepcopy docstring. Due to our assumption on parents of group/monoid elements (acting as local singleton objects), a monoid element and its deepcopy should have identical (i.e. ===) parents.

Implemented methods

Using the obligatory methods we implement the rest of the functions in GroupsCore. For starters, the first of these are:

Base.one(::MonoidElement)
Base.:(/)(::El, ::El) where {El <: GroupElement}

and

GroupsCore.orderMethod
order(m::MonoidElement)
order(::Type{T}, m::MonoidElement) where T

Return the order of m as an instance of T. If m is of infinite order GroupsCore.InfiniteOrder exception will be thrown.

Warning

Only arbitrary sized integers are required to return a mathematicaly correct answer.

source
Base.conjFunction
conj(g::El, h::El) where {El <: GroupElement}

Return the conjugation of g by h, i.e. inv(h)*g*h.

source
GroupsCore.commutatorFunction
commutator(g::El, h::El, k::El...) where {El <: GroupElement}

Return the left associative iterated commutator $[[g, h], ...]$, where $[g, h] = g^{-1} h^{-1} g h$.

source

Moreover we provide basic implementation which could be altered for performance reasons:

Base.:(^)(g::MonoidElement, n::Integer)
Groups.Core.order([::Type{T}], g::MonoidElement) where T
Base.hash(::MonoidElement, ::UInt)

Mutable API

Warning

Work-in-progress. Mutable API is considered private and hence may change between versions without warning.

For the purpose of mutable arithmetic the following methods may be overloaded to provide more tailored versions for a given type and reduce the allocations. These functions should be used when writing libraries, in performance critical sections. However one should only use the returned value and there are no guarantees on in-place modifications actually happening.

All of these functions (possibly) alter only the first argument, and must unalias their arguments when necessary.

GroupsCore.inv!Function
inv!(out::El, g::El) where {El <: GroupElement}

Return inv(g), possibly modifying out. Aliasing of g with out is allowed.

source
GroupsCore.mul!Function
mul!(out::El, g::El, h::El) where {El <: MonoidElement}

Return g*h, possibly modifying out. Aliasing of g or h with out is allowed.

source
GroupsCore.div_left!Function
div_left!(out::El, g::El, h::El) where {El <: GroupElement}

Return inv(h)*g, possibly modifying out. Aliasing of g or h with out is allowed.

source
GroupsCore.div_right!Function
div_right!(out::El, g::El, h::El) where {El <: GroupElement}

Return g*inv(h), possibly modifying out. Aliasing of g or h with out is allowed.

source
GroupsCore.conj!Function
conj!(out::El, g::El, h::El) where {El <: GroupElement}

Return inv(h)*g*h, possibly modifying out. Aliasing of g or h with out is allowed.

source
GroupsCore.commutator!Function
commutator!(out::El, g::El, h::El) where {El <: GroupElement}

Return inv(g)*inv(h)*g*h, possibly modifying out. Aliasing of g or h with out is allowed.

source