Skip to content

Elements

Elements in a finitely generated abelian group are of type FinGenAbGroupElem 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.
julia
gens(G::FinGenAbGroup) -> Vector{FinGenAbGroupElem}

The sequence of generators of G.

source


# FinGenAbGroupMethod.
julia
(A::FinGenAbGroup)(x::Vector{ZZRingElem}) -> FinGenAbGroupElem

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.

source


# FinGenAbGroupMethod.
julia
(A::FinGenAbGroup)(x::ZZMatrix) -> FinGenAbGroupElem

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.

source


# getindexMethod.
julia
getindex(A::FinGenAbGroup, i::Int) -> FinGenAbGroupElem

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

source


# randMethod.
julia
rand(G::FinGenAbGroup) -> FinGenAbGroupElem

Returns an element of G chosen uniformly at random.

source


# randMethod.
julia
rand(G::FinGenAbGroup, B::ZZRingElem) -> FinGenAbGroupElem

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

source


# parentMethod.
julia
parent(x::FinGenAbGroupElem) -> FinGenAbGroup

Returns the parent of x.

source


Access

# getindexMethod.
julia
getindex(x::FinGenAbGroupElem, i::Int) -> ZZRingElem

Returns the i-th component of the element x.

source


Predicates

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

Invariants

# orderMethod.
julia
order(A::FinGenAbGroupElem) -> ZZRingElem

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

source


Iterator

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

julia

julia> G = abelian_group(ZZRingElem[1 2; 3 4])
Finitely generated abelian group
  with 2 generators and 2 relations and relation matrix
  [1   2]
  [3   4]

julia> for g = G
         println(g)
       end
Abelian group element [0, 0]
Abelian group element [0, 1]