Skip to content

Elements

Elements

Elements in a finitely geenrated 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:

# gens — Method.

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

The sequence of generators of .

source

# GrpAbFinGen — Method.

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

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

source

# GrpAbFinGen — Method.

(A::GrpAbFinGen)(x::fmpz_mat) -> GrpAbFinGenElem

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

source

# getindex — Method.

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

Returns the element of with components , where the is at the -th position.

source

# rand — Method.

rand(G::GrpAbFinGen) -> GrpAbFinGenElem

Returns an element of chosen uniformly at random.

source

# rand — Method.

rand(G::GrpAbFinGen, B::fmpz) -> GrpAbFinGenElem

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

source

# parent — Method.

parent(x::GrpAbFinGenElem) -> GrpAbFinGen

Returns the parent of .

source

Access

# getindex — Method.

getindex(x::GrpAbFinGenElem, i::Int) -> fmpz

Returns the -th component of the element .

source

Predicates

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

Invariants

# order — Method.

order(A::GrpAbFinGenElem) -> fmpz

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

source

Iterator

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

julia> G = abelian_group(fmpz[1 2; 3 4])
(General) abelian group with relation matrix
[1 2; 3 4]

julia> for g = G
         println(g)
       end
Element 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]