Finite fields
AbstractAlgebra.jl provides a module, implemented in src/julia/GF.jl
for finite fields. The module is a naive implementation that supports only fields of degree $1$ (prime fields). They are modelled as $\mathbb{Z}/p\mathbb{Z}$ for $p$ a prime.
Types and parent objects
Finite fields have type GFField{T}
where T
is either Int
or BigInt
.
Elements of such a finite field have type gfelem{T}
.
Finite field constructors
In order to construct finite fields in AbstractAlgebra.jl, one must first construct the field itself. This is accomplished with the following constructors.
AbstractAlgebra.GF
— Method.GF{T <: Integer}(p::T)
Return the finite field $\mathbb{F}_p$, where $p$ is a prime. The integer $p$ is not checked for primality, but the behaviour of the resulting object is undefined if $p$ is composite.
Here are some examples of creating a finite field and making use of the resulting parent object to coerce various elements into the field.
Examples
F = GF(13)
g = F(3)
h = F(g)
Basic field functionality
The finite field module in AbstractAlgebra.jl implements the full Field interface.
We give some examples of such functionality.
Examples
F = GF(13)
h = zero(F)
k = one(F)
isone(k) == true
iszero(f) == false
U = base_ring(F)
V = base_ring(h)
T = parent(h)
h == deepcopy(h)
h = h + 2
m = inv(k)
Basic manipulation of fields and elements
AbstractAlgebra.Generic.gen
— Method.gen{T <: Integer}(a::GFField{T})
Return a generator of the field. Currently this returns 1.
AbstractAlgebra.Generic.order
— Method.order(R::GFField)
Return the order, i.e. the number of element in, the given finite field.
AbstractAlgebra.Generic.degree
— Method.degree(R::GFField)
Return the degree of the given finite field.
Examples
F = GF(13)
d = degree(F)
n = order(F)
g = gen(F)