Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FLINT_jll #1568

Merged
merged 5 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ version = "0.43.3"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Antic_jll = "e21ec000-9f72-519e-ba6d-10061e575a27"
Arb_jll = "d9960996-1013-53c9-9ba4-74a4155039c3"
Calcium_jll = "fcfa6d1b-d8ce-59d5-8c0a-c0d7f69e4f40"
FLINT_jll = "e134572f-a0d5-539d-bddf-3cad8db41a82"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand All @@ -17,10 +14,7 @@ SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[compat]
AbstractAlgebra = "0.40.8"
Antic_jll = "~0.201.500"
Arb_jll = "~200.2300.000"
Calcium_jll = "~0.401.100"
FLINT_jll = "^200.900.006"
FLINT_jll = "^300.100.100"
Libdl = "1.6"
LinearAlgebra = "1.6"
Pkg = "1.6"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ The official Nemo repository is at:

Nemo currently provides:

* Wrappers of MPIR, Flint, Arb and Antic
* Wrappers of [FLINT](https://flintlib.org/) (now also containing the previous projects Arb and Antic)
* Generic polynomial rings, matrix spaces, fraction fields, residue rings, power series
* finite fields, p-adics, integers, rationals, permutations and characters, number fields
12 changes: 3 additions & 9 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,13 @@ julia> @time divexact((u*exp(x*u)), (exp(u)-1));

## Building dependencies from source

Nemo depends on various C libraries which are installed using binaries by default.
With julia version >= 1.3, the use of these binaries can be overridden by putting the following into the file `~/.julia/artifacts/Overrides.toml`:
Nemo depends on the FLINT C library which is installed using binaries by
default. With Julia version >= 1.3, the use of this binary can be overridden by
putting the following into the file `~/.julia/artifacts/Overrides.toml`:
```toml
[e134572f-a0d5-539d-bddf-3cad8db41a82]
FLINT = "/prefix/for/libflint"

[d9960996-1013-53c9-9ba4-74a4155039c3]
Arb = "/prefix/for/libarb"

[e21ec000-9f72-519e-ba6d-10061e575a27]
Antic = "/prefix/for/libantic"
```
(If only a specific library should be overridden, only the specific entry should be added.)

## Experimental threading support for flint

Expand Down
36 changes: 18 additions & 18 deletions src/HeckeMoreStuff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
end

function mul!(z::AcbFieldElem, x::AcbFieldElem, y::ArbFieldElem)
ccall((:acb_mul_arb, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{ArbFieldElem}, Int),
ccall((:acb_mul_arb, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{ArbFieldElem}, Int),

Check warning on line 97 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L97

Added line #L97 was not covered by tests
z, x, y, parent(z).prec)
return z
end
Expand Down Expand Up @@ -350,7 +350,7 @@

function Base.:(^)(a::AbsSimpleNumFieldElem, e::UInt)
b = parent(a)()
ccall((:nf_elem_pow, libantic), Nothing,
ccall((:nf_elem_pow, libflint), Nothing,

Check warning on line 353 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L353

Added line #L353 was not covered by tests
(Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, UInt, Ref{AbsSimpleNumField}),
b, a, e, parent(a))
return b
Expand Down Expand Up @@ -416,7 +416,7 @@
end

function bits(x::ArbFieldElem)
return ccall((:arb_bits, libarb), Int, (Ref{ArbFieldElem},), x)
return ccall((:arb_bits, libflint), Int, (Ref{ArbFieldElem},), x)

Check warning on line 419 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L419

Added line #L419 was not covered by tests
end

function *(a::ZZMatrix, b::Matrix{BigFloat})
Expand Down Expand Up @@ -498,7 +498,7 @@
#Assuming that the denominator of a is one, reduces all the coefficients modulo p
# non-symmetric (positive) residue system
function mod!(a::AbsSimpleNumFieldElem, b::ZZRingElem)
ccall((:nf_elem_mod_fmpz, libantic), Nothing,
ccall((:nf_elem_mod_fmpz, libflint), Nothing,

Check warning on line 501 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L501

Added line #L501 was not covered by tests
(Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}),
a, a, b, parent(a))
return a
Expand All @@ -514,15 +514,15 @@
function numerator(a::AbsSimpleNumFieldElem)
_one = one(ZZ)
z = deepcopy(a)
ccall((:nf_elem_set_den, libantic), Nothing,
ccall((:nf_elem_set_den, libflint), Nothing,

Check warning on line 517 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L517

Added line #L517 was not covered by tests
(Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}),
z, _one, a.parent)
return z
end

function one!(r::AbsSimpleNumFieldElem)
a = parent(r)
ccall((:nf_elem_one, libantic), Nothing,
ccall((:nf_elem_one, libflint), Nothing,

Check warning on line 525 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L525

Added line #L525 was not covered by tests
(Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a)
return r
end
Expand All @@ -537,14 +537,14 @@
end

function divexact!(z::AbsSimpleNumFieldElem, x::AbsSimpleNumFieldElem, y::ZZRingElem)
ccall((:nf_elem_scalar_div_fmpz, libantic), Nothing,
ccall((:nf_elem_scalar_div_fmpz, libflint), Nothing,

Check warning on line 540 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L540

Added line #L540 was not covered by tests
(Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}),
z, x, y, parent(x))
return z
end

function sub!(a::AbsSimpleNumFieldElem, b::AbsSimpleNumFieldElem, c::AbsSimpleNumFieldElem)
ccall((:nf_elem_sub, libantic), Nothing,
ccall((:nf_elem_sub, libflint), Nothing,

Check warning on line 547 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L547

Added line #L547 was not covered by tests
(Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}),
a, b, c, a.parent)
end
Expand Down Expand Up @@ -684,31 +684,31 @@
end

function round!(z::ArbFieldElem, x::ArbFieldElem, p::Int)
ccall((:arb_set_round, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, p)
ccall((:arb_set_round, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, p)

Check warning on line 687 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L687

Added line #L687 was not covered by tests
z.parent = ArbField(p, cached=false)
return z
end

function round!(z::AcbFieldElem, x::AcbFieldElem, p::Int)
ccall((:acb_set_round, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, p)
ccall((:acb_set_round, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, p)

Check warning on line 693 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L693

Added line #L693 was not covered by tests
z.parent = AcbField(p, cached=false)
return z
end

function round(x::ArbFieldElem, p::Int)
z = ArbField(p, cached=false)()
ccall((:arb_set_round, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, p)
ccall((:arb_set_round, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, p)

Check warning on line 700 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L700

Added line #L700 was not covered by tests
return z
end

function round(x::AcbFieldElem, p::Int)
z = AcbField(p, cached=false)()
ccall((:acb_set_round, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, p)
ccall((:acb_set_round, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, p)

Check warning on line 706 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L706

Added line #L706 was not covered by tests
return z
end

function bits(x::AcbFieldElem)
return ccall((:acb_bits, libarb), Int, (Ref{AcbFieldElem},), x)
return ccall((:acb_bits, libflint), Int, (Ref{AcbFieldElem},), x)

Check warning on line 711 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L711

Added line #L711 was not covered by tests
end

function Base.Int128(x::ZZRingElem)
Expand Down Expand Up @@ -1455,7 +1455,7 @@


function mod_sym!(a::AbsSimpleNumFieldElem, b::ZZRingElem)
ccall((:nf_elem_smod_fmpz, libantic), Nothing,
ccall((:nf_elem_smod_fmpz, libflint), Nothing,

Check warning on line 1458 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L1458

Added line #L1458 was not covered by tests
(Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}),
a, a, b, parent(a))
return a
Expand Down Expand Up @@ -1544,7 +1544,7 @@


function nf_elem_to_fmpz_mod_poly!(r::ZZModPolyRingElem, a::AbsSimpleNumFieldElem, useden::Bool=true)
ccall((:nf_elem_get_fmpz_mod_poly_den, libantic), Nothing,
ccall((:nf_elem_get_fmpz_mod_poly_den, libflint), Nothing,

Check warning on line 1547 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L1547

Added line #L1547 was not covered by tests
(Ref{ZZModPolyRingElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}, Cint, Ref{fmpz_mod_ctx_struct}),
r, a, a.parent, Cint(useden), r.parent.base_ring.ninv)
return nothing
Expand All @@ -1557,7 +1557,7 @@
end

function nf_elem_to_gfp_poly!(r::fpPolyRingElem, a::AbsSimpleNumFieldElem, useden::Bool=true)
ccall((:nf_elem_get_nmod_poly_den, libantic), Nothing,
ccall((:nf_elem_get_nmod_poly_den, libflint), Nothing,

Check warning on line 1560 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L1560

Added line #L1560 was not covered by tests
(Ref{fpPolyRingElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}, Cint),
r, a, a.parent, Cint(useden))
return nothing
Expand All @@ -1570,7 +1570,7 @@
end

function nf_elem_to_nmod_poly!(r::zzModPolyRingElem, a::AbsSimpleNumFieldElem, useden::Bool=true)
ccall((:nf_elem_get_nmod_poly_den, libantic), Nothing,
ccall((:nf_elem_get_nmod_poly_den, libflint), Nothing,

Check warning on line 1573 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L1573

Added line #L1573 was not covered by tests
(Ref{zzModPolyRingElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}, Cint),
r, a, a.parent, Cint(useden))
return nothing
Expand All @@ -1583,7 +1583,7 @@
end

function nf_elem_to_gfp_fmpz_poly!(r::FpPolyRingElem, a::AbsSimpleNumFieldElem, useden::Bool=true)
ccall((:nf_elem_get_fmpz_mod_poly_den, libantic), Nothing,
ccall((:nf_elem_get_fmpz_mod_poly_den, libflint), Nothing,

Check warning on line 1586 in src/HeckeMoreStuff.jl

View check run for this annotation

Codecov / codecov/patch

src/HeckeMoreStuff.jl#L1586

Added line #L1586 was not covered by tests
(Ref{FpPolyRingElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}, Cint, Ref{fmpz_mod_ctx_struct}),
r, a, a.parent, Cint(useden), r.parent.base_ring.ninv)
return nothing
Expand Down
16 changes: 0 additions & 16 deletions src/Nemo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,22 +212,6 @@ function flint_abort()
error("Problem in the Flint-Subsystem")
end

# check whether we are using flint version >= 3.0 (or some recent enough dev version),
# which changed the layout of some structs
_ptr = Libdl.dlopen(libflint)
if Libdl.dlsym(_ptr, :_fmpz_mod_vec_set_fmpz_vec_threaded; throw_error = false) !== nothing
const NEW_FLINT = true
const libantic = libflint
const libarb = libflint
const libcalcium = libflint
else
const NEW_FLINT = false
using Arb_jll: libarb
using Antic_jll: libantic
using Calcium_jll: libcalcium
end
Libdl.dlclose(_ptr)

################################################################################
#
# Debugging tools for allocation tracking
Expand Down
12 changes: 6 additions & 6 deletions src/antic/AnticTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ for some more specialized fields.
return get_cached!(AnticNumberFieldID, (parent(pol), pol, s), cached) do
nf = new()
nf.pol = pol
ccall((:nf_init, libantic), Nothing,
ccall((:nf_init, libflint), Nothing,
(Ref{AbsSimpleNumField}, Ref{QQPolyRingElem}), nf, pol)
finalizer(_AnticNumberField_clear_fn, nf)
nf.S = s
Expand All @@ -56,7 +56,7 @@ const AnticNumberFieldID = CacheDictType{Tuple{QQPolyRing, QQPolyRingElem, Symbo


function _AnticNumberField_clear_fn(a::AbsSimpleNumField)
ccall((:nf_clear, libantic), Nothing, (Ref{AbsSimpleNumField},), a)
ccall((:nf_clear, libflint), Nothing, (Ref{AbsSimpleNumField},), a)
end

"""
Expand All @@ -81,7 +81,7 @@ mutable struct AbsSimpleNumFieldElem <: SimpleNumFieldElem{QQFieldElem}

function AbsSimpleNumFieldElem(p::AbsSimpleNumField)
r = new()
ccall((:nf_elem_init, libantic), Nothing,
ccall((:nf_elem_init, libflint), Nothing,
(Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, p)
r.parent = p
finalizer(_nf_elem_clear_fn, r)
Expand All @@ -90,9 +90,9 @@ mutable struct AbsSimpleNumFieldElem <: SimpleNumFieldElem{QQFieldElem}

function AbsSimpleNumFieldElem(p::AbsSimpleNumField, a::AbsSimpleNumFieldElem)
r = new()
ccall((:nf_elem_init, libantic), Nothing,
ccall((:nf_elem_init, libflint), Nothing,
(Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, p)
ccall((:nf_elem_set, libantic), Nothing,
ccall((:nf_elem_set, libflint), Nothing,
(Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a, p)
r.parent = p
finalizer(_nf_elem_clear_fn, r)
Expand All @@ -101,6 +101,6 @@ mutable struct AbsSimpleNumFieldElem <: SimpleNumFieldElem{QQFieldElem}
end

function _nf_elem_clear_fn(a::AbsSimpleNumFieldElem)
ccall((:nf_elem_clear, libantic), Nothing,
ccall((:nf_elem_clear, libflint), Nothing,
(Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), a, a.parent)
end
Loading
Loading