The default integer type in Singular.jl is the Singular
n_Z integer type.
The associated ring of integers is represented by the constant parent object which can be constructed by a call to
For convenience we define
ZZ = Singular.Integers()
so that integers can be constructed using
ZZ. Note that this is the name of a specific parent object, not the name of its type.
The types of the integer ring parent objects and elements of the associated rings of integers are given in the following table according to the library providing them.
|Library||Element type||Parent type|
All integer element types belong directly to the abstract type
RingElem and all the integer ring parent object types belong to the abstract type
Singular.jl provides all the ring and possibly some parts of the Euclidean ring functionality of AbstractAlgebra.jl.
Below, we describe the functionality that is specific to the Singular integer ring.
Coerce a Julia integer value into the integer ring.
Return the denominator of $n$ (which will always be $1$).
Return the numerator of $n$ (which is $n$ itself).
julia> a = ZZ(-12) -12 julia> is_unit(a) false julia> n = numerator(a) -12 julia> d = denominator(a) 1 julia> c = abs(a) 12
Singular.jl provides a number of Euclidean division operations. Recall that for a dividend $a$ and divisor $b$, we can write $a = bq + r$ with $0 \leq |r| < |b|$. We call $q$ the quotient and $r$ the remainder.
In the following table we list the division functions and their rounding behaviour. We also give the return value of the function, with $q$ representing return of the quotient and $r$ representing return of the remainder.
|q, r||towards zero|
julia> a = ZZ(-12) -12 julia> b = ZZ(5) 5 julia> q, r = divrem(a, b) (-2, -2) julia> r = mod(a, b) 3 julia> c = a % b -2
Here is a list of the comparison functions implemented, with the understanding that
isless provides all the usual comparison operators.
We also provide the following ad hoc comparisons which again provide all of the comparison operators mentioned above.
julia> a = ZZ(12) 12 julia> b = ZZ(3) 3 julia> a < b false julia> a != b true julia> a > 4 true julia> 5 <= b false