CurrentModule = Nemo
DocTestSetup = quote
using Nemo
end
Nemo allows the creation of fraction fields over any ring
In order to make the representation
The canonical_unit
function is defined for elements of every Nemo ring. It
must have the properties
canonical_unit(u) == u
canonical_unit(a*b) == canonical_unit(a)*canonical_unit(b)
for any unit
For example, the canonical unit of an integer is its sign. Thus a fraction of integers always has positive denominator after canonicalisation.
The canonical unit of a polynomial is the canonical unit of its leading coefficient, etc.
There are two different kinds of implementation of fraction fields in Nemo: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of fractions over specific rings, usually provided by C/C++ libraries.
The following table shows each of the fraction types available in Nemo, the
base ring
Base ring | Library | Element type | Parent type |
---|---|---|---|
Generic ring |
AbstractAlgebra.jl | Generic.FracFieldElem{T} |
Generic.FracField{T} |
Flint | QQFieldElem |
QQField |
All fraction element types belong to the abstract type FracElem
and all of
the fraction field types belong to the abstract type FracField
. This enables
one to write generic functions that can accept any Nemo fraction type.
All fraction types in Nemo provide functionality for fields described in AbstractAlgebra.jl:
https://nemocas.github.io/AbstractAlgebra.jl/stable/field
In addition all the fraction field functionality of AbstractAlgebra.jl is provided, along with generic fractions fields as described here:
https://nemocas.github.io/AbstractAlgebra.jl/stable/fraction
sign(::QQFieldElem)
height(::QQFieldElem)
height_bits(::QQFieldElem)
<<(::QQFieldElem, ::Int)
>>(::QQFieldElem, ::Int)
floor(::QQFieldElem)
ceil(::QQFieldElem)
Examples
julia> d = abs(ZZ(11)//3)
11//3
julia> 4 <= ZZ(7)//ZZ(3)
false
The following functions are available for rationals.
mod(a::QQFieldElem, b::ZZRingElem)
Rational reconstruction is available for rational numbers.
reconstruct(::ZZRingElem, ::ZZRingElem)
reconstruct(::ZZRingElem, ::ZZRingElem, ::ZZRingElem, ::ZZRingElem)
Various methods exist to enumerate rationals.
next_minimal(::QQFieldElem)
next_signed_minimal(::QQFieldElem)
next_calkin_wilf(::QQFieldElem)
next_signed_calkin_wilf(::QQFieldElem)
rand_bits(::QQField, b::Int)
The following special functions are available for specific rings in Nemo.
harmonic(::Int)
bernoulli(::Int)
bernoulli_cache(::Int)
dedekind_sum(::ZZRingElem, ::ZZRingElem)
simplest_between(::QQFieldElem, ::QQFieldElem)