Nemo is a library for fast basic arithmetic in various commonly used rings, for the Julia programming language. Our aim is to provide a highly performant package covering
Commutative Algebra
Number Theory
Group Theory
Nemo consists of wrappers of specialised C/C++ libraries:
Julia is a sophisticated, modern programming language which is designed to be both performant and flexible. It was written by mathematicians, for mathematicians.
The benefits of Julia include
Familiar imperative syntax
JIT compilation (provides near native performance, even for highly generic code)
REPL console (cuts down on development time)
Parametric types (allows for fast generic constructions over other data types)
Powerful metaprogramming facilities
Operator overloading
Multiple dispatch (dispatch on every argument of a function)
Efficient native C interface (little or no wrapper overhead)
Experimental C++ interface
Dynamic type inference
Built-in bignums
Able to be embedded in C programs
High performance collection types (dictionaries, iterators, arrays, etc.)
Jupyter support (for web based notebooks)
The main benefits for Nemo are the parametric type system and JIT compilation. The former allows us to model many mathematical types, e.g. generic polynomial rings over an arbitrary base ring. The latter speeds up the runtime performance, even of highly generic mathematical procedures.
Settings
This document was generated with Documenter.jl version 0.27.25 on Thursday 13 July 2023. Using Julia version 1.9.2.
Nemo is a library for fast basic arithmetic in various commonly used rings, for the Julia programming language. Our aim is to provide a highly performant package covering
Commutative Algebra
Number Theory
Group Theory
Nemo consists of wrappers of specialised C/C++ libraries:
Julia is a sophisticated, modern programming language which is designed to be both performant and flexible. It was written by mathematicians, for mathematicians.
The benefits of Julia include
Familiar imperative syntax
JIT compilation (provides near native performance, even for highly generic code)
REPL console (cuts down on development time)
Parametric types (allows for fast generic constructions over other data types)
Powerful metaprogramming facilities
Operator overloading
Multiple dispatch (dispatch on every argument of a function)
Efficient native C interface (little or no wrapper overhead)
Experimental C++ interface
Dynamic type inference
Built-in bignums
Able to be embedded in C programs
High performance collection types (dictionaries, iterators, arrays, etc.)
Jupyter support (for web based notebooks)
The main benefits for Nemo are the parametric type system and JIT compilation. The former allows us to model many mathematical types, e.g. generic polynomial rings over an arbitrary base ring. The latter speeds up the runtime performance, even of highly generic mathematical procedures.
Settings
This document was generated with Documenter.jl version 0.27.25 on Friday 14 July 2023. Using Julia version 1.9.2.
Note that whilst one can coerce double precision floating point values into an Arb complex field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.
If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb complex field.
If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.
Note that whilst one can coerce double precision floating point values into an Arb complex field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.
If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb complex field.
If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.
julia> CC = AcbField(64)
Complex Field with 64 bits of precision and error bounds
julia> c = onei(CC)
@@ -42,7 +42,7 @@
nan
julia> g = CC(RR(3))
-3.0000000000000000000
In addition to the above, developers of custom complex field types must ensure that they provide the equivalent of the function base_ring(R::AcbField) which should return Union{}. In addition to this they should ensure that each complex field element contains a field parent specifying the parent object of the complex field element, or at least supply the equivalent of the function parent(a::acb) to return the parent object of a complex field element.
In addition to the above, developers of custom complex field types must ensure that they provide the equivalent of the function base_ring(R::AcbField) which should return Union{}. In addition to this they should ensure that each complex field element contains a field parent specifying the parent object of the complex field element, or at least supply the equivalent of the function parent(a::acb) to return the parent object of a complex field element.
julia> CC = AcbField(64)
Complex Field with 64 bits of precision and error bounds
julia> a = CC("1.2 +/- 0.001")
@@ -68,7 +68,7 @@
julia> f = accuracy_bits(a)
9
-
It is often necessary to determine whether a given exact value or box is contained in a given complex box or whether two boxes overlap. The following functions are provided for this purpose.
It is often necessary to determine whether a given exact value or box is contained in a given complex box or whether two boxes overlap. The following functions are provided for this purpose.
julia> CC = AcbField(64)
Complex Field with 64 bits of precision and error bounds
julia> x = CC("1 +/- 0.001")
@@ -90,7 +90,7 @@
false
julia> contains_zero(x)
-false
Nemo provides a full range of comparison operations for Arb complex boxes.
In addition to the standard comparisons, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.
A full range of ad hoc comparison operators is provided. These are implemented directly in Julia, but we document them as though only == were provided.
Nemo provides a full range of comparison operations for Arb complex boxes.
In addition to the standard comparisons, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.
A full range of ad hoc comparison operators is provided. These are implemented directly in Julia, but we document them as though only == were provided.
Function
==(x::acb, y::Integer)
==(x::Integer, y::acb)
==(x::acb, y::ZZRingElem)
==(x::ZZRingElem, y::acb)
==(x::arb, y::ZZRingElem)
==(x::ZZRingElem, y::arb)
==(x::acb, y::Float64)
==(x::Float64, y::acb)
Examples
julia> CC = AcbField(64)
Complex Field with 64 bits of precision and error bounds
julia> x = CC("1 +/- 0.001")
@@ -129,7 +129,7 @@
[-2.52e+7 +/- 4.26e+4]
julia> b = ldexp(x, -ZZ(15))
-[-9.16e-5 +/- 7.78e-8]
Return a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the box $x$ contains a unique integer. If this is the case, the second return value is set to this unique integer.
Return a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the box $x$ contains a unique integer. If this is the case, the second return value is set to this unique integer.
julia> CC = AcbField(200)
Complex Field with 200 bits of precision and error bounds
julia> a = const_pi(CC)
-[3.14159265358979323846264338327950288419716939937510582097494 +/- 5.73e-60]
Find a small linear combination of the entries of the array $A$ that is small (using LLL). The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find linear dependence between a list of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.
Find a (common) small linear combination of the entries in each row of the array $A$, that is small (using LLL). It is assumed that the complex numbers in each row of the array share the same linear combination. The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find a common linear dependence shared across a number of lists of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the common linear combination.
Find a small linear combination of the entries of the array $A$ that is small (using LLL). The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find linear dependence between a list of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.
Find a (common) small linear combination of the entries in each row of the array $A$, that is small (using LLL). It is assumed that the complex numbers in each row of the array share the same linear combination. The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find a common linear dependence shared across a number of lists of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the common linear combination.
CC = AcbField(128)
# These are two of the roots of x^5 + 3x + 1
a = CC(1.0050669478588622428791051888364775253, - 0.93725915669289182697903585868761513585)
@@ -181,4 +181,4 @@
# ...or from two
V2 = [CC(1), b, b^2, b^3, b^4, b^5];
Vs = [V1 V2]
-X = lindep(Vs, 20)
Settings
This document was generated with Documenter.jl version 0.27.25 on Thursday 13 July 2023. Using Julia version 1.9.2.