Elements

Elements in a finitely generated abelian group are of type GrpAbFinGenElem and are always given as a linear combination of the generators. Internally this representation is normliased to have a unique representative.

Creation

In addition to the standard function id, zero and one that can be used to create the neutral element, we also support more targeted creation:

gensMethod
gens(G::GrpAbFinGen) -> Vector{GrpAbFinGenElem}

The sequence of generators of $G$.

GrpAbFinGenMethod
(A::GrpAbFinGen)(x::Vector{ZZRingElem}) -> GrpAbFinGenElem

Given an array x of elements of type ZZRingElem of the same length as ngens($A$), this function returns the element of $A$ with components x.

GrpAbFinGenMethod
(A::GrpAbFinGen)(x::ZZMatrix) -> GrpAbFinGenElem

Given a matrix over the integers with either $1$ row and ngens(A) columns or ngens(A) rows and $1$ column, this function returns the element of $A$ with components x.

getindexMethod
getindex(A::GrpAbFinGen, i::Int) -> GrpAbFinGenElem

Returns the element of $A$ with components $(0,\dotsc,0,1,0,\dotsc,0)$, where the $1$ is at the $i$-th position.

randMethod
rand(G::GrpAbFinGen) -> GrpAbFinGenElem

Returns an element of $G$ chosen uniformly at random.

randMethod
rand(G::GrpAbFinGen, B::ZZRingElem) -> GrpAbFinGenElem

For a (potentially infinite) abelian group $G$, return an element chosen uniformly at random with coefficients bounded by $B$.

parentMethod
parent(x::GrpAbFinGenElem) -> GrpAbFinGen

Returns the parent of $x$.

Access

getindexMethod
getindex(x::GrpAbFinGenElem, i::Int) -> ZZRingElem

Returns the $i$-th component of the element $x$.

Predicates

We have the standard predicates iszero, isone and is_identity to test an element for being trivial.

Invariants

orderMethod
order(A::GrpAbFinGenElem) -> ZZRingElem

Returns the order of $A$. It is assumed that the order is finite.

Iterator

One can iterate over the elements of a finite abelian group.


julia> G = abelian_group(ZZRingElem[1 2; 3 4])(General) abelian group with relation matrix [1 2; 3 4]
julia> for g = G println(g) endElement of (General) abelian group with relation matrix [1 2; 3 4] with structure of GrpAb: Z/2 with components [0 0] Element of (General) abelian group with relation matrix [1 2; 3 4] with structure of GrpAb: Z/2 with components [0 1]