From e76cdb3a9d4bb86fd27f601ca2645c155c7a486d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Sun, 5 May 2024 00:43:18 +0200 Subject: [PATCH] Update FLINT_jll (#1568) * Change FLINT dependency from 2.9 to 3.1 This includes: * Reduce size of fq_default_ctx_struct to match the synonymous gr_ctx_struct. * Adjust for FLINT 3.1 fq_nmod where ulongs are now encouraged within this module. * Adjust for FLINT 3.1 fmpz_mod_mat changes where context objects should be part of the argument. * Replace libantic, libarb, libcalcium by libflint * Return fq_nmod prime as fmpz * remove some old hack --- Project.toml | 8 +- README.md | 2 +- docs/src/index.md | 12 +- src/HeckeMoreStuff.jl | 36 +- src/Nemo.jl | 16 - src/antic/AnticTypes.jl | 12 +- src/antic/nf_elem.jl | 136 +++--- src/arb/ArbTypes.jl | 392 +++++++++--------- src/arb/Complex.jl | 334 +++++++-------- src/arb/ComplexMat.jl | 110 ++--- src/arb/ComplexPoly.jl | 124 +++--- src/arb/Real.jl | 344 +++++++-------- src/arb/RealMat.jl | 92 ++-- src/arb/RealPoly.jl | 102 ++--- src/arb/acb.jl | 330 +++++++-------- src/arb/acb_calc.jl | 14 +- src/arb/acb_mat.jl | 110 ++--- src/arb/acb_poly.jl | 120 +++--- src/arb/arb.jl | 350 ++++++++-------- src/arb/arb_mat.jl | 96 ++--- src/arb/arb_poly.jl | 98 ++--- src/calcium/CalciumTypes.jl | 16 +- src/calcium/ca.jl | 232 +++++------ src/calcium/qqbar.jl | 206 ++++----- src/flint/FlintTypes.jl | 360 +++++++--------- src/flint/fmpq.jl | 4 +- src/flint/fmpz.jl | 4 +- src/flint/fmpz_mod.jl | 8 + src/flint/fmpz_mod_mat.jl | 125 +++--- src/flint/fq_default.jl | 4 +- src/flint/fq_default_extended.jl | 29 +- src/flint/fq_default_mat.jl | 6 +- src/flint/fq_mat.jl | 8 +- src/flint/fq_nmod.jl | 8 +- src/flint/fq_nmod_mat.jl | 8 +- src/flint/gfp_fmpz_mat.jl | 74 ++-- src/gaussiannumbers/continued_fraction.jl | 2 +- test/arb/Real-test.jl | 4 +- test/arb/arb-test.jl | 4 +- .../continued_fraction-test.jl | 2 +- 40 files changed, 1963 insertions(+), 1979 deletions(-) diff --git a/Project.toml b/Project.toml index be27a1c69..fb4a5b268 100644 --- a/Project.toml +++ b/Project.toml @@ -4,9 +4,6 @@ version = "0.44.0" [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" @@ -17,10 +14,7 @@ SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce" [compat] AbstractAlgebra = "0.41.0" -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" diff --git a/README.md b/README.md index e6672bded..6974fc3c6 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/src/index.md b/docs/src/index.md index 53a83cf23..2f96bcf52 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -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 diff --git a/src/HeckeMoreStuff.jl b/src/HeckeMoreStuff.jl index c26c1a36d..f22eaaa4d 100644 --- a/src/HeckeMoreStuff.jl +++ b/src/HeckeMoreStuff.jl @@ -94,7 +94,7 @@ function _acb_mat(A::ArbMatrix) 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), z, x, y, parent(z).prec) return z end @@ -350,7 +350,7 @@ end function Base.:(^)(a::AbsSimpleNumFieldElem, e::UInt) b = parent(a)() - ccall((:nf_elem_pow, libantic), Nothing, + ccall((:nf_elem_pow, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, UInt, Ref{AbsSimpleNumField}), b, a, e, parent(a)) return b @@ -416,7 +416,7 @@ function (R::FqPolyRing)(g::QQPolyRingElem) end function bits(x::ArbFieldElem) - return ccall((:arb_bits, libarb), Int, (Ref{ArbFieldElem},), x) + return ccall((:arb_bits, libflint), Int, (Ref{ArbFieldElem},), x) end function *(a::ZZMatrix, b::Matrix{BigFloat}) @@ -498,7 +498,7 @@ end #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, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), a, a, b, parent(a)) return a @@ -514,7 +514,7 @@ This function returns $b$. function numerator(a::AbsSimpleNumFieldElem) _one = one(ZZ) z = deepcopy(a) - ccall((:nf_elem_set_den, libantic), Nothing, + ccall((:nf_elem_set_den, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), z, _one, a.parent) return z @@ -522,7 +522,7 @@ end function one!(r::AbsSimpleNumFieldElem) a = parent(r) - ccall((:nf_elem_one, libantic), Nothing, + ccall((:nf_elem_one, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a) return r end @@ -537,14 +537,14 @@ function zero(r::AbsSimpleNumFieldElem) 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, (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, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), a, b, c, a.parent) end @@ -684,31 +684,31 @@ function divexact!(a::ZZRingElem, b::ZZRingElem) 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) 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) 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) 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) 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) end function Base.Int128(x::ZZRingElem) @@ -1455,7 +1455,7 @@ Base.:(*)(x::QQFieldElem, y::AbstractAlgebra.Generic.MatSpaceElem{AbsSimpleNumFi function mod_sym!(a::AbsSimpleNumFieldElem, b::ZZRingElem) - ccall((:nf_elem_smod_fmpz, libantic), Nothing, + ccall((:nf_elem_smod_fmpz, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), a, a, b, parent(a)) return a @@ -1544,7 +1544,7 @@ is_cyclo_type(::NumField) = false 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, (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 @@ -1557,7 +1557,7 @@ function (R::ZZModPolyRing)(a::AbsSimpleNumFieldElem) 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, (Ref{fpPolyRingElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}, Cint), r, a, a.parent, Cint(useden)) return nothing @@ -1570,7 +1570,7 @@ function (R::fpPolyRing)(a::AbsSimpleNumFieldElem) 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, (Ref{zzModPolyRingElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}, Cint), r, a, a.parent, Cint(useden)) return nothing @@ -1583,7 +1583,7 @@ function (R::zzModPolyRing)(a::AbsSimpleNumFieldElem) 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, (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 diff --git a/src/Nemo.jl b/src/Nemo.jl index 9f0341a5f..8e1acf2a9 100644 --- a/src/Nemo.jl +++ b/src/Nemo.jl @@ -214,22 +214,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 diff --git a/src/antic/AnticTypes.jl b/src/antic/AnticTypes.jl index 5f29c1123..000d4cd8b 100644 --- a/src/antic/AnticTypes.jl +++ b/src/antic/AnticTypes.jl @@ -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 @@ -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 """ @@ -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) @@ -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) @@ -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 diff --git a/src/antic/nf_elem.jl b/src/antic/nf_elem.jl index 5a962bbd2..2ba2f84e1 100644 --- a/src/antic/nf_elem.jl +++ b/src/antic/nf_elem.jl @@ -90,14 +90,14 @@ constant coefficient. function coeff(x::AbsSimpleNumFieldElem, n::Int) n < 0 && throw(DomainError(n, "Index must be non-negative")) z = QQFieldElem() - ccall((:nf_elem_get_coeff_fmpq, libantic), Nothing, + ccall((:nf_elem_get_coeff_fmpq, libflint), Nothing, (Ref{QQFieldElem}, Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), z, x, n, parent(x)) return z end function num_coeff!(z::ZZRingElem, x::AbsSimpleNumFieldElem, n::Int) n < 0 && throw(DomainError(n, "Index must be non-negative")) - ccall((:nf_elem_get_coeff_fmpz, libantic), Nothing, + ccall((:nf_elem_get_coeff_fmpz, libflint), Nothing, (Ref{ZZRingElem}, Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), z, x, n, parent(x)) return z end @@ -110,21 +110,21 @@ defining polynomial. """ function gen(a::AbsSimpleNumField) r = AbsSimpleNumFieldElem(a) - ccall((:nf_elem_gen, libantic), Nothing, + ccall((:nf_elem_gen, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a) return r end function one(a::AbsSimpleNumField) r = AbsSimpleNumFieldElem(a) - ccall((:nf_elem_one, libantic), Nothing, + ccall((:nf_elem_one, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a) return r end function zero(a::AbsSimpleNumField) r = AbsSimpleNumFieldElem(a) - ccall((:nf_elem_zero, libantic), Nothing, + ccall((:nf_elem_zero, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a) return r end @@ -136,17 +136,17 @@ Return `true` if the given number field element is the generator of the number field, otherwise return `false`. """ function is_gen(a::AbsSimpleNumFieldElem) - return ccall((:nf_elem_is_gen, libantic), Bool, + return ccall((:nf_elem_is_gen, libflint), Bool, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), a, a.parent) end function isone(a::AbsSimpleNumFieldElem) - return ccall((:nf_elem_is_one, libantic), Bool, + return ccall((:nf_elem_is_one, libflint), Bool, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), a, a.parent) end function iszero(a::AbsSimpleNumFieldElem) - return ccall((:nf_elem_is_zero, libantic), Bool, + return ccall((:nf_elem_is_zero, libflint), Bool, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), a, a.parent) end @@ -165,7 +165,7 @@ Return `true` if the given number field element is an integer, i.e., in ZZ, othe return `false`. """ function isinteger(a::AbsSimpleNumFieldElem) - b = ccall((:nf_elem_is_integer, libantic), Cint, + b = ccall((:nf_elem_is_integer, libflint), Cint, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), a, a.parent) return Bool(b) end @@ -177,7 +177,7 @@ Return `true` if the given number field element is a rational number, i.e., in Q otherwise `false`. """ function is_rational(a::AbsSimpleNumFieldElem) - b = ccall((:nf_elem_is_rational, libantic), Cint, + b = ccall((:nf_elem_is_rational, libflint), Cint, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), a, a.parent) return Bool(b) end @@ -190,7 +190,7 @@ field element. """ function denominator(a::AbsSimpleNumFieldElem) z = ZZRingElem() - ccall((:nf_elem_get_den, libantic), Nothing, + ccall((:nf_elem_get_den, libflint), Nothing, (Ref{ZZRingElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), z, a, a.parent) return z @@ -200,14 +200,14 @@ function elem_from_mat_row(a::AbsSimpleNumField, b::ZZMatrix, i::Int, d::ZZRingE Generic._checkbounds(nrows(b), i) || throw(BoundsError()) ncols(b) == degree(a) || error("Wrong number of columns") z = a() - ccall((:nf_elem_set_fmpz_mat_row, libantic), Nothing, + ccall((:nf_elem_set_fmpz_mat_row, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{ZZMatrix}, Int, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), z, b, i - 1, d, a) return z end function elem_to_mat_row!(a::ZZMatrix, i::Int, d::ZZRingElem, b::AbsSimpleNumFieldElem) - ccall((:nf_elem_get_fmpz_mat_row, libantic), Nothing, + ccall((:nf_elem_get_fmpz_mat_row, libflint), Nothing, (Ref{ZZMatrix}, Int, Ref{ZZRingElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), a, i - 1, d, b, b.parent) nothing @@ -278,7 +278,7 @@ canonical_unit(x::AbsSimpleNumFieldElem) = x function -(a::AbsSimpleNumFieldElem) r = a.parent() - ccall((:nf_elem_neg, libantic), Nothing, + ccall((:nf_elem_neg, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a, a.parent) return r @@ -294,7 +294,7 @@ function +(a::AbsSimpleNumFieldElem, b::AbsSimpleNumFieldElem) parent(a) == parent(b) || return force_op(+, a, b)::AbsSimpleNumFieldElem check_parent(a, b) r = a.parent() - ccall((:nf_elem_add, libantic), Nothing, + ccall((:nf_elem_add, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -304,7 +304,7 @@ function -(a::AbsSimpleNumFieldElem, b::AbsSimpleNumFieldElem) parent(a) == parent(b) || return force_op(-, a, b)::AbsSimpleNumFieldElem check_parent(a, b) r = a.parent() - ccall((:nf_elem_sub, libantic), Nothing, + ccall((:nf_elem_sub, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -314,7 +314,7 @@ function *(a::AbsSimpleNumFieldElem, b::AbsSimpleNumFieldElem) parent(a) == parent(b) || return force_op(*, a, b)::AbsSimpleNumFieldElem check_parent(a, b) r = a.parent() - ccall((:nf_elem_mul, libantic), Nothing, + ccall((:nf_elem_mul, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -328,7 +328,7 @@ end function +(a::AbsSimpleNumFieldElem, b::Int) r = a.parent() - ccall((:nf_elem_add_si, libantic), Nothing, + ccall((:nf_elem_add_si, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -336,7 +336,7 @@ end function +(a::AbsSimpleNumFieldElem, b::ZZRingElem) r = a.parent() - ccall((:nf_elem_add_fmpz, libantic), Nothing, + ccall((:nf_elem_add_fmpz, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -344,7 +344,7 @@ end function +(a::AbsSimpleNumFieldElem, b::QQFieldElem) r = a.parent() - ccall((:nf_elem_add_fmpq, libantic), Nothing, + ccall((:nf_elem_add_fmpq, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{QQFieldElem}, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -352,7 +352,7 @@ end function -(a::AbsSimpleNumFieldElem, b::Int) r = a.parent() - ccall((:nf_elem_sub_si, libantic), Nothing, + ccall((:nf_elem_sub_si, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -360,7 +360,7 @@ end function -(a::AbsSimpleNumFieldElem, b::ZZRingElem) r = a.parent() - ccall((:nf_elem_sub_fmpz, libantic), Nothing, + ccall((:nf_elem_sub_fmpz, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -368,7 +368,7 @@ end function -(a::AbsSimpleNumFieldElem, b::QQFieldElem) r = a.parent() - ccall((:nf_elem_sub_fmpq, libantic), Nothing, + ccall((:nf_elem_sub_fmpq, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{QQFieldElem}, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -376,7 +376,7 @@ end function -(a::Int, b::AbsSimpleNumFieldElem) r = b.parent() - ccall((:nf_elem_si_sub, libantic), Nothing, + ccall((:nf_elem_si_sub, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a, b, b.parent) return r @@ -384,7 +384,7 @@ end function -(a::ZZRingElem, b::AbsSimpleNumFieldElem) r = b.parent() - ccall((:nf_elem_fmpz_sub, libantic), Nothing, + ccall((:nf_elem_fmpz_sub, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a, b, b.parent) return r @@ -392,7 +392,7 @@ end function -(a::QQFieldElem, b::AbsSimpleNumFieldElem) r = b.parent() - ccall((:nf_elem_fmpq_sub, libantic), Nothing, + ccall((:nf_elem_fmpq_sub, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{QQFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a, b, b.parent) return r @@ -418,7 +418,7 @@ end function *(a::AbsSimpleNumFieldElem, b::Int) r = a.parent() - ccall((:nf_elem_scalar_mul_si, libantic), Nothing, + ccall((:nf_elem_scalar_mul_si, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -426,7 +426,7 @@ end function *(a::AbsSimpleNumFieldElem, b::ZZRingElem) r = a.parent() - ccall((:nf_elem_scalar_mul_fmpz, libantic), Nothing, + ccall((:nf_elem_scalar_mul_fmpz, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -434,7 +434,7 @@ end function *(a::AbsSimpleNumFieldElem, b::QQFieldElem) r = a.parent() - ccall((:nf_elem_scalar_mul_fmpq, libantic), Nothing, + ccall((:nf_elem_scalar_mul_fmpq, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{QQFieldElem}, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -480,7 +480,7 @@ end function ^(a::AbsSimpleNumFieldElem, n::Int) r = a.parent() - ccall((:nf_elem_pow, libantic), Nothing, + ccall((:nf_elem_pow, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), r, a, abs(n), a.parent) if n < 0 @@ -498,7 +498,7 @@ end function ==(a::AbsSimpleNumFieldElem, b::AbsSimpleNumFieldElem) parent(a) == parent(b) || return force_op(==, a, b)::Bool check_parent(a, b) - return ccall((:nf_elem_equal, libantic), Bool, + return ccall((:nf_elem_equal, libflint), Bool, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), a, b, a.parent) end @@ -509,28 +509,28 @@ end ############################################################################### function ==(a::AbsSimpleNumFieldElem, b::ZZRingElem) - b = ccall((:nf_elem_equal_fmpz, libantic), Cint, + b = ccall((:nf_elem_equal_fmpz, libflint), Cint, (Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), a, b, a.parent) return Bool(b) end function ==(a::AbsSimpleNumFieldElem, b::QQFieldElem) - b = ccall((:nf_elem_equal_fmpq, libantic), Cint, + b = ccall((:nf_elem_equal_fmpq, libflint), Cint, (Ref{AbsSimpleNumFieldElem}, Ref{QQFieldElem}, Ref{AbsSimpleNumField}), a, b, a.parent) return Bool(b) end function ==(a::AbsSimpleNumFieldElem, b::Int) - b = ccall((:nf_elem_equal_si, libantic), Cint, + b = ccall((:nf_elem_equal_si, libflint), Cint, (Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), a, b, a.parent) return Bool(b) end function ==(a::AbsSimpleNumFieldElem, b::UInt) - b = ccall((:nf_elem_equal_ui, libantic), Cint, + b = ccall((:nf_elem_equal_ui, libflint), Cint, (Ref{AbsSimpleNumFieldElem}, UInt, Ref{AbsSimpleNumField}), a, b, a.parent) return Bool(b) @@ -566,7 +566,7 @@ Return $a^{-1}$. Requires $a \neq 0$. function inv(a::AbsSimpleNumFieldElem) iszero(a) && throw(DivideError()) r = a.parent() - ccall((:nf_elem_inv, libantic), Nothing, + ccall((:nf_elem_inv, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a, a.parent) return r @@ -583,7 +583,7 @@ function divexact(a::AbsSimpleNumFieldElem, b::AbsSimpleNumFieldElem; check::Boo parent(a) == parent(b) || return force_op(divexact, a, b)::AbsSimpleNumFieldElem check_parent(a, b) r = a.parent() - ccall((:nf_elem_div, libantic), Nothing, + ccall((:nf_elem_div, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -598,7 +598,7 @@ end function divexact(a::AbsSimpleNumFieldElem, b::Int; check::Bool=true) b == 0 && throw(DivideError()) r = a.parent() - ccall((:nf_elem_scalar_div_si, libantic), Nothing, + ccall((:nf_elem_scalar_div_si, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -607,7 +607,7 @@ end function divexact(a::AbsSimpleNumFieldElem, b::ZZRingElem; check::Bool=true) iszero(b) && throw(DivideError()) r = a.parent() - ccall((:nf_elem_scalar_div_fmpz, libantic), Nothing, + ccall((:nf_elem_scalar_div_fmpz, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -618,7 +618,7 @@ divexact(a::AbsSimpleNumFieldElem, b::Integer; check::Bool=true) = divexact(a, Z function divexact(a::AbsSimpleNumFieldElem, b::QQFieldElem; check::Bool=true) iszero(b) && throw(DivideError()) r = a.parent() - ccall((:nf_elem_scalar_div_fmpq, libantic), Nothing, + ccall((:nf_elem_scalar_div_fmpq, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{QQFieldElem}, Ref{AbsSimpleNumField}), r, a, b, a.parent) return r @@ -666,7 +666,7 @@ Return the absolute norm of $a$. The result will be a rational number. """ function norm(a::AbsSimpleNumFieldElem) z = QQFieldElem() - ccall((:nf_elem_norm, libantic), Nothing, + ccall((:nf_elem_norm, libflint), Nothing, (Ref{QQFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), z, a, a.parent) return z @@ -679,7 +679,7 @@ Return the absolute trace of $a$. The result will be a rational number. """ function tr(a::AbsSimpleNumFieldElem) z = QQFieldElem() - ccall((:nf_elem_trace, libantic), Nothing, + ccall((:nf_elem_trace, libflint), Nothing, (Ref{QQFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), z, a, a.parent) return z @@ -695,7 +695,7 @@ The matrix is of type QQMatrix. function representation_matrix(a::AbsSimpleNumFieldElem) K = parent(a) z = QQMatrix(degree(K), degree(K)) - ccall((:nf_elem_rep_mat, libantic), Nothing, + ccall((:nf_elem_rep_mat, libflint), Nothing, (Ref{QQMatrix}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), z, a, K) return z end @@ -712,7 +712,7 @@ function representation_matrix_q(a::AbsSimpleNumFieldElem) K = parent(a) z = ZZMatrix(degree(K), degree(K)) d = ZZRingElem() - ccall((:nf_elem_rep_mat_fmpz_mat_den, libantic), Nothing, + ccall((:nf_elem_rep_mat_fmpz_mat_den, libflint), Nothing, (Ref{ZZMatrix}, Ref{ZZRingElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), z, d, a, K) return z, d @@ -725,13 +725,13 @@ end ############################################################################### function zero!(a::AbsSimpleNumFieldElem) - ccall((:nf_elem_zero, libantic), Nothing, + ccall((:nf_elem_zero, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), a, parent(a)) return a end function mul!(z::AbsSimpleNumFieldElem, x::AbsSimpleNumFieldElem, y::AbsSimpleNumFieldElem) - ccall((:nf_elem_mul, libantic), Nothing, + ccall((:nf_elem_mul, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), z, x, y, parent(x)) return z @@ -747,21 +747,21 @@ for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection. """ function mul_red!(z::AbsSimpleNumFieldElem, x::AbsSimpleNumFieldElem, y::AbsSimpleNumFieldElem, red::Bool) - ccall((:nf_elem_mul_red, libantic), Nothing, + ccall((:nf_elem_mul_red, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}, Cint), z, x, y, parent(x), red) return z end function addeq!(z::AbsSimpleNumFieldElem, x::AbsSimpleNumFieldElem) - ccall((:nf_elem_add, libantic), Nothing, + ccall((:nf_elem_add, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), z, z, x, parent(x)) return z end function add!(a::AbsSimpleNumFieldElem, b::AbsSimpleNumFieldElem, c::AbsSimpleNumFieldElem) - ccall((:nf_elem_add, libantic), Nothing, + ccall((:nf_elem_add, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), a, b, c, a.parent) return a @@ -776,7 +776,7 @@ where reduction has not been performed. All standard Nemo number field functions automatically reduce their outputs. """ function reduce!(x::AbsSimpleNumFieldElem) - ccall((:nf_elem_reduce, libantic), Nothing, + ccall((:nf_elem_reduce, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), x, parent(x)) return x end @@ -788,21 +788,21 @@ end ############################################################################### function add!(c::AbsSimpleNumFieldElem, a::AbsSimpleNumFieldElem, b::QQFieldElem) - ccall((:nf_elem_add_fmpq, libantic), Nothing, + ccall((:nf_elem_add_fmpq, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{QQFieldElem}, Ref{AbsSimpleNumField}), c, a, b, a.parent) return c end function add!(c::AbsSimpleNumFieldElem, a::AbsSimpleNumFieldElem, b::ZZRingElem) - ccall((:nf_elem_add_fmpz, libantic), Nothing, + ccall((:nf_elem_add_fmpz, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), c, a, b, a.parent) return c end function add!(c::AbsSimpleNumFieldElem, a::AbsSimpleNumFieldElem, b::Int) - ccall((:nf_elem_add_si, libantic), Nothing, + ccall((:nf_elem_add_si, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), c, a, b, a.parent) return c @@ -811,21 +811,21 @@ end add!(c::AbsSimpleNumFieldElem, a::AbsSimpleNumFieldElem, b::Integer) = add!(c, a, ZZRingElem(b)) function sub!(c::AbsSimpleNumFieldElem, a::AbsSimpleNumFieldElem, b::QQFieldElem) - ccall((:nf_elem_sub_fmpq, libantic), Nothing, + ccall((:nf_elem_sub_fmpq, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{QQFieldElem}, Ref{AbsSimpleNumField}), c, a, b, a.parent) return c end function sub!(c::AbsSimpleNumFieldElem, a::AbsSimpleNumFieldElem, b::ZZRingElem) - ccall((:nf_elem_sub_fmpz, libantic), Nothing, + ccall((:nf_elem_sub_fmpz, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), c, a, b, a.parent) return c end function sub!(c::AbsSimpleNumFieldElem, a::AbsSimpleNumFieldElem, b::Int) - ccall((:nf_elem_sub_si, libantic), Nothing, + ccall((:nf_elem_sub_si, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), c, a, b, a.parent) return c @@ -834,21 +834,21 @@ end sub!(c::AbsSimpleNumFieldElem, a::AbsSimpleNumFieldElem, b::Integer) = sub!(c, a, ZZRingElem(b)) function sub!(c::AbsSimpleNumFieldElem, a::QQFieldElem, b::AbsSimpleNumFieldElem) - ccall((:nf_elem_fmpq_sub, libantic), Nothing, + ccall((:nf_elem_fmpq_sub, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{QQFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), c, a, b, a.parent) return c end function sub!(c::AbsSimpleNumFieldElem, a::ZZRingElem, b::AbsSimpleNumFieldElem) - ccall((:nf_elem_fmpz_sub, libantic), Nothing, + ccall((:nf_elem_fmpz_sub, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), c, a, b, a.parent) return c end function sub!(c::AbsSimpleNumFieldElem, a::Int, b::AbsSimpleNumFieldElem) - ccall((:nf_elem_si_sub, libantic), Nothing, + ccall((:nf_elem_si_sub, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), c, a, b, b.parent) return c @@ -857,21 +857,21 @@ end sub!(c::AbsSimpleNumFieldElem, a::Integer, b::AbsSimpleNumFieldElem) = sub!(c, ZZRingElem(a), b) function mul!(c::AbsSimpleNumFieldElem, a::AbsSimpleNumFieldElem, b::QQFieldElem) - ccall((:nf_elem_scalar_mul_fmpq, libantic), Nothing, + ccall((:nf_elem_scalar_mul_fmpq, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{QQFieldElem}, Ref{AbsSimpleNumField}), c, a, b, a.parent) return c end function mul!(c::AbsSimpleNumFieldElem, a::AbsSimpleNumFieldElem, b::ZZRingElem) - ccall((:nf_elem_scalar_mul_fmpz, libantic), Nothing, + ccall((:nf_elem_scalar_mul_fmpz, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), c, a, b, a.parent) return c end function mul!(c::AbsSimpleNumFieldElem, a::AbsSimpleNumFieldElem, b::Int) - ccall((:nf_elem_scalar_mul_si, libantic), Nothing, + ccall((:nf_elem_scalar_mul_si, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), c, a, b, a.parent) return c @@ -1067,7 +1067,7 @@ Return an empty (0) element. """ function (a::AbsSimpleNumField)() z = AbsSimpleNumFieldElem(a) - ccall((:nf_elem_set_si, libantic), Nothing, + ccall((:nf_elem_set_si, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), z, 0, a) return z end @@ -1079,7 +1079,7 @@ Return $c$ as an element in $a$. """ function (a::AbsSimpleNumField)(c::Int) z = AbsSimpleNumFieldElem(a) - ccall((:nf_elem_set_si, libantic), Nothing, + ccall((:nf_elem_set_si, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Int, Ref{AbsSimpleNumField}), z, c, a) return z end @@ -1088,14 +1088,14 @@ end function (a::AbsSimpleNumField)(c::ZZRingElem) z = AbsSimpleNumFieldElem(a) - ccall((:nf_elem_set_fmpz, libantic), Nothing, + ccall((:nf_elem_set_fmpz, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{ZZRingElem}, Ref{AbsSimpleNumField}), z, c, a) return z end function (a::AbsSimpleNumField)(c::QQFieldElem) z = AbsSimpleNumFieldElem(a) - ccall((:nf_elem_set_fmpq, libantic), Nothing, + ccall((:nf_elem_set_fmpq, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{QQFieldElem}, Ref{AbsSimpleNumField}), z, c, a) return z end @@ -1113,7 +1113,7 @@ function (a::AbsSimpleNumField)(pol::QQPolyRingElem) if length(pol) >= length(a.pol) pol = mod(pol, a.pol) end - ccall((:nf_elem_set_fmpq_poly, libantic), Nothing, + ccall((:nf_elem_set_fmpq_poly, libflint), Nothing, (Ref{AbsSimpleNumFieldElem}, Ref{QQPolyRingElem}, Ref{AbsSimpleNumField}), z, pol, a) return z end @@ -1121,7 +1121,7 @@ end function (a::QQPolyRing)(b::AbsSimpleNumFieldElem) parent(parent(b).pol) != a && error("Cannot coerce from number field to polynomial ring") r = a() - ccall((:nf_elem_get_fmpq_poly, libantic), Nothing, + ccall((:nf_elem_get_fmpq_poly, libflint), Nothing, (Ref{QQPolyRingElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}), r, b, parent(b)) return r end diff --git a/src/arb/ArbTypes.jl b/src/arb/ArbTypes.jl index 3e5695150..f7e9e95ad 100644 --- a/src/arb/ArbTypes.jl +++ b/src/arb/ArbTypes.jl @@ -35,14 +35,14 @@ mutable struct arf_struct function arf_struct() z = new() - ccall((:arf_init, libarb), Nothing, (Ref{arf_struct}, ), z) + ccall((:arf_init, libflint), Nothing, (Ref{arf_struct}, ), z) finalizer(_arf_clear_fn, z) return z end end function _arf_clear_fn(x::arf_struct) - ccall((:arf_clear, libarb), Nothing, (Ref{arf_struct}, ), x) + ccall((:arf_clear, libflint), Nothing, (Ref{arf_struct}, ), x) end mutable struct mag_struct @@ -93,14 +93,14 @@ mutable struct RealFieldElem <: FieldElem function RealFieldElem() z = new() - ccall((:arb_init, libarb), Nothing, (Ref{RealFieldElem}, ), z) + ccall((:arb_init, libflint), Nothing, (Ref{RealFieldElem}, ), z) finalizer(_arb_clear_fn, z) return z end function RealFieldElem(x::Union{Real, ZZRingElem, QQFieldElem, AbstractString, RealFieldElem}, p::Int) z = new() - ccall((:arb_init, libarb), Nothing, (Ref{RealFieldElem}, ), z) + ccall((:arb_init, libflint), Nothing, (Ref{RealFieldElem}, ), z) _arb_set(z, x, p) finalizer(_arb_clear_fn, z) return z @@ -108,7 +108,7 @@ mutable struct RealFieldElem <: FieldElem function RealFieldElem(x::Union{Real, ZZRingElem}) z = new() - ccall((:arb_init, libarb), Nothing, (Ref{RealFieldElem}, ), z) + ccall((:arb_init, libflint), Nothing, (Ref{RealFieldElem}, ), z) _arb_set(z, x) finalizer(_arb_clear_fn, z) return z @@ -116,9 +116,9 @@ mutable struct RealFieldElem <: FieldElem function RealFieldElem(mid::RealFieldElem, rad::RealFieldElem) z = new() - ccall((:arb_init, libarb), Nothing, (Ref{RealFieldElem}, ), z) - ccall((:arb_set, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, mid) - ccall((:arb_add_error, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, rad) + ccall((:arb_init, libflint), Nothing, (Ref{RealFieldElem}, ), z) + ccall((:arb_set, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, mid) + ccall((:arb_add_error, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, rad) finalizer(_arb_clear_fn, z) return z end @@ -126,7 +126,7 @@ mutable struct RealFieldElem <: FieldElem end function _arb_clear_fn(x::RealFieldElem) - ccall((:arb_clear, libarb), Nothing, (Ref{RealFieldElem}, ), x) + ccall((:arb_clear, libflint), Nothing, (Ref{RealFieldElem}, ), x) end # fixed precision @@ -157,14 +157,14 @@ mutable struct ArbFieldElem <: FieldElem function ArbFieldElem() z = new() - ccall((:arb_init, libarb), Nothing, (Ref{ArbFieldElem}, ), z) + ccall((:arb_init, libflint), Nothing, (Ref{ArbFieldElem}, ), z) finalizer(_arb_clear_fn, z) return z end function ArbFieldElem(x::Union{Real, ZZRingElem, QQFieldElem, AbstractString, ArbFieldElem}, p::Int) z = new() - ccall((:arb_init, libarb), Nothing, (Ref{ArbFieldElem}, ), z) + ccall((:arb_init, libflint), Nothing, (Ref{ArbFieldElem}, ), z) _arb_set(z, x, p) finalizer(_arb_clear_fn, z) return z @@ -172,7 +172,7 @@ mutable struct ArbFieldElem <: FieldElem function ArbFieldElem(x::Union{Real, ZZRingElem, ArbFieldElem}) z = new() - ccall((:arb_init, libarb), Nothing, (Ref{ArbFieldElem}, ), z) + ccall((:arb_init, libflint), Nothing, (Ref{ArbFieldElem}, ), z) _arb_set(z, x) finalizer(_arb_clear_fn, z) return z @@ -180,24 +180,24 @@ mutable struct ArbFieldElem <: FieldElem function ArbFieldElem(mid::ArbFieldElem, rad::ArbFieldElem) z = new() - ccall((:arb_init, libarb), Nothing, (Ref{ArbFieldElem}, ), z) - ccall((:arb_set, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, mid) - ccall((:arb_add_error, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, rad) + ccall((:arb_init, libflint), Nothing, (Ref{ArbFieldElem}, ), z) + ccall((:arb_set, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, mid) + ccall((:arb_add_error, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, rad) finalizer(_arb_clear_fn, z) return z end #function ArbFieldElem(x::arf) # z = new() - # ccall((:arb_init, libarb), Nothing, (Ref{ArbFieldElem}, ), z) - # ccall((:arb_set_arf, libarb), Nothing, (Ref{ArbFieldElem}, Ptr{arf}), z, x) + # ccall((:arb_init, libflint), Nothing, (Ref{ArbFieldElem}, ), z) + # ccall((:arb_set_arf, libflint), Nothing, (Ref{ArbFieldElem}, Ptr{arf}), z, x) # finalizer(_arb_clear_fn, z) # return z #end end function _arb_clear_fn(x::ArbFieldElem) - ccall((:arb_clear, libarb), Nothing, (Ref{ArbFieldElem}, ), x) + ccall((:arb_clear, libflint), Nothing, (Ref{ArbFieldElem}, ), x) end @@ -226,14 +226,14 @@ mutable struct ComplexFieldElem <: FieldElem function ComplexFieldElem() z = new() - ccall((:acb_init, libarb), Nothing, (Ref{ComplexFieldElem}, ), z) + ccall((:acb_init, libflint), Nothing, (Ref{ComplexFieldElem}, ), z) finalizer(_acb_clear_fn, z) return z end function ComplexFieldElem(x::Union{Number, ZZRingElem, RealFieldElem, ComplexFieldElem}) z = new() - ccall((:acb_init, libarb), Nothing, (Ref{ComplexFieldElem}, ), z) + ccall((:acb_init, libflint), Nothing, (Ref{ComplexFieldElem}, ), z) _acb_set(z, x) finalizer(_acb_clear_fn, z) return z @@ -241,7 +241,7 @@ mutable struct ComplexFieldElem <: FieldElem function ComplexFieldElem(x::Union{Number, ZZRingElem, QQFieldElem, RealFieldElem, ComplexFieldElem, AbstractString}, p::Int) z = new() - ccall((:acb_init, libarb), Nothing, (Ref{ComplexFieldElem}, ), z) + ccall((:acb_init, libflint), Nothing, (Ref{ComplexFieldElem}, ), z) _acb_set(z, x, p) finalizer(_acb_clear_fn, z) return z @@ -249,7 +249,7 @@ mutable struct ComplexFieldElem <: FieldElem function ComplexFieldElem(x::T, y::T, p::Int) where {T <: Union{Real, ZZRingElem, QQFieldElem, AbstractString, RealFieldElem}} z = new() - ccall((:acb_init, libarb), Nothing, (Ref{ComplexFieldElem}, ), z) + ccall((:acb_init, libflint), Nothing, (Ref{ComplexFieldElem}, ), z) _acb_set(z, x, y, p) finalizer(_acb_clear_fn, z) return z @@ -257,7 +257,7 @@ mutable struct ComplexFieldElem <: FieldElem end function _acb_clear_fn(x::ComplexFieldElem) - ccall((:acb_clear, libarb), Nothing, (Ref{ComplexFieldElem}, ), x) + ccall((:acb_clear, libflint), Nothing, (Ref{ComplexFieldElem}, ), x) end ################################################################################ @@ -383,14 +383,14 @@ mutable struct AcbFieldElem <: FieldElem function AcbFieldElem() z = new() - ccall((:acb_init, libarb), Nothing, (Ref{AcbFieldElem}, ), z) + ccall((:acb_init, libflint), Nothing, (Ref{AcbFieldElem}, ), z) finalizer(_acb_clear_fn, z) return z end function AcbFieldElem(x::Union{Number, ZZRingElem, ArbFieldElem, AcbFieldElem}) z = new() - ccall((:acb_init, libarb), Nothing, (Ref{AcbFieldElem}, ), z) + ccall((:acb_init, libflint), Nothing, (Ref{AcbFieldElem}, ), z) _acb_set(z, x) finalizer(_acb_clear_fn, z) return z @@ -398,7 +398,7 @@ mutable struct AcbFieldElem <: FieldElem function AcbFieldElem(x::Union{Number, ZZRingElem, QQFieldElem, ArbFieldElem, AcbFieldElem, AbstractString}, p::Int) z = new() - ccall((:acb_init, libarb), Nothing, (Ref{AcbFieldElem}, ), z) + ccall((:acb_init, libflint), Nothing, (Ref{AcbFieldElem}, ), z) _acb_set(z, x, p) finalizer(_acb_clear_fn, z) return z @@ -406,7 +406,7 @@ mutable struct AcbFieldElem <: FieldElem #function AcbFieldElem{T <: Union{Int, UInt, Float64, ZZRingElem, BigFloat, ArbFieldElem}}(x::T, y::T) # z = new() - # ccall((:acb_init, libarb), Nothing, (Ref{AcbFieldElem}, ), z) + # ccall((:acb_init, libflint), Nothing, (Ref{AcbFieldElem}, ), z) # _acb_set(z, x, y) # finalizer(_acb_clear_fn, z) # return z @@ -414,7 +414,7 @@ mutable struct AcbFieldElem <: FieldElem function AcbFieldElem(x::T, y::T, p::Int) where {T <: Union{Real, ZZRingElem, QQFieldElem, AbstractString, ArbFieldElem}} z = new() - ccall((:acb_init, libarb), Nothing, (Ref{AcbFieldElem}, ), z) + ccall((:acb_init, libflint), Nothing, (Ref{AcbFieldElem}, ), z) _acb_set(z, x, y, p) finalizer(_acb_clear_fn, z) return z @@ -422,7 +422,7 @@ mutable struct AcbFieldElem <: FieldElem end function _acb_clear_fn(x::AcbFieldElem) - ccall((:acb_clear, libarb), Nothing, (Ref{AcbFieldElem}, ), x) + ccall((:acb_clear, libflint), Nothing, (Ref{AcbFieldElem}, ), x) end ################################################################################ @@ -445,7 +445,7 @@ mutable struct acb_calc_integrate_opts function acb_calc_integrate_opts() opts = new() - ccall((:acb_calc_integrate_opt_init, libarb), + ccall((:acb_calc_integrate_opt_init, libflint), Nothing, (Ref{acb_calc_integrate_opts}, ), opts) return opts end @@ -477,15 +477,15 @@ mutable struct RealPoly <: PolyRingElem{RealFieldElem} function RealPoly() z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{RealPoly}, ), z) + ccall((:arb_poly_init, libflint), Nothing, (Ref{RealPoly}, ), z) finalizer(_RealPoly_clear_fn, z) return z end function RealPoly(x::RealFieldElem, p::Int) z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{RealPoly}, ), z) - ccall((:arb_poly_set_coeff_arb, libarb), Nothing, + ccall((:arb_poly_init, libflint), Nothing, (Ref{RealPoly}, ), z) + ccall((:arb_poly_set_coeff_arb, libflint), Nothing, (Ref{RealPoly}, Int, Ref{RealFieldElem}), z, 0, x) finalizer(_RealPoly_clear_fn, z) return z @@ -493,9 +493,9 @@ mutable struct RealPoly <: PolyRingElem{RealFieldElem} function RealPoly(x::Vector{RealFieldElem}, p::Int) z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{RealPoly}, ), z) + ccall((:arb_poly_init, libflint), Nothing, (Ref{RealPoly}, ), z) for i = 1:length(x) - ccall((:arb_poly_set_coeff_arb, libarb), Nothing, + ccall((:arb_poly_set_coeff_arb, libflint), Nothing, (Ref{RealPoly}, Int, Ref{RealFieldElem}), z, i - 1, x[i]) end finalizer(_RealPoly_clear_fn, z) @@ -504,16 +504,16 @@ mutable struct RealPoly <: PolyRingElem{RealFieldElem} function RealPoly(x::RealPoly) z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{RealPoly}, ), z) - ccall((:arb_poly_set, libarb), Nothing, (Ref{RealPoly}, Ref{RealPoly}), z, x) + ccall((:arb_poly_init, libflint), Nothing, (Ref{RealPoly}, ), z) + ccall((:arb_poly_set, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}), z, x) finalizer(_RealPoly_clear_fn, z) return z end function RealPoly(x::RealPoly, p::Int) z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{RealPoly}, ), z) - ccall((:arb_poly_set_round, libarb), Nothing, + ccall((:arb_poly_init, libflint), Nothing, (Ref{RealPoly}, ), z) + ccall((:arb_poly_set_round, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Int), z, x, p) finalizer(_RealPoly_clear_fn, z) return z @@ -521,8 +521,8 @@ mutable struct RealPoly <: PolyRingElem{RealFieldElem} function RealPoly(x::ZZPolyRingElem, p::Int) z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{RealPoly}, ), z) - ccall((:arb_poly_set_fmpz_poly, libarb), Nothing, + ccall((:arb_poly_init, libflint), Nothing, (Ref{RealPoly}, ), z) + ccall((:arb_poly_set_fmpz_poly, libflint), Nothing, (Ref{RealPoly}, Ref{ZZPolyRingElem}, Int), z, x, p) finalizer(_RealPoly_clear_fn, z) return z @@ -530,8 +530,8 @@ mutable struct RealPoly <: PolyRingElem{RealFieldElem} function RealPoly(x::QQPolyRingElem, p::Int) z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{RealPoly}, ), z) - ccall((:arb_poly_set_fmpq_poly, libarb), Nothing, + ccall((:arb_poly_init, libflint), Nothing, (Ref{RealPoly}, ), z) + ccall((:arb_poly_set_fmpq_poly, libflint), Nothing, (Ref{RealPoly}, Ref{QQPolyRingElem}, Int), z, x, p) finalizer(_RealPoly_clear_fn, z) return z @@ -539,7 +539,7 @@ mutable struct RealPoly <: PolyRingElem{RealFieldElem} end function _RealPoly_clear_fn(x::RealPoly) - ccall((:arb_poly_clear, libarb), Nothing, (Ref{RealPoly}, ), x) + ccall((:arb_poly_clear, libflint), Nothing, (Ref{RealPoly}, ), x) end parent(x::RealPoly) = x.parent @@ -571,15 +571,15 @@ mutable struct ArbPolyRingElem <: PolyRingElem{ArbFieldElem} function ArbPolyRingElem() z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{ArbPolyRingElem}, ), z) + ccall((:arb_poly_init, libflint), Nothing, (Ref{ArbPolyRingElem}, ), z) finalizer(_arb_poly_clear_fn, z) return z end function ArbPolyRingElem(x::ArbFieldElem, p::Int) z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{ArbPolyRingElem}, ), z) - ccall((:arb_poly_set_coeff_arb, libarb), Nothing, + ccall((:arb_poly_init, libflint), Nothing, (Ref{ArbPolyRingElem}, ), z) + ccall((:arb_poly_set_coeff_arb, libflint), Nothing, (Ref{ArbPolyRingElem}, Int, Ref{ArbFieldElem}), z, 0, x) finalizer(_arb_poly_clear_fn, z) return z @@ -587,9 +587,9 @@ mutable struct ArbPolyRingElem <: PolyRingElem{ArbFieldElem} function ArbPolyRingElem(x::Vector{ArbFieldElem}, p::Int) z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{ArbPolyRingElem}, ), z) + ccall((:arb_poly_init, libflint), Nothing, (Ref{ArbPolyRingElem}, ), z) for i = 1:length(x) - ccall((:arb_poly_set_coeff_arb, libarb), Nothing, + ccall((:arb_poly_set_coeff_arb, libflint), Nothing, (Ref{ArbPolyRingElem}, Int, Ref{ArbFieldElem}), z, i - 1, x[i]) end finalizer(_arb_poly_clear_fn, z) @@ -598,16 +598,16 @@ mutable struct ArbPolyRingElem <: PolyRingElem{ArbFieldElem} function ArbPolyRingElem(x::ArbPolyRingElem) z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{ArbPolyRingElem}, ), z) - ccall((:arb_poly_set, libarb), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}), z, x) + ccall((:arb_poly_init, libflint), Nothing, (Ref{ArbPolyRingElem}, ), z) + ccall((:arb_poly_set, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}), z, x) finalizer(_arb_poly_clear_fn, z) return z end function ArbPolyRingElem(x::ArbPolyRingElem, p::Int) z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{ArbPolyRingElem}, ), z) - ccall((:arb_poly_set_round, libarb), Nothing, + ccall((:arb_poly_init, libflint), Nothing, (Ref{ArbPolyRingElem}, ), z) + ccall((:arb_poly_set_round, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, p) finalizer(_arb_poly_clear_fn, z) return z @@ -615,8 +615,8 @@ mutable struct ArbPolyRingElem <: PolyRingElem{ArbFieldElem} function ArbPolyRingElem(x::ZZPolyRingElem, p::Int) z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{ArbPolyRingElem}, ), z) - ccall((:arb_poly_set_fmpz_poly, libarb), Nothing, + ccall((:arb_poly_init, libflint), Nothing, (Ref{ArbPolyRingElem}, ), z) + ccall((:arb_poly_set_fmpz_poly, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ZZPolyRingElem}, Int), z, x, p) finalizer(_arb_poly_clear_fn, z) return z @@ -624,8 +624,8 @@ mutable struct ArbPolyRingElem <: PolyRingElem{ArbFieldElem} function ArbPolyRingElem(x::QQPolyRingElem, p::Int) z = new() - ccall((:arb_poly_init, libarb), Nothing, (Ref{ArbPolyRingElem}, ), z) - ccall((:arb_poly_set_fmpq_poly, libarb), Nothing, + ccall((:arb_poly_init, libflint), Nothing, (Ref{ArbPolyRingElem}, ), z) + ccall((:arb_poly_set_fmpq_poly, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{QQPolyRingElem}, Int), z, x, p) finalizer(_arb_poly_clear_fn, z) return z @@ -633,7 +633,7 @@ mutable struct ArbPolyRingElem <: PolyRingElem{ArbFieldElem} end function _arb_poly_clear_fn(x::ArbPolyRingElem) - ccall((:arb_poly_clear, libarb), Nothing, (Ref{ArbPolyRingElem}, ), x) + ccall((:arb_poly_clear, libflint), Nothing, (Ref{ArbPolyRingElem}, ), x) end parent(x::ArbPolyRingElem) = x.parent @@ -670,15 +670,15 @@ mutable struct ComplexPoly <: PolyRingElem{ComplexFieldElem} function ComplexPoly() z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{ComplexPoly}, ), z) + ccall((:acb_poly_init, libflint), Nothing, (Ref{ComplexPoly}, ), z) finalizer(_acb_poly_clear_fn, z) return z end function ComplexPoly(x::ComplexFieldElem, p::Int) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{ComplexPoly}, ), z) - ccall((:acb_poly_set_coeff_acb, libarb), Nothing, + ccall((:acb_poly_init, libflint), Nothing, (Ref{ComplexPoly}, ), z) + ccall((:acb_poly_set_coeff_acb, libflint), Nothing, (Ref{ComplexPoly}, Int, Ref{ComplexFieldElem}), z, 0, x) finalizer(_acb_poly_clear_fn, z) return z @@ -686,9 +686,9 @@ mutable struct ComplexPoly <: PolyRingElem{ComplexFieldElem} function ComplexPoly(x::Vector{ComplexFieldElem}, p::Int) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{ComplexPoly}, ), z) + ccall((:acb_poly_init, libflint), Nothing, (Ref{ComplexPoly}, ), z) for i = 1:length(x) - ccall((:acb_poly_set_coeff_acb, libarb), Nothing, + ccall((:acb_poly_set_coeff_acb, libflint), Nothing, (Ref{ComplexPoly}, Int, Ref{ComplexFieldElem}), z, i - 1, x[i]) end finalizer(_acb_poly_clear_fn, z) @@ -697,18 +697,18 @@ mutable struct ComplexPoly <: PolyRingElem{ComplexFieldElem} function ComplexPoly(x::ComplexPoly) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{ComplexPoly}, ), z) - ccall((:acb_poly_set, libarb), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}), z, x) + ccall((:acb_poly_init, libflint), Nothing, (Ref{ComplexPoly}, ), z) + ccall((:acb_poly_set, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}), z, x) finalizer(_acb_poly_clear_fn, z) return z end function ComplexPoly(x::RealPoly, p::Int) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{ComplexPoly}, ), z) - ccall((:acb_poly_set_arb_poly, libarb), Nothing, + ccall((:acb_poly_init, libflint), Nothing, (Ref{ComplexPoly}, ), z) + ccall((:acb_poly_set_arb_poly, libflint), Nothing, (Ref{ComplexPoly}, Ref{ArbPolyRingElem}, Int), z, x, p) - ccall((:acb_poly_set_round, libarb), Nothing, + ccall((:acb_poly_set_round, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, z, p) finalizer(_acb_poly_clear_fn, z) return z @@ -716,8 +716,8 @@ mutable struct ComplexPoly <: PolyRingElem{ComplexFieldElem} function ComplexPoly(x::ComplexPoly, p::Int) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{ComplexPoly}, ), z) - ccall((:acb_poly_set_round, libarb), Nothing, + ccall((:acb_poly_init, libflint), Nothing, (Ref{ComplexPoly}, ), z) + ccall((:acb_poly_set_round, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, x, p) finalizer(_acb_poly_clear_fn, z) return z @@ -725,8 +725,8 @@ mutable struct ComplexPoly <: PolyRingElem{ComplexFieldElem} function ComplexPoly(x::ZZPolyRingElem, p::Int) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{ComplexPoly}, ), z) - ccall((:acb_poly_set_fmpz_poly, libarb), Nothing, + ccall((:acb_poly_init, libflint), Nothing, (Ref{ComplexPoly}, ), z) + ccall((:acb_poly_set_fmpz_poly, libflint), Nothing, (Ref{ComplexPoly}, Ref{ZZPolyRingElem}, Int), z, x, p) finalizer(_acb_poly_clear_fn, z) return z @@ -734,8 +734,8 @@ mutable struct ComplexPoly <: PolyRingElem{ComplexFieldElem} function ComplexPoly(x::QQPolyRingElem, p::Int) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{ComplexPoly}, ), z) - ccall((:acb_poly_set_fmpq_poly, libarb), Nothing, + ccall((:acb_poly_init, libflint), Nothing, (Ref{ComplexPoly}, ), z) + ccall((:acb_poly_set_fmpq_poly, libflint), Nothing, (Ref{ComplexPoly}, Ref{QQPolyRingElem}, Int), z, x, p) finalizer(_acb_poly_clear_fn, z) return z @@ -743,7 +743,7 @@ mutable struct ComplexPoly <: PolyRingElem{ComplexFieldElem} end function _acb_poly_clear_fn(x::ComplexPoly) - ccall((:acb_poly_clear, libarb), Nothing, (Ref{ComplexPoly}, ), x) + ccall((:acb_poly_clear, libflint), Nothing, (Ref{ComplexPoly}, ), x) end parent(x::ComplexPoly) = x.parent @@ -775,15 +775,15 @@ mutable struct AcbPolyRingElem <: PolyRingElem{AcbFieldElem} function AcbPolyRingElem() z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{AcbPolyRingElem}, ), z) + ccall((:acb_poly_init, libflint), Nothing, (Ref{AcbPolyRingElem}, ), z) finalizer(_acb_poly_clear_fn, z) return z end function AcbPolyRingElem(x::AcbFieldElem, p::Int) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{AcbPolyRingElem}, ), z) - ccall((:acb_poly_set_coeff_acb, libarb), Nothing, + ccall((:acb_poly_init, libflint), Nothing, (Ref{AcbPolyRingElem}, ), z) + ccall((:acb_poly_set_coeff_acb, libflint), Nothing, (Ref{AcbPolyRingElem}, Int, Ref{AcbFieldElem}), z, 0, x) finalizer(_acb_poly_clear_fn, z) return z @@ -791,9 +791,9 @@ mutable struct AcbPolyRingElem <: PolyRingElem{AcbFieldElem} function AcbPolyRingElem(x::Vector{AcbFieldElem}, p::Int) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{AcbPolyRingElem}, ), z) + ccall((:acb_poly_init, libflint), Nothing, (Ref{AcbPolyRingElem}, ), z) for i = 1:length(x) - ccall((:acb_poly_set_coeff_acb, libarb), Nothing, + ccall((:acb_poly_set_coeff_acb, libflint), Nothing, (Ref{AcbPolyRingElem}, Int, Ref{AcbFieldElem}), z, i - 1, x[i]) end finalizer(_acb_poly_clear_fn, z) @@ -802,18 +802,18 @@ mutable struct AcbPolyRingElem <: PolyRingElem{AcbFieldElem} function AcbPolyRingElem(x::AcbPolyRingElem) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{AcbPolyRingElem}, ), z) - ccall((:acb_poly_set, libarb), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}), z, x) + ccall((:acb_poly_init, libflint), Nothing, (Ref{AcbPolyRingElem}, ), z) + ccall((:acb_poly_set, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}), z, x) finalizer(_acb_poly_clear_fn, z) return z end function AcbPolyRingElem(x::ArbPolyRingElem, p::Int) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{AcbPolyRingElem}, ), z) - ccall((:acb_poly_set_arb_poly, libarb), Nothing, + ccall((:acb_poly_init, libflint), Nothing, (Ref{AcbPolyRingElem}, ), z) + ccall((:acb_poly_set_arb_poly, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, p) - ccall((:acb_poly_set_round, libarb), Nothing, + ccall((:acb_poly_set_round, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, z, p) finalizer(_acb_poly_clear_fn, z) return z @@ -821,8 +821,8 @@ mutable struct AcbPolyRingElem <: PolyRingElem{AcbFieldElem} function AcbPolyRingElem(x::AcbPolyRingElem, p::Int) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{AcbPolyRingElem}, ), z) - ccall((:acb_poly_set_round, libarb), Nothing, + ccall((:acb_poly_init, libflint), Nothing, (Ref{AcbPolyRingElem}, ), z) + ccall((:acb_poly_set_round, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, x, p) finalizer(_acb_poly_clear_fn, z) return z @@ -830,8 +830,8 @@ mutable struct AcbPolyRingElem <: PolyRingElem{AcbFieldElem} function AcbPolyRingElem(x::ZZPolyRingElem, p::Int) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{AcbPolyRingElem}, ), z) - ccall((:acb_poly_set_fmpz_poly, libarb), Nothing, + ccall((:acb_poly_init, libflint), Nothing, (Ref{AcbPolyRingElem}, ), z) + ccall((:acb_poly_set_fmpz_poly, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{ZZPolyRingElem}, Int), z, x, p) finalizer(_acb_poly_clear_fn, z) return z @@ -839,8 +839,8 @@ mutable struct AcbPolyRingElem <: PolyRingElem{AcbFieldElem} function AcbPolyRingElem(x::QQPolyRingElem, p::Int) z = new() - ccall((:acb_poly_init, libarb), Nothing, (Ref{AcbPolyRingElem}, ), z) - ccall((:acb_poly_set_fmpq_poly, libarb), Nothing, + ccall((:acb_poly_init, libflint), Nothing, (Ref{AcbPolyRingElem}, ), z) + ccall((:acb_poly_set_fmpq_poly, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{QQPolyRingElem}, Int), z, x, p) finalizer(_acb_poly_clear_fn, z) return z @@ -848,7 +848,7 @@ mutable struct AcbPolyRingElem <: PolyRingElem{AcbFieldElem} end function _acb_poly_clear_fn(x::AcbPolyRingElem) - ccall((:acb_poly_clear, libarb), Nothing, (Ref{AcbPolyRingElem}, ), x) + ccall((:acb_poly_clear, libflint), Nothing, (Ref{AcbPolyRingElem}, ), x) end parent(x::AcbPolyRingElem) = x.parent @@ -888,16 +888,16 @@ mutable struct RealMat <: MatElem{RealFieldElem} function RealMat(r::Int, c::Int) z = new() - ccall((:arb_mat_init, libarb), Nothing, (Ref{RealMat}, Int, Int), z, r, c) + ccall((:arb_mat_init, libflint), Nothing, (Ref{RealMat}, Int, Int), z, r, c) finalizer(_arb_mat_clear_fn, z) return z end function RealMat(a::ZZMatrix) z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{RealMat}, Int, Int), z, a.r, a.c) - ccall((:arb_mat_set_fmpz_mat, libarb), Nothing, + ccall((:arb_mat_set_fmpz_mat, libflint), Nothing, (Ref{RealMat}, Ref{ZZMatrix}), z, a) finalizer(_arb_mat_clear_fn, z) return z @@ -905,9 +905,9 @@ mutable struct RealMat <: MatElem{RealFieldElem} function RealMat(a::ZZMatrix, prec::Int) z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{RealMat}, Int, Int), z, a.r, a.c) - ccall((:arb_mat_set_round_fmpz_mat, libarb), Nothing, + ccall((:arb_mat_set_round_fmpz_mat, libflint), Nothing, (Ref{RealMat}, Ref{ZZMatrix}, Int), z, a, prec) finalizer(_arb_mat_clear_fn, z) return z @@ -915,12 +915,12 @@ mutable struct RealMat <: MatElem{RealFieldElem} function RealMat(r::Int, c::Int, arr::AbstractMatrix{T}) where {T <: Union{Int, UInt, ZZRingElem, Float64, BigFloat, RealFieldElem}} z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{RealMat}, Int, Int), z, r, c) finalizer(_arb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:arb_mat_entry_ptr, libarb), Ptr{RealFieldElem}, + el = ccall((:arb_mat_entry_ptr, libflint), Ptr{RealFieldElem}, (Ref{RealMat}, Int, Int), z, i - 1, j - 1) Nemo._arb_set(el, arr[i, j]) end @@ -930,12 +930,12 @@ mutable struct RealMat <: MatElem{RealFieldElem} function RealMat(r::Int, c::Int, arr::AbstractVector{T}) where {T <: Union{Int, UInt, ZZRingElem, Float64, BigFloat, RealFieldElem}} z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{RealMat}, Int, Int), z, r, c) finalizer(_arb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:arb_mat_entry_ptr, libarb), Ptr{RealFieldElem}, + el = ccall((:arb_mat_entry_ptr, libflint), Ptr{RealFieldElem}, (Ref{RealMat}, Int, Int), z, i - 1, j - 1) Nemo._arb_set(el, arr[(i-1)*c+j]) end @@ -945,12 +945,12 @@ mutable struct RealMat <: MatElem{RealFieldElem} function RealMat(r::Int, c::Int, arr::AbstractMatrix{T}, prec::Int) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, RealFieldElem, AbstractString}} z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{RealMat}, Int, Int), z, r, c) finalizer(_arb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:arb_mat_entry_ptr, libarb), Ptr{RealFieldElem}, + el = ccall((:arb_mat_entry_ptr, libflint), Ptr{RealFieldElem}, (Ref{RealMat}, Int, Int), z, i - 1, j - 1) _arb_set(el, arr[i, j], prec) end @@ -960,12 +960,12 @@ mutable struct RealMat <: MatElem{RealFieldElem} function RealMat(r::Int, c::Int, arr::AbstractVector{T}, prec::Int) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, RealFieldElem, AbstractString}} z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{RealMat}, Int, Int), z, r, c) finalizer(_arb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:arb_mat_entry_ptr, libarb), Ptr{RealFieldElem}, + el = ccall((:arb_mat_entry_ptr, libflint), Ptr{RealFieldElem}, (Ref{RealMat}, Int, Int), z, i - 1, j - 1) _arb_set(el, arr[(i-1)*c+j], prec) end @@ -975,9 +975,9 @@ mutable struct RealMat <: MatElem{RealFieldElem} function RealMat(a::QQMatrix, prec::Int) z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{RealMat}, Int, Int), z, a.r, a.c) - ccall((:arb_mat_set_fmpq_mat, libarb), Nothing, + ccall((:arb_mat_set_fmpq_mat, libflint), Nothing, (Ref{RealMat}, Ref{QQMatrix}, Int), z, a, prec) finalizer(_arb_mat_clear_fn, z) return z @@ -985,7 +985,7 @@ mutable struct RealMat <: MatElem{RealFieldElem} end function _arb_mat_clear_fn(x::RealMat) - ccall((:arb_mat_clear, libarb), Nothing, (Ref{RealMat}, ), x) + ccall((:arb_mat_clear, libflint), Nothing, (Ref{RealMat}, ), x) end # fixed precision @@ -1012,16 +1012,16 @@ mutable struct ArbMatrix <: MatElem{ArbFieldElem} function ArbMatrix(r::Int, c::Int) z = new() - ccall((:arb_mat_init, libarb), Nothing, (Ref{ArbMatrix}, Int, Int), z, r, c) + ccall((:arb_mat_init, libflint), Nothing, (Ref{ArbMatrix}, Int, Int), z, r, c) finalizer(_arb_mat_clear_fn, z) return z end function ArbMatrix(a::ZZMatrix) z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{ArbMatrix}, Int, Int), z, a.r, a.c) - ccall((:arb_mat_set_fmpz_mat, libarb), Nothing, + ccall((:arb_mat_set_fmpz_mat, libflint), Nothing, (Ref{ArbMatrix}, Ref{ZZMatrix}), z, a) finalizer(_arb_mat_clear_fn, z) return z @@ -1029,9 +1029,9 @@ mutable struct ArbMatrix <: MatElem{ArbFieldElem} function ArbMatrix(a::ZZMatrix, prec::Int) z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{ArbMatrix}, Int, Int), z, a.r, a.c) - ccall((:arb_mat_set_round_fmpz_mat, libarb), Nothing, + ccall((:arb_mat_set_round_fmpz_mat, libflint), Nothing, (Ref{ArbMatrix}, Ref{ZZMatrix}, Int), z, a, prec) finalizer(_arb_mat_clear_fn, z) return z @@ -1039,12 +1039,12 @@ mutable struct ArbMatrix <: MatElem{ArbFieldElem} function ArbMatrix(r::Int, c::Int, arr::AbstractMatrix{T}) where {T <: Union{Int, UInt, ZZRingElem, Float64, BigFloat, ArbFieldElem}} z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{ArbMatrix}, Int, Int), z, r, c) finalizer(_arb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:arb_mat_entry_ptr, libarb), Ptr{ArbFieldElem}, + el = ccall((:arb_mat_entry_ptr, libflint), Ptr{ArbFieldElem}, (Ref{ArbMatrix}, Int, Int), z, i - 1, j - 1) Nemo._arb_set(el, arr[i, j]) end @@ -1054,12 +1054,12 @@ mutable struct ArbMatrix <: MatElem{ArbFieldElem} function ArbMatrix(r::Int, c::Int, arr::AbstractVector{T}) where {T <: Union{Int, UInt, ZZRingElem, Float64, BigFloat, ArbFieldElem}} z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{ArbMatrix}, Int, Int), z, r, c) finalizer(_arb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:arb_mat_entry_ptr, libarb), Ptr{ArbFieldElem}, + el = ccall((:arb_mat_entry_ptr, libflint), Ptr{ArbFieldElem}, (Ref{ArbMatrix}, Int, Int), z, i - 1, j - 1) Nemo._arb_set(el, arr[(i-1)*c+j]) end @@ -1069,12 +1069,12 @@ mutable struct ArbMatrix <: MatElem{ArbFieldElem} function ArbMatrix(r::Int, c::Int, arr::AbstractMatrix{T}, prec::Int) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, ArbFieldElem, AbstractString}} z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{ArbMatrix}, Int, Int), z, r, c) finalizer(_arb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:arb_mat_entry_ptr, libarb), Ptr{ArbFieldElem}, + el = ccall((:arb_mat_entry_ptr, libflint), Ptr{ArbFieldElem}, (Ref{ArbMatrix}, Int, Int), z, i - 1, j - 1) _arb_set(el, arr[i, j], prec) end @@ -1084,12 +1084,12 @@ mutable struct ArbMatrix <: MatElem{ArbFieldElem} function ArbMatrix(r::Int, c::Int, arr::AbstractVector{T}, prec::Int) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, ArbFieldElem, AbstractString}} z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{ArbMatrix}, Int, Int), z, r, c) finalizer(_arb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:arb_mat_entry_ptr, libarb), Ptr{ArbFieldElem}, + el = ccall((:arb_mat_entry_ptr, libflint), Ptr{ArbFieldElem}, (Ref{ArbMatrix}, Int, Int), z, i - 1, j - 1) _arb_set(el, arr[(i-1)*c+j], prec) end @@ -1099,9 +1099,9 @@ mutable struct ArbMatrix <: MatElem{ArbFieldElem} function ArbMatrix(a::QQMatrix, prec::Int) z = new() - ccall((:arb_mat_init, libarb), Nothing, + ccall((:arb_mat_init, libflint), Nothing, (Ref{ArbMatrix}, Int, Int), z, a.r, a.c) - ccall((:arb_mat_set_fmpq_mat, libarb), Nothing, + ccall((:arb_mat_set_fmpq_mat, libflint), Nothing, (Ref{ArbMatrix}, Ref{QQMatrix}, Int), z, a, prec) finalizer(_arb_mat_clear_fn, z) return z @@ -1109,7 +1109,7 @@ mutable struct ArbMatrix <: MatElem{ArbFieldElem} end function _arb_mat_clear_fn(x::ArbMatrix) - ccall((:arb_mat_clear, libarb), Nothing, (Ref{ArbMatrix}, ), x) + ccall((:arb_mat_clear, libflint), Nothing, (Ref{ArbMatrix}, ), x) end ################################################################################ @@ -1140,16 +1140,16 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int) z = new() - ccall((:acb_mat_init, libarb), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) return z end function ComplexMat(a::ZZMatrix) z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, a.r, a.c) - ccall((:acb_mat_set_fmpz_mat, libarb), Nothing, + ccall((:acb_mat_set_fmpz_mat, libflint), Nothing, (Ref{ComplexMat}, Ref{ZZMatrix}), z, a) finalizer(_acb_mat_clear_fn, z) return z @@ -1157,9 +1157,9 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(a::ZZMatrix, prec::Int) z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, a.r, a.c) - ccall((:acb_mat_set_round_fmpz_mat, libarb), Nothing, + ccall((:acb_mat_set_round_fmpz_mat, libflint), Nothing, (Ref{ComplexMat}, Ref{ZZMatrix}, Int), z, a, prec) finalizer(_acb_mat_clear_fn, z) return z @@ -1167,9 +1167,9 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(a::RealMat) z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, a.r, a.c) - ccall((:acb_mat_set_arb_mat, libarb), Nothing, + ccall((:acb_mat_set_arb_mat, libflint), Nothing, (Ref{ComplexMat}, Ref{ArbMatrix}), z, a) finalizer(_acb_mat_clear_fn, z) return z @@ -1177,9 +1177,9 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(a::ArbMatrix, prec::Int) z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, a.r, a.c) - ccall((:acb_mat_set_round_arb_mat, libarb), Nothing, + ccall((:acb_mat_set_round_arb_mat, libflint), Nothing, (Ref{ComplexMat}, Ref{ArbMatrix}, Int), z, a, prec) finalizer(_acb_mat_clear_fn, z) return z @@ -1187,12 +1187,12 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int, arr::AbstractMatrix{T}) where {T <: Union{Int, UInt, Float64, ZZRingElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{ComplexMat}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[i, j]) end @@ -1202,12 +1202,12 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int, arr::AbstractMatrix{T}) where {T <: Union{BigFloat, ComplexFieldElem, RealFieldElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{ComplexMat}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[i, j]) end @@ -1217,12 +1217,12 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int, arr::AbstractVector{T}) where {T <: Union{Int, UInt, Float64, ZZRingElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{ComplexMat}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[(i-1)*c+j]) end @@ -1232,12 +1232,12 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int, arr::AbstractVector{T}) where {T <: Union{BigFloat, ComplexFieldElem, RealFieldElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{ComplexMat}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[(i-1)*c+j]) end @@ -1247,12 +1247,12 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int, arr::AbstractMatrix{T}, prec::Int) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{ComplexMat}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[i, j], prec) end @@ -1262,12 +1262,12 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int, arr::AbstractMatrix{T}, prec::Int) where {T <: Union{BigFloat, RealFieldElem, AbstractString, ComplexFieldElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{ComplexFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{ComplexFieldElem}, (Ref{ComplexMat}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[i, j], prec) end @@ -1277,12 +1277,12 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int, arr::AbstractVector{T}, prec::Int) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{ComplexFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{ComplexFieldElem}, (Ref{ComplexMat}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[(i-1)*c+j], prec) end @@ -1292,12 +1292,12 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int, arr::AbstractVector{T}, prec::Int) where {T <: Union{BigFloat, RealFieldElem, AbstractString, ComplexFieldElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{ComplexFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{ComplexFieldElem}, (Ref{ComplexMat}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[(i-1)*c+j], prec) end @@ -1308,12 +1308,12 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int, arr::AbstractMatrix{Tuple{T, T}}, prec::Int) where {T <: Union{Int, UInt, Float64, ZZRingElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{ComplexFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{ComplexFieldElem}, (Ref{ComplexMat}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[i, j][1], arr[i,j][2], prec) end @@ -1324,12 +1324,12 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int, arr::AbstractMatrix{Tuple{T, T}}, prec::Int) where {T <: Union{QQFieldElem, BigFloat, RealFieldElem, AbstractString}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{ComplexFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{ComplexFieldElem}, (Ref{ComplexMat}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[i, j][1], arr[i,j][2], prec) end @@ -1340,12 +1340,12 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int, arr::AbstractVector{Tuple{T, T}}, prec::Int) where {T <: Union{Int, UInt, Float64, ZZRingElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{ComplexFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{ComplexFieldElem}, (Ref{ComplexMat}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[(i-1)*c+j][1], arr[(i-1)*c+j][2], prec) end @@ -1356,12 +1356,12 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(r::Int, c::Int, arr::AbstractVector{Tuple{T, T}}, prec::Int) where {T <: Union{QQFieldElem, BigFloat, RealFieldElem, AbstractString}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{ComplexFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{ComplexFieldElem}, (Ref{ComplexMat}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[(i-1)*c+j][1], arr[(i-1)*c+j][2], prec) end @@ -1371,9 +1371,9 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} function ComplexMat(a::QQMatrix, prec::Int) z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{ComplexMat}, Int, Int), z, a.r, a.c) - ccall((:acb_mat_set_fmpq_mat, libarb), Nothing, + ccall((:acb_mat_set_fmpq_mat, libflint), Nothing, (Ref{ComplexMat}, Ref{QQMatrix}, Int), z, a, prec) finalizer(_acb_mat_clear_fn, z) return z @@ -1381,7 +1381,7 @@ mutable struct ComplexMat <: MatElem{ComplexFieldElem} end function _acb_mat_clear_fn(x::ComplexMat) - ccall((:acb_mat_clear, libarb), Nothing, (Ref{ComplexMat}, ), x) + ccall((:acb_mat_clear, libflint), Nothing, (Ref{ComplexMat}, ), x) end # fixed precision @@ -1408,16 +1408,16 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int) z = new() - ccall((:acb_mat_init, libarb), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) return z end function AcbMatrix(a::ZZMatrix) z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, a.r, a.c) - ccall((:acb_mat_set_fmpz_mat, libarb), Nothing, + ccall((:acb_mat_set_fmpz_mat, libflint), Nothing, (Ref{AcbMatrix}, Ref{ZZMatrix}), z, a) finalizer(_acb_mat_clear_fn, z) return z @@ -1425,9 +1425,9 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(a::ZZMatrix, prec::Int) z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, a.r, a.c) - ccall((:acb_mat_set_round_fmpz_mat, libarb), Nothing, + ccall((:acb_mat_set_round_fmpz_mat, libflint), Nothing, (Ref{AcbMatrix}, Ref{ZZMatrix}, Int), z, a, prec) finalizer(_acb_mat_clear_fn, z) return z @@ -1435,9 +1435,9 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(a::ArbMatrix) z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, a.r, a.c) - ccall((:acb_mat_set_arb_mat, libarb), Nothing, + ccall((:acb_mat_set_arb_mat, libflint), Nothing, (Ref{AcbMatrix}, Ref{ArbMatrix}), z, a) finalizer(_acb_mat_clear_fn, z) return z @@ -1445,9 +1445,9 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(a::ArbMatrix, prec::Int) z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, a.r, a.c) - ccall((:acb_mat_set_round_arb_mat, libarb), Nothing, + ccall((:acb_mat_set_round_arb_mat, libflint), Nothing, (Ref{AcbMatrix}, Ref{ArbMatrix}, Int), z, a, prec) finalizer(_acb_mat_clear_fn, z) return z @@ -1455,12 +1455,12 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int, arr::AbstractMatrix{T}) where {T <: Union{Int, UInt, Float64, ZZRingElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[i, j]) end @@ -1470,12 +1470,12 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int, arr::AbstractMatrix{T}) where {T <: Union{BigFloat, AcbFieldElem, ArbFieldElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[i, j]) end @@ -1485,12 +1485,12 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int, arr::AbstractVector{T}) where {T <: Union{Int, UInt, Float64, ZZRingElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[(i-1)*c+j]) end @@ -1500,12 +1500,12 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int, arr::AbstractVector{T}) where {T <: Union{BigFloat, AcbFieldElem, ArbFieldElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[(i-1)*c+j]) end @@ -1515,12 +1515,12 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int, arr::AbstractMatrix{T}, prec::Int) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[i, j], prec) end @@ -1530,12 +1530,12 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int, arr::AbstractMatrix{T}, prec::Int) where {T <: Union{BigFloat, ArbFieldElem, AbstractString, AcbFieldElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[i, j], prec) end @@ -1545,12 +1545,12 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int, arr::AbstractVector{T}, prec::Int) where {T <: Union{Int, UInt, ZZRingElem, QQFieldElem, Float64}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[(i-1)*c+j], prec) end @@ -1560,12 +1560,12 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int, arr::AbstractVector{T}, prec::Int) where {T <: Union{BigFloat, ArbFieldElem, AbstractString, AcbFieldElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[(i-1)*c+j], prec) end @@ -1576,12 +1576,12 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int, arr::AbstractMatrix{Tuple{T, T}}, prec::Int) where {T <: Union{Int, UInt, Float64, ZZRingElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[i, j][1], arr[i,j][2], prec) end @@ -1592,12 +1592,12 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int, arr::AbstractMatrix{Tuple{T, T}}, prec::Int) where {T <: Union{QQFieldElem, BigFloat, ArbFieldElem, AbstractString}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[i, j][1], arr[i,j][2], prec) end @@ -1608,12 +1608,12 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int, arr::AbstractVector{Tuple{T, T}}, prec::Int) where {T <: Union{Int, UInt, Float64, ZZRingElem}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[(i-1)*c+j][1], arr[(i-1)*c+j][2], prec) end @@ -1624,12 +1624,12 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(r::Int, c::Int, arr::AbstractVector{Tuple{T, T}}, prec::Int) where {T <: Union{QQFieldElem, BigFloat, ArbFieldElem, AbstractString}} z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, r, c) finalizer(_acb_mat_clear_fn, z) GC.@preserve z for i = 1:r for j = 1:c - el = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + el = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), z, i - 1, j - 1) _acb_set(el, arr[(i-1)*c+j][1], arr[(i-1)*c+j][2], prec) end @@ -1639,9 +1639,9 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} function AcbMatrix(a::QQMatrix, prec::Int) z = new() - ccall((:acb_mat_init, libarb), Nothing, + ccall((:acb_mat_init, libflint), Nothing, (Ref{AcbMatrix}, Int, Int), z, a.r, a.c) - ccall((:acb_mat_set_fmpq_mat, libarb), Nothing, + ccall((:acb_mat_set_fmpq_mat, libflint), Nothing, (Ref{AcbMatrix}, Ref{QQMatrix}, Int), z, a, prec) finalizer(_acb_mat_clear_fn, z) return z @@ -1649,6 +1649,6 @@ mutable struct AcbMatrix <: MatElem{AcbFieldElem} end function _acb_mat_clear_fn(x::AcbMatrix) - ccall((:acb_mat_clear, libarb), Nothing, (Ref{AcbMatrix}, ), x) + ccall((:acb_mat_clear, libflint), Nothing, (Ref{AcbMatrix}, ), x) end diff --git a/src/arb/Complex.jl b/src/arb/Complex.jl index ad0422c99..da37eaa5f 100644 --- a/src/arb/Complex.jl +++ b/src/arb/Complex.jl @@ -34,7 +34,7 @@ end function one(r::ComplexField) z = ComplexFieldElem() - ccall((:acb_one, libarb), Nothing, (Ref{ComplexFieldElem}, ), z) + ccall((:acb_one, libflint), Nothing, (Ref{ComplexFieldElem}, ), z) return z end @@ -45,7 +45,7 @@ Return exact one times $i$ in the given Arb complex field. """ function onei(r::ComplexField) z = ComplexFieldElem() - ccall((:acb_onei, libarb), Nothing, (Ref{ComplexFieldElem}, ), z) + ccall((:acb_onei, libflint), Nothing, (Ref{ComplexFieldElem}, ), z) return z end @@ -57,12 +57,12 @@ Return the relative accuracy of $x$ measured in bits, capped between """ function accuracy_bits(x::ComplexFieldElem) # bug in acb.h: rel_accuracy_bits is not in the library - return -ccall((:acb_rel_error_bits, libarb), Int, (Ref{ComplexFieldElem},), x) + return -ccall((:acb_rel_error_bits, libflint), Int, (Ref{ComplexFieldElem},), x) end function deepcopy_internal(a::ComplexFieldElem, dict::IdDict) b = ComplexFieldElem() - ccall((:acb_set, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), b, a) + ccall((:acb_set, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), b, a) return b end @@ -86,13 +86,13 @@ characteristic(::ComplexField) = 0 function convert(::Type{ComplexF64}, x::ComplexFieldElem) GC.@preserve x begin - re = ccall((:acb_real_ptr, libarb), Ptr{arb_struct}, (Ref{ComplexFieldElem}, ), x) - im = ccall((:acb_imag_ptr, libarb), Ptr{arb_struct}, (Ref{ComplexFieldElem}, ), x) - t = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (Ptr{RealFieldElem}, ), re) - u = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (Ptr{RealFieldElem}, ), im) + re = ccall((:acb_real_ptr, libflint), Ptr{arb_struct}, (Ref{ComplexFieldElem}, ), x) + im = ccall((:acb_imag_ptr, libflint), Ptr{arb_struct}, (Ref{ComplexFieldElem}, ), x) + t = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ptr{RealFieldElem}, ), re) + u = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ptr{RealFieldElem}, ), im) # 4 == round to nearest - v = ccall((:arf_get_d, libarb), Float64, (Ptr{arf_struct}, Int), t, 4) - w = ccall((:arf_get_d, libarb), Float64, (Ptr{arf_struct}, Int), u, 4) + v = ccall((:arf_get_d, libflint), Float64, (Ptr{arf_struct}, Int), t, 4) + w = ccall((:arf_get_d, libflint), Float64, (Ptr{arf_struct}, Int), u, 4) end return complex(v, w) end @@ -105,13 +105,13 @@ end function real(x::ComplexFieldElem) z = RealFieldElem() - ccall((:acb_get_real, libarb), Nothing, (Ref{RealFieldElem}, Ref{ComplexFieldElem}), z, x) + ccall((:acb_get_real, libflint), Nothing, (Ref{RealFieldElem}, Ref{ComplexFieldElem}), z, x) return z end function imag(x::ComplexFieldElem) z = RealFieldElem() - ccall((:acb_get_imag, libarb), Nothing, (Ref{RealFieldElem}, Ref{ComplexFieldElem}), z, x) + ccall((:acb_get_imag, libflint), Nothing, (Ref{RealFieldElem}, Ref{ComplexFieldElem}), z, x) return z end @@ -162,7 +162,7 @@ end function -(x::ComplexFieldElem) z = ComplexFieldElem() - ccall((:acb_neg, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, x) + ccall((:acb_neg, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, x) return z end @@ -178,7 +178,7 @@ for (s,f) in ((:+,"acb_add"), (:*,"acb_mul"), (://, "acb_div"), (:-,"acb_sub"), @eval begin function ($s)(x::ComplexFieldElem, y::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall(($f, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), + ccall(($f, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, y, prec) return z end @@ -190,7 +190,7 @@ for (f,s) in ((:+, "add"), (:-, "sub"), (:*, "mul"), (://, "div"), (:^, "pow")) function ($f)(x::ComplexFieldElem, y::UInt, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall(($("acb_"*s*"_ui"), libarb), Nothing, + ccall(($("acb_"*s*"_ui"), libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, UInt, Int), z, x, y, prec) return z @@ -198,14 +198,14 @@ for (f,s) in ((:+, "add"), (:-, "sub"), (:*, "mul"), (://, "div"), (:^, "pow")) function ($f)(x::ComplexFieldElem, y::Int, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall(($("acb_"*s*"_si"), libarb), Nothing, + ccall(($("acb_"*s*"_si"), libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int, Int), z, x, y, prec) return z end function ($f)(x::ComplexFieldElem, y::ZZRingElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall(($("acb_"*s*"_fmpz"), libarb), Nothing, + ccall(($("acb_"*s*"_fmpz"), libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ZZRingElem}, Int), z, x, y, prec) return z @@ -213,7 +213,7 @@ for (f,s) in ((:+, "add"), (:-, "sub"), (:*, "mul"), (://, "div"), (:^, "pow")) function ($f)(x::ComplexFieldElem, y::RealFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall(($("acb_"*s*"_arb"), libarb), Nothing, + ccall(($("acb_"*s*"_arb"), libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{RealFieldElem}, Int), z, x, y, prec) return z @@ -242,29 +242,29 @@ end function -(x::UInt, y::ComplexFieldElem) z = ComplexFieldElem() - ccall((:acb_sub_ui, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, UInt, Int), z, y, x, precision(Balls)) - ccall((:acb_neg, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, z) + ccall((:acb_sub_ui, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, UInt, Int), z, y, x, precision(Balls)) + ccall((:acb_neg, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, z) return z end function -(x::Int, y::ComplexFieldElem) z = ComplexFieldElem() - ccall((:acb_sub_si, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int, Int), z, y, x, precision(Balls)) - ccall((:acb_neg, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, z) + ccall((:acb_sub_si, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int, Int), z, y, x, precision(Balls)) + ccall((:acb_neg, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, z) return z end function -(x::ZZRingElem, y::ComplexFieldElem) z = ComplexFieldElem() - ccall((:acb_sub_fmpz, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ZZRingElem}, Int), z, y, x, precision(Balls)) - ccall((:acb_neg, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, z) + ccall((:acb_sub_fmpz, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ZZRingElem}, Int), z, y, x, precision(Balls)) + ccall((:acb_neg, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, z) return z end function -(x::RealFieldElem, y::ComplexFieldElem) z = ComplexFieldElem() - ccall((:acb_sub_arb, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{RealFieldElem}, Int), z, y, x, precision(Balls)) - ccall((:acb_neg, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, z) + ccall((:acb_sub_arb, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{RealFieldElem}, Int), z, y, x, precision(Balls)) + ccall((:acb_neg, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, z) return z end @@ -333,17 +333,17 @@ Return `true` if the boxes $x$ and $y$ are precisely equal, i.e. their real and imaginary parts have the same midpoints and radii. """ function isequal(x::ComplexFieldElem, y::ComplexFieldElem) - r = ccall((:acb_equal, libarb), Cint, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), x, y) + r = ccall((:acb_equal, libflint), Cint, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), x, y) return Bool(r) end function ==(x::ComplexFieldElem, y::ComplexFieldElem) - r = ccall((:acb_eq, libarb), Cint, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), x, y) + r = ccall((:acb_eq, libflint), Cint, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), x, y) return Bool(r) end function !=(x::ComplexFieldElem, y::ComplexFieldElem) - r = ccall((:acb_ne, libarb), Cint, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), x, y) + r = ccall((:acb_ne, libflint), Cint, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), x, y) return Bool(r) end @@ -387,7 +387,7 @@ Returns `true` if any part of the box $x$ overlaps any part of the box $y$, otherwise return `false`. """ function overlaps(x::ComplexFieldElem, y::ComplexFieldElem) - r = ccall((:acb_overlaps, libarb), Cint, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), x, y) + r = ccall((:acb_overlaps, libflint), Cint, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), x, y) return Bool(r) end @@ -398,7 +398,7 @@ Returns `true` if the box $x$ contains the box $y$, otherwise return `false`. """ function contains(x::ComplexFieldElem, y::ComplexFieldElem) - r = ccall((:acb_contains, libarb), Cint, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), x, y) + r = ccall((:acb_contains, libflint), Cint, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), x, y) return Bool(r) end @@ -409,7 +409,7 @@ Returns `true` if the box $x$ contains the given rational value, otherwise return `false`. """ function contains(x::ComplexFieldElem, y::QQFieldElem) - r = ccall((:acb_contains_fmpq, libarb), Cint, (Ref{ComplexFieldElem}, Ref{QQFieldElem}), x, y) + r = ccall((:acb_contains_fmpq, libflint), Cint, (Ref{ComplexFieldElem}, Ref{QQFieldElem}), x, y) return Bool(r) end @@ -420,13 +420,13 @@ Returns `true` if the box $x$ contains the given integer value, otherwise return `false`. """ function contains(x::ComplexFieldElem, y::ZZRingElem) - r = ccall((:acb_contains_fmpz, libarb), Cint, (Ref{ComplexFieldElem}, Ref{ZZRingElem}), x, y) + r = ccall((:acb_contains_fmpz, libflint), Cint, (Ref{ComplexFieldElem}, Ref{ZZRingElem}), x, y) return Bool(r) end function contains(x::ComplexFieldElem, y::Int) v = ZZRingElem(y) - r = ccall((:acb_contains_fmpz, libarb), Cint, (Ref{ComplexFieldElem}, Ref{ZZRingElem}), x, v) + r = ccall((:acb_contains_fmpz, libflint), Cint, (Ref{ComplexFieldElem}, Ref{ZZRingElem}), x, v) return Bool(r) end @@ -452,7 +452,7 @@ contains(x::ComplexFieldElem, y::Rational{T}) where {T <: Integer} = contains(x, Returns `true` if the box $x$ contains zero, otherwise return `false`. """ function contains_zero(x::ComplexFieldElem) - return Bool(ccall((:acb_contains_zero, libarb), Cint, (Ref{ComplexFieldElem},), x)) + return Bool(ccall((:acb_contains_zero, libflint), Cint, (Ref{ComplexFieldElem},), x)) end ################################################################################ @@ -471,7 +471,7 @@ end Return `true` if $x$ is certainly zero, otherwise return `false`. """ function iszero(x::ComplexFieldElem) - return Bool(ccall((:acb_is_zero, libarb), Cint, (Ref{ComplexFieldElem},), x)) + return Bool(ccall((:acb_is_zero, libflint), Cint, (Ref{ComplexFieldElem},), x)) end @doc raw""" @@ -480,7 +480,7 @@ end Return `true` if $x$ is certainly one, otherwise return `false`. """ function isone(x::ComplexFieldElem) - return Bool(ccall((:acb_is_one, libarb), Cint, (Ref{ComplexFieldElem},), x)) + return Bool(ccall((:acb_is_one, libflint), Cint, (Ref{ComplexFieldElem},), x)) end @doc raw""" @@ -490,7 +490,7 @@ Return `true` if $x$ is finite, i.e. its real and imaginary parts have finite midpoint and radius, otherwise return `false`. """ function isfinite(x::ComplexFieldElem) - return Bool(ccall((:acb_is_finite, libarb), Cint, (Ref{ComplexFieldElem},), x)) + return Bool(ccall((:acb_is_finite, libflint), Cint, (Ref{ComplexFieldElem},), x)) end @doc raw""" @@ -500,7 +500,7 @@ Return `true` if $x$ is exact, i.e. has its real and imaginary parts have zero radius, otherwise return `false`. """ function is_exact(x::ComplexFieldElem) - return Bool(ccall((:acb_is_exact, libarb), Cint, (Ref{ComplexFieldElem},), x)) + return Bool(ccall((:acb_is_exact, libflint), Cint, (Ref{ComplexFieldElem},), x)) end @doc raw""" @@ -509,11 +509,11 @@ end Return `true` if $x$ is an exact integer, otherwise return `false`. """ function isinteger(x::ComplexFieldElem) - return Bool(ccall((:acb_is_int, libarb), Cint, (Ref{ComplexFieldElem},), x)) + return Bool(ccall((:acb_is_int, libflint), Cint, (Ref{ComplexFieldElem},), x)) end function isreal(x::ComplexFieldElem) - return Bool(ccall((:acb_is_real, libarb), Cint, (Ref{ComplexFieldElem},), x)) + return Bool(ccall((:acb_is_real, libflint), Cint, (Ref{ComplexFieldElem},), x)) end is_negative(x::ComplexFieldElem) = isreal(x) && is_negative(real(x)) @@ -526,7 +526,7 @@ is_negative(x::ComplexFieldElem) = isreal(x) && is_negative(real(x)) function abs(x::ComplexFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:acb_abs, libarb), Nothing, + ccall((:acb_abs, libflint), Nothing, (Ref{RealFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -539,7 +539,7 @@ end function inv(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_inv, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_inv, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -551,14 +551,14 @@ end function ldexp(x::ComplexFieldElem, y::Int) z = ComplexFieldElem() - ccall((:acb_mul_2exp_si, libarb), Nothing, + ccall((:acb_mul_2exp_si, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, y) return z end function ldexp(x::ComplexFieldElem, y::ZZRingElem) z = ComplexFieldElem() - ccall((:acb_mul_2exp_fmpz, libarb), Nothing, + ccall((:acb_mul_2exp_fmpz, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ZZRingElem}), z, x, y) return z end @@ -577,7 +577,7 @@ by rounding off insignificant bits from midpoints. """ function trim(x::ComplexFieldElem) z = ComplexFieldElem() - ccall((:acb_trim, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, x) + ccall((:acb_trim, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, x) return z end @@ -591,20 +591,20 @@ integer. """ function unique_integer(x::ComplexFieldElem) z = ZZRingElem() - unique = ccall((:acb_get_unique_fmpz, libarb), Int, + unique = ccall((:acb_get_unique_fmpz, libflint), Int, (Ref{ZZRingElem}, Ref{ComplexFieldElem}), z, x) return (unique != 0, z) end function conj(x::ComplexFieldElem) z = ComplexFieldElem() - ccall((:acb_conj, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, x) + ccall((:acb_conj, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}), z, x) return z end function angle(x::ComplexFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:acb_arg, libarb), Nothing, + ccall((:acb_arg, libflint), Nothing, (Ref{RealFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -622,7 +622,7 @@ Return $\pi = 3.14159\ldots$ as an element of $r$. """ function const_pi(r::ComplexField, prec::Int = precision(Balls)) z = r() - ccall((:acb_const_pi, libarb), Nothing, (Ref{ComplexFieldElem}, Int), z, prec) + ccall((:acb_const_pi, libflint), Nothing, (Ref{ComplexFieldElem}, Int), z, prec) return z end @@ -636,7 +636,7 @@ end function Base.sqrt(x::ComplexFieldElem, prec::Int = precision(Balls); check::Bool=true) z = ComplexFieldElem() - ccall((:acb_sqrt, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_sqrt, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -647,7 +647,7 @@ Return the reciprocal of the square root of $x$, i.e. $1/\sqrt{x}$. """ function rsqrt(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_rsqrt, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_rsqrt, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -663,32 +663,32 @@ function root(x::ComplexFieldElem, n::Int, prec::Int = precision(Balls)) n = -n x = inv(x) end - ccall((:acb_root_ui, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, UInt, Int), z, x, UInt(n), prec) + ccall((:acb_root_ui, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, UInt, Int), z, x, UInt(n), prec) return z end function log(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_log, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_log, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function log1p(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_log1p, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_log1p, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function Base.exp(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_exp, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_exp, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function Base.expm1(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_expm1, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_expm1, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -699,7 +699,7 @@ Return the exponential of $\pi i x$. """ function cispi(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_exp_pi_i, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_exp_pi_i, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -711,85 +711,85 @@ Return $\exp(2\pi i/k)$. function root_of_unity(C::ComplexField, k::Int, prec::Int = precision(Balls)) k <= 0 && throw(ArgumentError("Order must be positive ($k)")) z = C() - ccall((:acb_unit_root, libarb), Nothing, (Ref{ComplexFieldElem}, UInt, Int), z, k, prec) + ccall((:acb_unit_root, libflint), Nothing, (Ref{ComplexFieldElem}, UInt, Int), z, k, prec) return z end function sin(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_sin, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_sin, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function cos(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_cos, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_cos, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function tan(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_tan, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_tan, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function cot(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_cot, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_cot, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function sinpi(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_sin_pi, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_sin_pi, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function cospi(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_cos_pi, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_cos_pi, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function tanpi(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_tan_pi, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_tan_pi, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function cotpi(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_cot_pi, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_cot_pi, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function sinh(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_sinh, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_sinh, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function cosh(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_cosh, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_cosh, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function tanh(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_tanh, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_tanh, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function coth(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_coth, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_coth, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function atan(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_atan, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_atan, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -800,7 +800,7 @@ Return $\log\sin(\pi x)$, constructed without branch cuts off the real line. """ function log_sinpi(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_log_sin_pi, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_log_sin_pi, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -811,7 +811,7 @@ Return the Gamma function evaluated at $x$. """ function gamma(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_gamma, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_gamma, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -822,7 +822,7 @@ Return the reciprocal of the Gamma function evaluated at $x$. """ function rgamma(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_rgamma, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_rgamma, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -833,7 +833,7 @@ Return the logarithm of the Gamma function evaluated at $x$. """ function lgamma(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_lgamma, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_lgamma, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -845,7 +845,7 @@ i.e. $\psi(x)$. """ function digamma(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_digamma, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_digamma, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -856,7 +856,7 @@ Return the Riemann zeta function evaluated at $x$. """ function zeta(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_zeta, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_zeta, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -867,7 +867,7 @@ Return the Barnes $G$-function, evaluated at $x$. """ function barnes_g(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_barnes_g, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_barnes_g, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -878,7 +878,7 @@ Return the logarithm of the Barnes $G$-function, evaluated at $x$. """ function log_barnes_g(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_log_barnes_g, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_log_barnes_g, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -889,7 +889,7 @@ Return the arithmetic-geometric mean of $1$ and $x$. """ function agm(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_agm1, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_agm1, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -900,7 +900,7 @@ Return the error function evaluated at $x$. """ function erf(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_erf, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_hypgeom_erf, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -911,7 +911,7 @@ Return the imaginary error function evaluated at $x$. """ function erfi(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_erfi, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_hypgeom_erfi, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -922,7 +922,7 @@ Return the complementary error function evaluated at $x$. """ function erfc(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_erfc, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_hypgeom_erfc, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -933,7 +933,7 @@ Return the exponential integral evaluated at $x$. """ function exp_integral_ei(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_ei, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_hypgeom_ei, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -944,7 +944,7 @@ Return the sine integral evaluated at $x$. """ function sin_integral(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_si, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_hypgeom_si, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -955,7 +955,7 @@ Return the exponential cosine integral evaluated at $x$. """ function cos_integral(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_ci, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_hypgeom_ci, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -966,7 +966,7 @@ Return the hyperbolic sine integral evaluated at $x$. """ function sinh_integral(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_shi, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_hypgeom_shi, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -977,7 +977,7 @@ Return the hyperbolic cosine integral evaluated at $x$. """ function cosh_integral(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_chi, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_hypgeom_chi, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -988,7 +988,7 @@ Return the Dedekind eta function $\eta(\tau)$ at $\tau = x$. """ function dedekind_eta(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_modular_eta, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_modular_eta, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -1036,7 +1036,7 @@ Return the $j$-invariant $j(\tau)$ at $\tau = x$. """ function j_invariant(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_modular_j, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_modular_j, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -1047,7 +1047,7 @@ Return the modular lambda function $\lambda(\tau)$ at $\tau = x$. """ function modular_lambda(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_modular_lambda, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_modular_lambda, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -1058,7 +1058,7 @@ Return the modular delta function $\Delta(\tau)$ at $\tau = x$. """ function modular_delta(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_modular_delta, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_modular_delta, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -1078,7 +1078,7 @@ function eisenstein_g(k::Int, x::ComplexFieldElem, prec::Int = precision(Balls)) len = div(k, 2) - 1 vec = acb_vec(len) - ccall((:acb_modular_eisenstein, libarb), Nothing, + ccall((:acb_modular_eisenstein, libflint), Nothing, (Ptr{acb_struct}, Ref{ComplexFieldElem}, Int, Int), vec, x, len, prec) z = array(CC, vec, len) acb_vec_clear(vec, len) @@ -1094,7 +1094,7 @@ which is only defined for $D < 0$ and $D \equiv 0, 1 \pmod 4$. function hilbert_class_polynomial(D::Int, R::ZZPolyRing) D < 0 && mod(D, 4) < 2 || throw(ArgumentError("$D is not a negative discriminant")) z = R() - ccall((:acb_modular_hilbert_class_poly, Nemo.libarb), Nothing, + ccall((:acb_modular_hilbert_class_poly, Nemo.libflint), Nothing, (Ref{ZZPolyRingElem}, Int), z, D) return z @@ -1107,7 +1107,7 @@ Return the complete elliptic integral $K(x)$. """ function elliptic_k(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_modular_elliptic_k, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_modular_elliptic_k, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end @@ -1118,14 +1118,14 @@ Return the complete elliptic integral $E(x)$. """ function elliptic_e(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_modular_elliptic_e, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) + ccall((:acb_modular_elliptic_e, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, prec) return z end function sincos(x::ComplexFieldElem, prec::Int = precision(Balls)) s = ComplexFieldElem() c = ComplexFieldElem() - ccall((:acb_sin_cos, libarb), Nothing, + ccall((:acb_sin_cos, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), s, c, x, prec) return (s, c) end @@ -1133,7 +1133,7 @@ end function sincospi(x::ComplexFieldElem, prec::Int = precision(Balls)) s = ComplexFieldElem() c = ComplexFieldElem() - ccall((:acb_sin_cos_pi, libarb), Nothing, + ccall((:acb_sin_cos_pi, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), s, c, x, prec) return (s, c) end @@ -1146,7 +1146,7 @@ Return a tuple $s, c$ consisting of the hyperbolic sine and cosine of $x$. function sinhcosh(x::ComplexFieldElem, prec::Int = precision(Balls)) s = ComplexFieldElem() c = ComplexFieldElem() - ccall((:acb_sinh_cosh, libarb), Nothing, + ccall((:acb_sinh_cosh, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), s, c, x, prec) return (s, c) end @@ -1158,7 +1158,7 @@ Return the Hurwitz zeta function $\zeta(s,a)$. """ function zeta(s::ComplexFieldElem, a::ComplexFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:acb_hurwitz_zeta, libarb), Nothing, + ccall((:acb_hurwitz_zeta, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, s, a, prec) return z end @@ -1170,14 +1170,14 @@ Return the generalised polygamma function $\psi(s,z)$. """ function polygamma(s::ComplexFieldElem, a::ComplexFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:acb_polygamma, libarb), Nothing, + ccall((:acb_polygamma, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, s, a, prec) return z end function rising_factorial(x::ComplexFieldElem, n::UInt, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_rising_ui, libarb), Nothing, + ccall((:acb_rising_ui, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, UInt, Int), z, x, n, prec) return z end @@ -1195,7 +1195,7 @@ end function rising_factorial2(x::ComplexFieldElem, n::UInt, prec::Int = precision(Balls)) z = ComplexFieldElem() w = ComplexFieldElem() - ccall((:acb_rising2_ui, libarb), Nothing, + ccall((:acb_rising2_ui, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, UInt, Int), z, w, x, n, prec) return (z, w) end @@ -1213,14 +1213,14 @@ end function polylog(s::ComplexFieldElem, a::ComplexFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:acb_polylog, libarb), Nothing, + ccall((:acb_polylog, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, s, a, prec) return z end function polylog(s::Int, a::ComplexFieldElem, prec::Int = precision(Balls)) z = parent(a)() - ccall((:acb_polylog_si, libarb), Nothing, + ccall((:acb_polylog_si, libflint), Nothing, (Ref{ComplexFieldElem}, Int, Ref{ComplexFieldElem}, Int), z, s, a, prec) return z end @@ -1238,7 +1238,7 @@ Return the logarithmic integral, evaluated at $x$. """ function log_integral(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_li, libarb), Nothing, + ccall((:acb_hypgeom_li, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int, Int), z, x, 0, prec) return z end @@ -1250,7 +1250,7 @@ Return the offset logarithmic integral, evaluated at $x$. """ function log_integral_offset(x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_li, libarb), Nothing, + ccall((:acb_hypgeom_li, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int, Int), z, x, 1, prec) return z end @@ -1262,7 +1262,7 @@ Return the generalised exponential integral $E_s(x)$. """ function exp_integral_e(s::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:acb_hypgeom_expint, libarb), Nothing, + ccall((:acb_hypgeom_expint, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, s, x, prec) return z end @@ -1274,7 +1274,7 @@ Return the upper incomplete gamma function $\Gamma(s,x)$. """ function gamma(s::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:acb_hypgeom_gamma_upper, libarb), Nothing, + ccall((:acb_hypgeom_gamma_upper, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int, Int), z, s, x, 0, prec) return z end @@ -1287,7 +1287,7 @@ $\Gamma(s,x) / \Gamma(s)$. """ function gamma_regularized(s::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:acb_hypgeom_gamma_upper, libarb), Nothing, + ccall((:acb_hypgeom_gamma_upper, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int, Int), z, s, x, 1, prec) return z end @@ -1299,7 +1299,7 @@ Return the lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$. """ function gamma_lower(s::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:acb_hypgeom_gamma_lower, libarb), Nothing, + ccall((:acb_hypgeom_gamma_lower, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int, Int), z, s, x, 0, prec) return z end @@ -1312,7 +1312,7 @@ $\gamma(s,x) / \Gamma(s)$. """ function gamma_lower_regularized(s::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:acb_hypgeom_gamma_lower, libarb), Nothing, + ccall((:acb_hypgeom_gamma_lower, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int, Int), z, s, x, 1, prec) return z end @@ -1324,7 +1324,7 @@ Return the Bessel function $J_{\nu}(x)$. """ function bessel_j(nu::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_bessel_j, libarb), Nothing, + ccall((:acb_hypgeom_bessel_j, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, nu, x, prec) return z end @@ -1336,7 +1336,7 @@ Return the Bessel function $Y_{\nu}(x)$. """ function bessel_y(nu::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_bessel_y, libarb), Nothing, + ccall((:acb_hypgeom_bessel_y, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, nu, x, prec) return z end @@ -1348,7 +1348,7 @@ Return the Bessel function $I_{\nu}(x)$. """ function bessel_i(nu::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_bessel_i, libarb), Nothing, + ccall((:acb_hypgeom_bessel_i, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, nu, x, prec) return z end @@ -1360,7 +1360,7 @@ Return the Bessel function $K_{\nu}(x)$. """ function bessel_k(nu::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_bessel_k, libarb), Nothing, + ccall((:acb_hypgeom_bessel_k, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, nu, x, prec) return z end @@ -1372,7 +1372,7 @@ Return the Airy function $\operatorname{Ai}(x)$. """ function airy_ai(x::ComplexFieldElem, prec::Int = precision(Balls)) ai = ComplexFieldElem() - ccall((:acb_hypgeom_airy, libarb), Nothing, + ccall((:acb_hypgeom_airy, libflint), Nothing, (Ref{ComplexFieldElem}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ref{ComplexFieldElem}, Int), ai, C_NULL, C_NULL, C_NULL, x, prec) return ai @@ -1385,7 +1385,7 @@ Return the Airy function $\operatorname{Bi}(x)$. """ function airy_bi(x::ComplexFieldElem, prec::Int = precision(Balls)) bi = ComplexFieldElem() - ccall((:acb_hypgeom_airy, libarb), Nothing, + ccall((:acb_hypgeom_airy, libflint), Nothing, (Ptr{Cvoid}, Ptr{Cvoid}, Ref{ComplexFieldElem}, Ptr{Cvoid}, Ref{ComplexFieldElem}, Int), C_NULL, C_NULL, bi, C_NULL, x, prec) return bi @@ -1398,7 +1398,7 @@ Return the derivative of the Airy function $\operatorname{Ai}^\prime(x)$. """ function airy_ai_prime(x::ComplexFieldElem, prec::Int = precision(Balls)) ai_prime = ComplexFieldElem() - ccall((:acb_hypgeom_airy, libarb), Nothing, + ccall((:acb_hypgeom_airy, libflint), Nothing, (Ptr{Cvoid}, Ref{ComplexFieldElem}, Ptr{Cvoid}, Ptr{Cvoid}, Ref{ComplexFieldElem}, Int), C_NULL, ai_prime, C_NULL, C_NULL, x, prec) return ai_prime @@ -1411,7 +1411,7 @@ Return the derivative of the Airy function $\operatorname{Bi}^\prime(x)$. """ function airy_bi_prime(x::ComplexFieldElem, prec::Int = precision(Balls)) bi_prime = ComplexFieldElem() - ccall((:acb_hypgeom_airy, libarb), Nothing, + ccall((:acb_hypgeom_airy, libflint), Nothing, (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), C_NULL, C_NULL, C_NULL, bi_prime, x, prec) return bi_prime @@ -1424,7 +1424,7 @@ Return the confluent hypergeometric function ${}_1F_1(a,b,x)$. """ function hypergeometric_1f1(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_m, libarb), Nothing, + ccall((:acb_hypgeom_m, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int, Int), z, a, b, x, 0, prec) return z end @@ -1437,7 +1437,7 @@ ${}_1F_1(a,b,x) / \Gamma(b)$. """ function hypergeometric_1f1_regularized(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_m, libarb), Nothing, + ccall((:acb_hypgeom_m, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int, Int), z, a, b, x, 1, prec) return z end @@ -1449,7 +1449,7 @@ Return the confluent hypergeometric function $U(a,b,x)$. """ function hypergeometric_u(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() - ccall((:acb_hypgeom_u, libarb), Nothing, + ccall((:acb_hypgeom_u, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, a, b, x, prec) return z end @@ -1461,7 +1461,7 @@ Return the Gauss hypergeometric function ${}_2F_1(a,b,c,x)$. """ function hypergeometric_2f1(a::ComplexFieldElem, b::ComplexFieldElem, c::ComplexFieldElem, x::ComplexFieldElem, prec::Int = precision(Balls); flags=0) z = ComplexFieldElem() - ccall((:acb_hypgeom_2f1, libarb), Nothing, + ccall((:acb_hypgeom_2f1, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int, Int), z, a, b, c, x, flags, prec) return z end @@ -1477,7 +1477,7 @@ function jacobi_theta(z::ComplexFieldElem, tau::ComplexFieldElem, prec::Int = pr t2 = ComplexFieldElem() t3 = ComplexFieldElem() t4 = ComplexFieldElem() - ccall((:acb_modular_theta, libarb), Nothing, + ccall((:acb_modular_theta, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), t1, t2, t3, t4, z, tau, prec) return (t1, t2, t3, t4) @@ -1490,7 +1490,7 @@ Return the Weierstrass elliptic function $\wp(z,\tau)$. """ function weierstrass_p(z::ComplexFieldElem, tau::ComplexFieldElem, prec::Int = precision(Balls)) r = parent(z)() - ccall((:acb_elliptic_p, libarb), Nothing, + ccall((:acb_elliptic_p, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), r, z, tau, prec) return r end @@ -1502,7 +1502,7 @@ Return the derivative of the Weierstrass elliptic function $\frac{\partial}{\par """ function weierstrass_p_prime(z::ComplexFieldElem, tau::ComplexFieldElem, prec::Int = precision(Balls)) r = parent(z)() - ccall((:acb_elliptic_p_prime, libarb), Nothing, + ccall((:acb_elliptic_p_prime, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), r, z, tau, prec) return r end @@ -1586,36 +1586,36 @@ end ################################################################################ function zero!(z::ComplexFieldElem) - ccall((:acb_zero, libarb), Nothing, (Ref{ComplexFieldElem},), z) + ccall((:acb_zero, libflint), Nothing, (Ref{ComplexFieldElem},), z) return z end function add!(z::ComplexFieldElem, x::ComplexFieldElem, y::ComplexFieldElem, prec::Int = precision(Balls)) - ccall((:acb_add, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), + ccall((:acb_add, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, y, prec) return z end function addeq!(z::ComplexFieldElem, y::ComplexFieldElem, prec::Int = precision(Balls)) - ccall((:acb_add, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), + ccall((:acb_add, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, z, y, prec) return z end function sub!(z::ComplexFieldElem, x::ComplexFieldElem, y::ComplexFieldElem, prec::Int = precision(Balls)) - ccall((:acb_sub, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), + ccall((:acb_sub, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, y, prec) return z end function mul!(z::ComplexFieldElem, x::ComplexFieldElem, y::ComplexFieldElem, prec::Int = precision(Balls)) - ccall((:acb_mul, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), + ccall((:acb_mul, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, y, prec) return z end function div!(z::ComplexFieldElem, x::ComplexFieldElem, y::ComplexFieldElem, prec::Int = precision(Balls)) - ccall((:acb_div, libarb), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), + ccall((:acb_div, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int), z, x, y, prec) return z end @@ -1631,12 +1631,12 @@ for (typeofx, passtoc) in ((ComplexFieldElem, Ref{ComplexFieldElem}), (Ptr{Compl ("acb_set_d", Float64)) @eval begin function _acb_set(x::($typeofx), y::($t)) - ccall(($f, libarb), Nothing, (($passtoc), ($t)), x, y) + ccall(($f, libflint), Nothing, (($passtoc), ($t)), x, y) end function _acb_set(x::($typeofx), y::($t), p::Int) _acb_set(x, y) - ccall((:acb_set_round, libarb), Nothing, + ccall((:acb_set_round, libflint), Nothing, (($passtoc), ($passtoc), Int), x, x, p) end end @@ -1644,102 +1644,102 @@ for (typeofx, passtoc) in ((ComplexFieldElem, Ref{ComplexFieldElem}), (Ptr{Compl @eval begin function _acb_set(x::($typeofx), y::ZZRingElem) - ccall((:acb_set_fmpz, libarb), Nothing, (($passtoc), Ref{ZZRingElem}), x, y) + ccall((:acb_set_fmpz, libflint), Nothing, (($passtoc), Ref{ZZRingElem}), x, y) end function _acb_set(x::($typeofx), y::ZZRingElem, p::Int) - ccall((:acb_set_round_fmpz, libarb), Nothing, + ccall((:acb_set_round_fmpz, libflint), Nothing, (($passtoc), Ref{ZZRingElem}, Int), x, y, p) end function _acb_set(x::($typeofx), y::QQFieldElem, p::Int) - ccall((:acb_set_fmpq, libarb), Nothing, + ccall((:acb_set_fmpq, libflint), Nothing, (($passtoc), Ref{QQFieldElem}, Int), x, y, p) end function _acb_set(x::($typeofx), y::RealFieldElem) - ccall((:acb_set_arb, libarb), Nothing, (($passtoc), Ref{RealFieldElem}), x, y) + ccall((:acb_set_arb, libflint), Nothing, (($passtoc), Ref{RealFieldElem}), x, y) end function _acb_set(x::($typeofx), y::RealFieldElem, p::Int) _acb_set(x, y) - ccall((:acb_set_round, libarb), Nothing, + ccall((:acb_set_round, libflint), Nothing, (($passtoc), ($passtoc), Int), x, x, p) end function _acb_set(x::($typeofx), y::ComplexFieldElem) - ccall((:acb_set, libarb), Nothing, (($passtoc), Ref{ComplexFieldElem}), x, y) + ccall((:acb_set, libflint), Nothing, (($passtoc), Ref{ComplexFieldElem}), x, y) end function _acb_set(x::($typeofx), y::ComplexFieldElem, p::Int) - ccall((:acb_set_round, libarb), Nothing, + ccall((:acb_set_round, libflint), Nothing, (($passtoc), Ref{ComplexFieldElem}, Int), x, y, p) end function _acb_set(x::($typeofx), y::AbstractString, p::Int) - r = ccall((:acb_real_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) _arb_set(r, y, p) - i = ccall((:acb_imag_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) - ccall((:arb_zero, libarb), Nothing, (Ptr{RealFieldElem}, ), i) + i = ccall((:acb_imag_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) + ccall((:arb_zero, libflint), Nothing, (Ptr{RealFieldElem}, ), i) end function _acb_set(x::($typeofx), y::BigFloat) - r = ccall((:acb_real_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) _arb_set(r, y) - i = ccall((:acb_imag_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) - ccall((:arb_zero, libarb), Nothing, (Ptr{RealFieldElem}, ), i) + i = ccall((:acb_imag_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) + ccall((:arb_zero, libflint), Nothing, (Ptr{RealFieldElem}, ), i) end function _acb_set(x::($typeofx), y::BigFloat, p::Int) - r = ccall((:acb_real_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) _arb_set(r, y, p) - i = ccall((:acb_imag_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) - ccall((:arb_zero, libarb), Nothing, (Ptr{RealFieldElem}, ), i) + i = ccall((:acb_imag_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) + ccall((:arb_zero, libflint), Nothing, (Ptr{RealFieldElem}, ), i) end function _acb_set(x::($typeofx), y::Int, z::Int, p::Int) - ccall((:acb_set_si_si, libarb), Nothing, + ccall((:acb_set_si_si, libflint), Nothing, (($passtoc), Int, Int), x, y, z) - ccall((:acb_set_round, libarb), Nothing, + ccall((:acb_set_round, libflint), Nothing, (($passtoc), ($passtoc), Int), x, x, p) end function _acb_set(x::($typeofx), y::RealFieldElem, z::RealFieldElem) - ccall((:acb_set_arb_arb, libarb), Nothing, + ccall((:acb_set_arb_arb, libflint), Nothing, (($passtoc), Ref{RealFieldElem}, Ref{RealFieldElem}), x, y, z) end function _acb_set(x::($typeofx), y::RealFieldElem, z::RealFieldElem, p::Int) _acb_set(x, y, z) - ccall((:acb_set_round, libarb), Nothing, + ccall((:acb_set_round, libflint), Nothing, (($passtoc), ($passtoc), Int), x, x, p) end function _acb_set(x::($typeofx), y::QQFieldElem, z::QQFieldElem, p::Int) - r = ccall((:acb_real_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) _arb_set(r, y, p) - i = ccall((:acb_imag_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) + i = ccall((:acb_imag_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) _arb_set(i, z, p) end function _acb_set(x::($typeofx), y::T, z::T, p::Int) where {T <: AbstractString} - r = ccall((:acb_real_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) _arb_set(r, y, p) - i = ccall((:acb_imag_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) + i = ccall((:acb_imag_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) _arb_set(i, z, p) end function _acb_set(x::($typeofx), y::Real, p::Int) - r = ccall((:acb_real_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) _arb_set(r, y, p) - i = ccall((:acb_imag_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) - ccall((:arb_zero, libarb), Nothing, (Ptr{ArbFieldElem}, ), i) + i = ccall((:acb_imag_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) + ccall((:arb_zero, libflint), Nothing, (Ptr{ArbFieldElem}, ), i) end function _acb_set(x::($typeofx), y::Complex, p::Int) - r = ccall((:acb_real_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) _arb_set(r, real(y), p) - i = ccall((:acb_imag_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) + i = ccall((:acb_imag_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) _arb_set(i, imag(y), p) end @@ -1748,9 +1748,9 @@ for (typeofx, passtoc) in ((ComplexFieldElem, Ref{ComplexFieldElem}), (Ptr{Compl for T in (Real, ZZRingElem) @eval begin function _acb_set(x::($typeofx), y::($T), z::($T), p::Int) - r = ccall((:acb_real_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) _arb_set(r, y, p) - i = ccall((:acb_imag_ptr, libarb), Ptr{RealFieldElem}, (($passtoc), ), x) + i = ccall((:acb_imag_ptr, libflint), Ptr{RealFieldElem}, (($passtoc), ), x) _arb_set(i, z, p) end end diff --git a/src/arb/ComplexMat.jl b/src/arb/ComplexMat.jl index 8359b973f..b6612b000 100644 --- a/src/arb/ComplexMat.jl +++ b/src/arb/ComplexMat.jl @@ -43,9 +43,9 @@ end function getindex!(z::ComplexFieldElem, x::ComplexMat, r::Int, c::Int) GC.@preserve x begin - v = ccall((:acb_mat_entry_ptr, libarb), Ptr{ComplexFieldElem}, + v = ccall((:acb_mat_entry_ptr, libflint), Ptr{ComplexFieldElem}, (Ref{ComplexMat}, Int, Int), x, r - 1, c - 1) - ccall((:acb_set, libarb), Nothing, (Ref{ComplexFieldElem}, Ptr{ComplexFieldElem}), z, v) + ccall((:acb_set, libflint), Nothing, (Ref{ComplexFieldElem}, Ptr{ComplexFieldElem}), z, v) end return z end @@ -55,9 +55,9 @@ end z = base_ring(x)() GC.@preserve x begin - v = ccall((:acb_mat_entry_ptr, libarb), Ptr{ComplexFieldElem}, + v = ccall((:acb_mat_entry_ptr, libflint), Ptr{ComplexFieldElem}, (Ref{ComplexMat}, Int, Int), x, r - 1, c - 1) - ccall((:acb_set, libarb), Nothing, (Ref{ComplexFieldElem}, Ptr{ComplexFieldElem}), z, v) + ccall((:acb_set, libflint), Nothing, (Ref{ComplexFieldElem}, Ptr{ComplexFieldElem}), z, v) end return z end @@ -68,7 +68,7 @@ for T in [Integer, Float64, ZZRingElem, QQFieldElem, RealFieldElem, BigFloat, Co @boundscheck Generic._checkbounds(x, r, c) GC.@preserve x begin - z = ccall((:acb_mat_entry_ptr, libarb), Ptr{ComplexFieldElem}, + z = ccall((:acb_mat_entry_ptr, libflint), Ptr{ComplexFieldElem}, (Ref{ComplexMat}, Int, Int), x, r - 1, c - 1) _acb_set(z, y, precision(Balls)) end @@ -86,7 +86,7 @@ for T in [Integer, Float64, ZZRingElem, QQFieldElem, RealFieldElem, BigFloat, Ab @boundscheck Generic._checkbounds(x, r, c) GC.@preserve x begin - z = ccall((:acb_mat_entry_ptr, libarb), Ptr{ComplexFieldElem}, + z = ccall((:acb_mat_entry_ptr, libflint), Ptr{ComplexFieldElem}, (Ref{ComplexMat}, Int, Int), x, r - 1, c - 1) _acb_set(z, y[1], y[2], precision(Balls)) end @@ -101,7 +101,7 @@ zero(x::ComplexMatSpace) = x() function one(x::ComplexMatSpace) z = x() - ccall((:acb_mat_one, libarb), Nothing, (Ref{ComplexMat}, ), z) + ccall((:acb_mat_one, libflint), Nothing, (Ref{ComplexMat}, ), z) return z end @@ -115,7 +115,7 @@ number_of_columns(a::ComplexMatSpace) = a.ncols function deepcopy_internal(x::ComplexMat, dict::IdDict) z = similar(x) - ccall((:acb_mat_set, libarb), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}), z, x) + ccall((:acb_mat_set, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}), z, x) return z end @@ -127,7 +127,7 @@ end function -(x::ComplexMat) z = similar(x) - ccall((:acb_mat_neg, libarb), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}), z, x) + ccall((:acb_mat_neg, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}), z, x) return z end @@ -139,7 +139,7 @@ end function transpose(x::ComplexMat) z = similar(x, ncols(x), nrows(x)) - ccall((:acb_mat_transpose, libarb), Nothing, + ccall((:acb_mat_transpose, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}), z, x) return z end @@ -153,7 +153,7 @@ end function +(x::ComplexMat, y::ComplexMat) check_parent(x, y) z = similar(x) - ccall((:acb_mat_add, libarb), Nothing, + ccall((:acb_mat_add, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Ref{ComplexMat}, Int), z, x, y, precision(Balls)) return z @@ -162,7 +162,7 @@ end function -(x::ComplexMat, y::ComplexMat) check_parent(x, y) z = similar(x) - ccall((:acb_mat_sub, libarb), Nothing, + ccall((:acb_mat_sub, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Ref{ComplexMat}, Int), z, x, y, precision(Balls)) return z @@ -171,7 +171,7 @@ end function *(x::ComplexMat, y::ComplexMat) ncols(x) != nrows(y) && error("Matrices have wrong dimensions") z = similar(x, nrows(x), ncols(y)) - ccall((:acb_mat_mul, libarb), Nothing, + ccall((:acb_mat_mul, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Ref{ComplexMat}, Int), z, x, y, precision(Balls)) return z @@ -186,7 +186,7 @@ end function ^(x::ComplexMat, y::UInt) nrows(x) != ncols(x) && error("Matrix must be square") z = similar(x) - ccall((:acb_mat_pow_ui, libarb), Nothing, + ccall((:acb_mat_pow_ui, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, UInt, Int), z, x, y, precision(Balls)) return z @@ -194,7 +194,7 @@ end function *(x::ComplexMat, y::Int) z = similar(x) - ccall((:acb_mat_scalar_mul_si, libarb), Nothing, + ccall((:acb_mat_scalar_mul_si, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Int, Int), z, x, y, precision(Balls)) return z @@ -204,7 +204,7 @@ end function *(x::ComplexMat, y::ZZRingElem) z = similar(x) - ccall((:acb_mat_scalar_mul_fmpz, libarb), Nothing, + ccall((:acb_mat_scalar_mul_fmpz, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Ref{ZZRingElem}, Int), z, x, y, precision(Balls)) return z @@ -214,7 +214,7 @@ end function *(x::ComplexMat, y::RealFieldElem) z = similar(x) - ccall((:acb_mat_scalar_mul_arb, libarb), Nothing, + ccall((:acb_mat_scalar_mul_arb, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Ref{RealFieldElem}, Int), z, x, y, precision(Balls)) return z @@ -224,7 +224,7 @@ end function *(x::ComplexMat, y::ComplexFieldElem) z = similar(x) - ccall((:acb_mat_scalar_mul_acb, libarb), Nothing, + ccall((:acb_mat_scalar_mul_acb, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Ref{ComplexFieldElem}, Int), z, x, y, precision(Balls)) return z @@ -316,7 +316,7 @@ end function ldexp(x::ComplexMat, y::Int) z = similar(x) - ccall((:acb_mat_scalar_mul_2exp_si, libarb), Nothing, + ccall((:acb_mat_scalar_mul_2exp_si, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Int), z, x, y) return z end @@ -334,7 +334,7 @@ Return `true` if the matrices of balls $x$ and $y$ are precisely equal, i.e. if all matrix entries have the same midpoints and radii. """ function isequal(x::ComplexMat, y::ComplexMat) - r = ccall((:acb_mat_equal, libarb), Cint, + r = ccall((:acb_mat_equal, libflint), Cint, (Ref{ComplexMat}, Ref{ComplexMat}), x, y) return Bool(r) end @@ -342,12 +342,12 @@ end function ==(x::ComplexMat, y::ComplexMat) fl = check_parent(x, y, false) !fl && return false - r = ccall((:acb_mat_eq, libarb), Cint, (Ref{ComplexMat}, Ref{ComplexMat}), x, y) + r = ccall((:acb_mat_eq, libflint), Cint, (Ref{ComplexMat}, Ref{ComplexMat}), x, y) return Bool(r) end function !=(x::ComplexMat, y::ComplexMat) - r = ccall((:acb_mat_ne, libarb), Cint, (Ref{ComplexMat}, Ref{ComplexMat}), x, y) + r = ccall((:acb_mat_ne, libflint), Cint, (Ref{ComplexMat}, Ref{ComplexMat}), x, y) return Bool(r) end @@ -358,7 +358,7 @@ Returns `true` if all entries of $x$ overlap with the corresponding entry of $y$, otherwise return `false`. """ function overlaps(x::ComplexMat, y::ComplexMat) - r = ccall((:acb_mat_overlaps, libarb), Cint, + r = ccall((:acb_mat_overlaps, libflint), Cint, (Ref{ComplexMat}, Ref{ComplexMat}), x, y) return Bool(r) end @@ -370,7 +370,7 @@ Returns `true` if all entries of $x$ contain the corresponding entry of $y$, otherwise return `false`. """ function contains(x::ComplexMat, y::ComplexMat) - r = ccall((:acb_mat_contains, libarb), Cint, + r = ccall((:acb_mat_contains, libflint), Cint, (Ref{ComplexMat}, Ref{ComplexMat}), x, y) return Bool(r) end @@ -388,7 +388,7 @@ Returns `true` if all entries of $x$ contain the corresponding entry of $y$, otherwise return `false`. """ function contains(x::ComplexMat, y::ZZMatrix) - r = ccall((:acb_mat_contains_fmpz_mat, libarb), Cint, + r = ccall((:acb_mat_contains_fmpz_mat, libflint), Cint, (Ref{ComplexMat}, Ref{ZZMatrix}), x, y) return Bool(r) end @@ -400,7 +400,7 @@ Returns `true` if all entries of $x$ contain the corresponding entry of $y$, otherwise return `false`. """ function contains(x::ComplexMat, y::QQMatrix) - r = ccall((:acb_mat_contains_fmpq_mat, libarb), Cint, + r = ccall((:acb_mat_contains_fmpq_mat, libflint), Cint, (Ref{ComplexMat}, Ref{QQMatrix}), x, y) return Bool(r) end @@ -420,7 +420,7 @@ end ################################################################################ isreal(x::ComplexMat) = - Bool(ccall((:acb_mat_is_real, libarb), Cint, (Ref{ComplexMat}, ), x)) + Bool(ccall((:acb_mat_is_real, libflint), Cint, (Ref{ComplexMat}, ), x)) ############################################################################### # @@ -444,7 +444,7 @@ end function is_invertible_with_inverse(x::ComplexMat) ncols(x) != nrows(x) && return false, x z = similar(x) - r = ccall((:acb_mat_inv, libarb), Cint, + r = ccall((:acb_mat_inv, libflint), Cint, (Ref{ComplexMat}, Ref{ComplexMat}, Int), z, x, precision(Balls)) return Bool(r), z end @@ -469,7 +469,7 @@ end function divexact(x::ComplexMat, y::Int; check::Bool=true) y == 0 && throw(DivideError()) z = similar(x) - ccall((:acb_mat_scalar_div_si, libarb), Nothing, + ccall((:acb_mat_scalar_div_si, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Int, Int), z, x, y, precision(Balls)) return z @@ -477,7 +477,7 @@ end function divexact(x::ComplexMat, y::ZZRingElem; check::Bool=true) z = similar(x) - ccall((:acb_mat_scalar_div_fmpz, libarb), Nothing, + ccall((:acb_mat_scalar_div_fmpz, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Ref{ZZRingElem}, Int), z, x, y, precision(Balls)) return z @@ -485,7 +485,7 @@ end function divexact(x::ComplexMat, y::RealFieldElem; check::Bool=true) z = similar(x) - ccall((:acb_mat_scalar_div_arb, libarb), Nothing, + ccall((:acb_mat_scalar_div_arb, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Ref{RealFieldElem}, Int), z, x, y, precision(Balls)) return z @@ -493,7 +493,7 @@ end function divexact(x::ComplexMat, y::ComplexFieldElem; check::Bool=true) z = similar(x) - ccall((:acb_mat_scalar_div_acb, libarb), Nothing, + ccall((:acb_mat_scalar_div_acb, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Ref{ComplexFieldElem}, Int), z, x, y, precision(Balls)) return z @@ -516,7 +516,7 @@ divexact(x::ComplexMat, y::Rational{T}; check::Bool=true) where T <: Union{Int, function charpoly(x::AcbPolyRing, y::ComplexMat, prec::Int = precision(Balls)) base_ring(x) != base_ring(y) && error("Base rings must coincide") z = x() - ccall((:acb_mat_charpoly, libarb), Nothing, + ccall((:acb_mat_charpoly, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{ComplexMat}, Int), z, y, prec) return z end @@ -530,7 +530,7 @@ end function det(x::ComplexMat, prec::Int = precision(Balls)) ncols(x) != nrows(x) && error("Matrix must be square") z = base_ring(x)() - ccall((:acb_mat_det, libarb), Nothing, + ccall((:acb_mat_det, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexMat}, Int), z, x, prec) return z end @@ -544,7 +544,7 @@ end function Base.exp(x::ComplexMat) ncols(x) != nrows(x) && error("Matrix must be square") z = similar(x) - ccall((:acb_mat_exp, libarb), Nothing, + ccall((:acb_mat_exp, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Int), z, x, precision(Balls)) return z end @@ -557,7 +557,7 @@ end function lu!(P::Generic.Perm, x::ComplexMat) P.d .-= 1 - r = ccall((:acb_mat_lu, libarb), Cint, + r = ccall((:acb_mat_lu, libflint), Cint, (Ptr{Int}, Ref{ComplexMat}, Ref{ComplexMat}, Int), P.d, x, x, precision(Balls)) r == 0 && error("Could not find $(nrows(x)) invertible pivot elements") @@ -567,7 +567,7 @@ function lu!(P::Generic.Perm, x::ComplexMat) end function _solve!(z::ComplexMat, x::ComplexMat, y::ComplexMat) - r = ccall((:acb_mat_solve, libarb), Cint, + r = ccall((:acb_mat_solve, libflint), Cint, (Ref{ComplexMat}, Ref{ComplexMat}, Ref{ComplexMat}, Int), z, x, y, precision(Balls)) r == 0 && error("Matrix cannot be inverted numerically") @@ -576,7 +576,7 @@ end function _solve_lu_precomp!(z::ComplexMat, P::Generic.Perm, LU::ComplexMat, y::ComplexMat) Q = inv(P) - ccall((:acb_mat_solve_lu_precomp, libarb), Nothing, + ccall((:acb_mat_solve_lu_precomp, libflint), Nothing, (Ref{ComplexMat}, Ptr{Int}, Ref{ComplexMat}, Ref{ComplexMat}, Int), z, Q.d .- 1, LU, y, precision(Balls)) nothing @@ -597,7 +597,7 @@ function Solve._can_solve_internal_no_check(A::ComplexMat, b::ComplexMat, task:: end x = similar(A, ncols(A), ncols(b)) - fl = ccall((:acb_mat_solve, libarb), Cint, + fl = ccall((:acb_mat_solve, libflint), Cint, (Ref{ComplexMat}, Ref{ComplexMat}, Ref{ComplexMat}, Int), x, A, b, precision(Balls)) fl == 0 && error("Matrix cannot be inverted numerically") @@ -629,7 +629,7 @@ function Solve._init_reduce(C::Solve.SolveCtx{ComplexFieldElem}) P = Generic.Perm(nrows(C)) x = similar(A, nrows(A), ncols(A)) P.d .-= 1 - fl = ccall((:acb_mat_lu, libarb), Cint, + fl = ccall((:acb_mat_lu, libflint), Cint, (Ptr{Int}, Ref{ComplexMat}, Ref{ComplexMat}, Int), P.d, x, A, precision(Balls)) fl == 0 && error("Could not find $(nrows(x)) invertible pivot elements") @@ -652,7 +652,7 @@ function Solve._init_reduce_transpose(C::Solve.SolveCtx{ComplexFieldElem}) P = Generic.Perm(nrows(C)) x = similar(A, nrows(A), ncols(A)) P.d .-= 1 - fl = ccall((:acb_mat_lu, libarb), Cint, + fl = ccall((:acb_mat_lu, libflint), Cint, (Ptr{Int}, Ref{ComplexMat}, Ref{ComplexMat}, Int), P.d, x, A, precision(Balls)) fl == 0 && error("Could not find $(nrows(x)) invertible pivot elements") @@ -675,7 +675,7 @@ function Solve._can_solve_internal_no_check(C::Solve.SolveCtx{ComplexFieldElem}, end x = similar(b, ncols(C), ncols(b)) - ccall((:acb_mat_solve_lu_precomp, libarb), Nothing, + ccall((:acb_mat_solve_lu_precomp, libflint), Nothing, (Ref{ComplexMat}, Ptr{Int}, Ref{ComplexMat}, Ref{ComplexMat}, Int), x, inv(p).d .- 1, LU, b, precision(Balls)) @@ -709,7 +709,7 @@ function swap_rows(x::ComplexMat, i::Int, j::Int) end function swap_rows!(x::ComplexMat, i::Int, j::Int) - ccall((:acb_mat_swap_rows, libarb), Nothing, + ccall((:acb_mat_swap_rows, libflint), Nothing, (Ref{ComplexMat}, Ptr{Nothing}, Int, Int), x, C_NULL, i - 1, j - 1) end @@ -729,13 +729,13 @@ bound for the infinity norm for every matrix in $x$ function bound_inf_norm(x::ComplexMat) z = RealFieldElem() GC.@preserve x z begin - t = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (Ref{RealFieldElem}, ), z) - ccall((:acb_mat_bound_inf_norm, libarb), Nothing, + t = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (Ref{RealFieldElem}, ), z) + ccall((:acb_mat_bound_inf_norm, libflint), Nothing, (Ptr{mag_struct}, Ref{ComplexMat}), t, x) - s = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (Ref{RealFieldElem}, ), z) - ccall((:arf_set_mag, libarb), Nothing, + s = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ref{RealFieldElem}, ), z) + ccall((:arf_set_mag, libflint), Nothing, (Ptr{arf_struct}, Ptr{mag_struct}), s, t) - ccall((:mag_zero, libarb), Nothing, + ccall((:mag_zero, libflint), Nothing, (Ptr{mag_struct},), t) end return z @@ -751,7 +751,7 @@ for (s,f) in (("add!","acb_mat_add"), ("mul!","acb_mat_mul"), ("sub!","acb_mat_sub")) @eval begin function ($(Symbol(s)))(z::ComplexMat, x::ComplexMat, y::ComplexMat, prec::Int = precision(Balls)) - ccall(($f, libarb), Nothing, + ccall(($f, libflint), Nothing, (Ref{ComplexMat}, Ref{ComplexMat}, Ref{ComplexMat}, Int), z, x, y, prec) return z @@ -918,7 +918,7 @@ function identity_matrix(R::ComplexField, n::Int) error("dimension must not be negative") end z = ComplexMat(n, n) - ccall((:acb_mat_one, libarb), Nothing, (Ref{ComplexMat}, ), z) + ccall((:acb_mat_one, libflint), Nothing, (Ref{ComplexMat}, ), z) return z end @@ -954,7 +954,7 @@ promote_rule(::Type{ComplexMat}, ::Type{ArbMatrix}) = ComplexMat function __approx_eig_qr!(v::Ptr{acb_struct}, R::ComplexMat, A::ComplexMat) n = nrows(A) - ccall((:acb_mat_approx_eig_qr, libarb), Cint, + ccall((:acb_mat_approx_eig_qr, libflint), Cint, (Ptr{acb_struct}, Ptr{Nothing}, Ref{ComplexMat}, Ref{ComplexMat}, Ptr{Nothing}, Int, Int), v, C_NULL, R, A, C_NULL, 0, precision(Balls)) @@ -977,7 +977,7 @@ function _eig_multiple(A::ComplexMat, check::Bool = true) v_approx = acb_vec(n) R = zero_matrix(base_ring(A), n, n) __approx_eig_qr!(v, R, A) - b = ccall((:acb_mat_eig_multiple, libarb), Cint, + b = ccall((:acb_mat_eig_multiple, libflint), Cint, (Ptr{acb_struct}, Ref{ComplexMat}, Ptr{acb_struct}, Ref{ComplexMat}, Int), v_approx, A, v, R, precision(Balls)) check && b == 0 && error("Could not isolate eigenvalues of matrix $A") @@ -1011,17 +1011,17 @@ function _eig_simple(A::ComplexMat; check::Bool = true, algorithm::Symbol = :def R = zero_matrix(base_ring(A), n, n) __approx_eig_qr!(v, Rapprox, A) if algorithm == :vdhoeven_mourrain - b = ccall((:acb_mat_eig_simple_vdhoeven_mourrain, libarb), Cint, + b = ccall((:acb_mat_eig_simple_vdhoeven_mourrain, libflint), Cint, (Ptr{acb_struct}, Ref{ComplexMat}, Ref{ComplexMat}, Ref{ComplexMat}, Ptr{acb_struct}, Ref{ComplexMat}, Int), v_approx, L, R, A, v, Rapprox, precision(Balls)) elseif algorithm == :rump - b = ccall((:acb_mat_eig_simple_rump, libarb), Cint, + b = ccall((:acb_mat_eig_simple_rump, libflint), Cint, (Ptr{acb_struct}, Ref{ComplexMat}, Ref{ComplexMat}, Ref{ComplexMat}, Ptr{acb_struct}, Ref{ComplexMat}, Int), v_approx, L, R, A, v, Rapprox, precision(Balls)) elseif algorithm == :default - b = ccall((:acb_mat_eig_simple, libarb), Cint, + b = ccall((:acb_mat_eig_simple, libflint), Cint, (Ptr{acb_struct}, Ref{ComplexMat}, Ref{ComplexMat}, Ref{ComplexMat}, Ptr{acb_struct}, Ref{ComplexMat}, Int), v_approx, L, R, A, v, Rapprox, precision(Balls)) diff --git a/src/arb/ComplexPoly.jl b/src/arb/ComplexPoly.jl index b4c4e5a65..1700a0f65 100644 --- a/src/arb/ComplexPoly.jl +++ b/src/arb/ComplexPoly.jl @@ -16,11 +16,11 @@ elem_type(::Type{ComplexPolyRing}) = ComplexPoly dense_poly_type(::Type{ComplexFieldElem}) = ComplexPoly -length(x::ComplexPoly) = ccall((:acb_poly_length, libarb), Int, +length(x::ComplexPoly) = ccall((:acb_poly_length, libflint), Int, (Ref{ComplexPoly},), x) function set_length!(x::ComplexPoly, n::Int) - ccall((:_acb_poly_set_length, libarb), Nothing, + ccall((:_acb_poly_set_length, libflint), Nothing, (Ref{ComplexPoly}, Int), x, n) return x end @@ -30,7 +30,7 @@ degree(x::ComplexPoly) = length(x) - 1 function coeff(a::ComplexPoly, n::Int) n < 0 && throw(DomainError(n, "Index must be non-negative")) t = ComplexFieldElem() - ccall((:acb_poly_get_coeff_acb, libarb), Nothing, + ccall((:acb_poly_get_coeff_acb, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexPoly}, Int), t, a, n) return t end @@ -41,7 +41,7 @@ one(a::ComplexPolyRing) = a(1) function gen(a::ComplexPolyRing) z = ComplexPoly() - ccall((:acb_poly_set_coeff_si, libarb), Nothing, + ccall((:acb_poly_set_coeff_si, libflint), Nothing, (Ref{ComplexPoly}, Int, Int), z, 1, 1) z.parent = a return z @@ -109,7 +109,7 @@ end ############################################################################### function isequal(x::ComplexPoly, y::ComplexPoly) - return ccall((:acb_poly_equal, libarb), Bool, + return ccall((:acb_poly_equal, libflint), Bool, (Ref{ComplexPoly}, Ref{ComplexPoly}), x, y) end @@ -120,7 +120,7 @@ Return `true` if the coefficient boxes of $x$ overlap the coefficient boxes of $y$, otherwise return `false`. """ function overlaps(x::ComplexPoly, y::ComplexPoly) - return ccall((:acb_poly_overlaps, libarb), Bool, + return ccall((:acb_poly_overlaps, libflint), Bool, (Ref{ComplexPoly}, Ref{ComplexPoly}), x, y) end @@ -131,7 +131,7 @@ Return `true` if the coefficient boxes of $x$ contain the corresponding coefficient boxes of $y$, otherwise return `false`. """ function contains(x::ComplexPoly, y::ComplexPoly) - return ccall((:acb_poly_contains, libarb), Bool, + return ccall((:acb_poly_contains, libflint), Bool, (Ref{ComplexPoly}, Ref{ComplexPoly}), x, y) end @@ -142,7 +142,7 @@ Return `true` if the coefficient boxes of $x$ contain the corresponding exact coefficients of $y$, otherwise return `false`. """ function contains(x::ComplexPoly, y::ZZPolyRingElem) - return ccall((:acb_poly_contains_fmpz_poly, libarb), Bool, + return ccall((:acb_poly_contains_fmpz_poly, libflint), Bool, (Ref{ComplexPoly}, Ref{ZZPolyRingElem}), x, y) end @@ -153,7 +153,7 @@ Return `true` if the coefficient boxes of $x$ contain the corresponding exact coefficients of $y$, otherwise return `false`. """ function contains(x::ComplexPoly, y::QQPolyRingElem) - return ccall((:acb_poly_contains_fmpq_poly, libarb), Bool, + return ccall((:acb_poly_contains_fmpq_poly, libflint), Bool, (Ref{ComplexPoly}, Ref{QQPolyRingElem}), x, y) end @@ -187,13 +187,13 @@ in case it is, otherwise sets $t$ to `false`. """ function unique_integer(x::ComplexPoly) z = ZZPolyRing(ZZ, var(parent(x)))() - unique = ccall((:acb_poly_get_unique_fmpz_poly, libarb), Int, + unique = ccall((:acb_poly_get_unique_fmpz_poly, libflint), Int, (Ref{ZZPolyRingElem}, Ref{ComplexPoly}), z, x) return (unique != 0, z) end function isreal(x::ComplexPoly) - return ccall((:acb_poly_is_real, libarb), Cint, (Ref{ComplexPoly}, ), x) != 0 + return ccall((:acb_poly_is_real, libflint), Cint, (Ref{ComplexPoly}, ), x) != 0 end ############################################################################### @@ -205,7 +205,7 @@ end function shift_left(x::ComplexPoly, len::Int) len < 0 && throw(DomainError(len, "Shift must be non-negative")) z = parent(x)() - ccall((:acb_poly_shift_left, libarb), Nothing, + ccall((:acb_poly_shift_left, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, x, len) return z end @@ -213,7 +213,7 @@ end function shift_right(x::ComplexPoly, len::Int) len < 0 && throw(DomainError(len, "Shift must be non-negative")) z = parent(x)() - ccall((:acb_poly_shift_right, libarb), Nothing, + ccall((:acb_poly_shift_right, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, x, len) return z end @@ -226,7 +226,7 @@ end function -(x::ComplexPoly) z = parent(x)() - ccall((:acb_poly_neg, libarb), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}), z, x) + ccall((:acb_poly_neg, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}), z, x) return z end @@ -238,7 +238,7 @@ end function +(x::ComplexPoly, y::ComplexPoly) z = parent(x)() - ccall((:acb_poly_add, libarb), Nothing, + ccall((:acb_poly_add, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, x, y, precision(Balls)) return z @@ -246,7 +246,7 @@ end function *(x::ComplexPoly, y::ComplexPoly) z = parent(x)() - ccall((:acb_poly_mul, libarb), Nothing, + ccall((:acb_poly_mul, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, x, y, precision(Balls)) return z @@ -254,7 +254,7 @@ end function -(x::ComplexPoly, y::ComplexPoly) z = parent(x)() - ccall((:acb_poly_sub, libarb), Nothing, + ccall((:acb_poly_sub, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, x, y, precision(Balls)) return z @@ -263,7 +263,7 @@ end function ^(x::ComplexPoly, y::Int) y < 0 && throw(DomainError(y, "Exponent must be non-negative")) z = parent(x)() - ccall((:acb_poly_pow_ui, libarb), Nothing, + ccall((:acb_poly_pow_ui, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, UInt, Int), z, x, y, precision(Balls)) return z @@ -319,7 +319,7 @@ function Base.divrem(x::ComplexPoly, y::ComplexPoly) iszero(y) && throw(DivideError()) q = parent(x)() r = parent(x)() - if (ccall((:acb_poly_divrem, libarb), Int, + if (ccall((:acb_poly_divrem, libflint), Int, (Ref{ComplexPoly}, Ref{ComplexPoly}, Ref{ComplexPoly}, Ref{ComplexPoly}, Int), q, r, x, y, precision(Balls)) == 1) return (q, r) @@ -349,7 +349,7 @@ function truncate(a::ComplexPoly, n::Int) end # todo: implement set_trunc in ArbFieldElem z = deepcopy(a) - ccall((:acb_poly_truncate, libarb), Nothing, + ccall((:acb_poly_truncate, libflint), Nothing, (Ref{ComplexPoly}, Int), z, n) return z end @@ -357,7 +357,7 @@ end function mullow(x::ComplexPoly, y::ComplexPoly, n::Int, prec::Int = precision(Balls)) n < 0 && throw(DomainError(n, "Index must be non-negative")) z = parent(x)() - ccall((:acb_poly_mullow, libarb), Nothing, + ccall((:acb_poly_mullow, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Ref{ComplexPoly}, Int, Int), z, x, y, n, prec) return z @@ -372,7 +372,7 @@ end #function reverse(x::ComplexPoly, len::Int) # len < 0 && throw(DomainError()) # z = parent(x)() -# ccall((:acb_poly_reverse, libarb), Nothing, +# ccall((:acb_poly_reverse, libflint), Nothing, # (Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, x, len) # return z #end @@ -385,7 +385,7 @@ end function evaluate(x::ComplexPoly, y::ComplexFieldElem, prec::Int = precision(Balls)) z = parent(y)() - ccall((:acb_poly_evaluate, libarb), Nothing, + ccall((:acb_poly_evaluate, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexPoly}, Ref{ComplexFieldElem}, Int), z, x, y, prec) return z @@ -406,7 +406,7 @@ its derivative evaluated at $y$. function evaluate2(x::ComplexPoly, y::ComplexFieldElem, prec::Int = precision(Balls)) z = ComplexFieldElem() w = ComplexFieldElem() - ccall((:acb_poly_evaluate2, libarb), Nothing, + ccall((:acb_poly_evaluate2, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexPoly}, Ref{ComplexFieldElem}, Int), z, w, x, y, prec) return z, w @@ -428,7 +428,7 @@ function compose(x::ComplexPoly, y::ComplexPoly, prec::Int = precision(Balls); i end @assert inner == :second z = parent(x)() - ccall((:acb_poly_compose, libarb), Nothing, + ccall((:acb_poly_compose, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, x, y, prec) return z @@ -442,14 +442,14 @@ end function derivative(x::ComplexPoly, prec::Int = precision(Balls)) z = parent(x)() - ccall((:acb_poly_derivative, libarb), Nothing, + ccall((:acb_poly_derivative, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, x, prec) return z end function integral(x::ComplexPoly, prec::Int = precision(Balls)) z = parent(x)() - ccall((:acb_poly_integral, libarb), Nothing, + ccall((:acb_poly_integral, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, x, prec) return z end @@ -461,13 +461,13 @@ end ############################################################################### function acb_vec(n::Int) - return ccall((:_acb_vec_init, libarb), Ptr{acb_struct}, (Int,), n) + return ccall((:_acb_vec_init, libflint), Ptr{acb_struct}, (Int,), n) end function acb_vec(b::Vector{ComplexFieldElem}) - v = ccall((:_acb_vec_init, libarb), Ptr{acb_struct}, (Int,), length(b)) + v = ccall((:_acb_vec_init, libflint), Ptr{acb_struct}, (Int,), length(b)) for i=1:length(b) - ccall((:acb_set, libarb), Nothing, (Ptr{acb_struct}, Ref{ComplexFieldElem}), + ccall((:acb_set, libflint), Nothing, (Ptr{acb_struct}, Ref{ComplexFieldElem}), v + (i-1)*sizeof(acb_struct), b[i]) end return v @@ -477,14 +477,14 @@ function array(R::ComplexField, v::Ptr{acb_struct}, n::Int) r = Vector{ComplexFieldElem}(undef, n) for i=1:n r[i] = R() - ccall((:acb_set, libarb), Nothing, (Ref{ComplexFieldElem}, Ptr{acb_struct}), + ccall((:acb_set, libflint), Nothing, (Ref{ComplexFieldElem}, Ptr{acb_struct}), r[i], v + (i-1)*sizeof(acb_struct)) end return r end function acb_vec_clear(v::Ptr{acb_struct}, n::Int) - ccall((:_acb_vec_clear, libarb), Nothing, (Ptr{acb_struct}, Int), v, n) + ccall((:_acb_vec_clear, libflint), Nothing, (Ptr{acb_struct}, Int), v, n) end @doc raw""" @@ -495,7 +495,7 @@ Construct a polynomial in the given polynomial ring from a list of its roots. function from_roots(R::ComplexPolyRing, b::Vector{ComplexFieldElem}, prec::Int = precision(Balls)) z = R() tmp = acb_vec(b) - ccall((:acb_poly_product_roots, libarb), Nothing, + ccall((:acb_poly_product_roots, libflint), Nothing, (Ref{ComplexPoly}, Ptr{acb_struct}, Int, Int), z, tmp, length(b), prec) acb_vec_clear(tmp, length(b)) return z @@ -507,7 +507,7 @@ end function evaluate_fast(x::ComplexPoly, b::Vector{ComplexFieldElem}, prec::Int = precision(Balls)) tmp = acb_vec(b) - ccall((:acb_poly_evaluate_vec_fast, libarb), Nothing, + ccall((:acb_poly_evaluate_vec_fast, libflint), Nothing, (Ptr{acb_struct}, Ref{ComplexPoly}, Ptr{acb_struct}, Int, Int), tmp, x, tmp, length(b), prec) res = array(base_ring(parent(x)), tmp, length(b)) @@ -520,7 +520,7 @@ function interpolate_newton(R::ComplexPolyRing, xs::Vector{ComplexFieldElem}, ys z = R() xsv = acb_vec(xs) ysv = acb_vec(ys) - ccall((:acb_poly_interpolate_newton, libarb), Nothing, + ccall((:acb_poly_interpolate_newton, libflint), Nothing, (Ref{ComplexPoly}, Ptr{acb_struct}, Ptr{acb_struct}, Int, Int), z, xsv, ysv, length(xs), prec) acb_vec_clear(xsv, length(xs)) @@ -533,7 +533,7 @@ function interpolate_barycentric(R::ComplexPolyRing, xs::Vector{ComplexFieldElem z = R() xsv = acb_vec(xs) ysv = acb_vec(ys) - ccall((:acb_poly_interpolate_barycentric, libarb), Nothing, + ccall((:acb_poly_interpolate_barycentric, libflint), Nothing, (Ref{ComplexPoly}, Ptr{acb_struct}, Ptr{acb_struct}, Int, Int), z, xsv, ysv, length(xs), prec) acb_vec_clear(xsv, length(xs)) @@ -546,7 +546,7 @@ function interpolate_fast(R::ComplexPolyRing, xs::Vector{ComplexFieldElem}, ys:: z = R() xsv = acb_vec(xs) ysv = acb_vec(ys) - ccall((:acb_poly_interpolate_fast, libarb), Nothing, + ccall((:acb_poly_interpolate_fast, libflint), Nothing, (Ref{ComplexPoly}, Ptr{acb_struct}, Ptr{acb_struct}, Int, Int), z, xsv, ysv, length(xs), prec) acb_vec_clear(xsv, length(xs)) @@ -602,7 +602,7 @@ function roots(x::ComplexPoly; target=0, isolate_real=false, initial_prec=0, max while true in_roots = (wp == initial_prec) ? C_NULL : roots step_max_iter = (max_iter >= 1) ? max_iter : min(max(deg, 32), wp) - isolated = ccall((:acb_poly_find_roots, libarb), Int, + isolated = ccall((:acb_poly_find_roots, libflint), Int, (Ptr{acb_struct}, Ref{ComplexPoly}, Ptr{acb_struct}, Int, Int), roots, x, in_roots, step_max_iter, wp) @@ -612,21 +612,21 @@ function roots(x::ComplexPoly; target=0, isolate_real=false, initial_prec=0, max ok = true if target > 0 for i = 0 : deg-1 - re = ccall((:acb_real_ptr, libarb), Ptr{arb_struct}, + re = ccall((:acb_real_ptr, libflint), Ptr{arb_struct}, (Ptr{acb_struct}, ), roots + i * sizeof(acb_struct)) - im = ccall((:acb_imag_ptr, libarb), Ptr{arb_struct}, + im = ccall((:acb_imag_ptr, libflint), Ptr{arb_struct}, (Ptr{acb_struct}, ), roots + i * sizeof(acb_struct)) - t = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (Ptr{ArbFieldElem}, ), re) - u = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (Ptr{ArbFieldElem}, ), im) - ok = ok && (ccall((:mag_cmp_2exp_si, libarb), Cint, + t = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (Ptr{ArbFieldElem}, ), re) + u = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (Ptr{ArbFieldElem}, ), im) + ok = ok && (ccall((:mag_cmp_2exp_si, libflint), Cint, (Ptr{mag_struct}, Int), t, -target) <= 0) - ok = ok && (ccall((:mag_cmp_2exp_si, libarb), Cint, + ok = ok && (ccall((:mag_cmp_2exp_si, libflint), Cint, (Ptr{mag_struct}, Int), u, -target) <= 0) end end if isreal(x) - real_ok = ccall((:acb_poly_validate_real_roots, libarb), + real_ok = ccall((:acb_poly_validate_real_roots, libflint), Bool, (Ptr{acb_struct}, Ref{ComplexPoly}, Int), roots, x, wp) if isolate_real && !real_ok @@ -635,10 +635,10 @@ function roots(x::ComplexPoly; target=0, isolate_real=false, initial_prec=0, max if real_ok for i = 0 : deg - 1 - im = ccall((:acb_imag_ptr, libarb), Ptr{arb_struct}, + im = ccall((:acb_imag_ptr, libflint), Ptr{arb_struct}, (Ptr{ComplexFieldElem}, ), roots + i * sizeof(acb_struct)) - if ccall((:arb_contains_zero, libarb), Bool, (Ptr{arb_struct}, ), im) - ccall((:arb_zero, libarb), Nothing, (Ptr{arb_struct}, ), im) + if ccall((:arb_contains_zero, libflint), Bool, (Ptr{arb_struct}, ), im) + ccall((:arb_zero, libflint), Nothing, (Ptr{arb_struct}, ), im) end end end @@ -655,7 +655,7 @@ function roots(x::ComplexPoly; target=0, isolate_real=false, initial_prec=0, max end if isolated == deg - ccall((:_acb_vec_sort_pretty, libarb), Nothing, + ccall((:_acb_vec_sort_pretty, libflint), Nothing, (Ptr{acb_struct}, Int), roots, deg) res = array(base_ring(parent(x)), roots, deg) end @@ -684,14 +684,14 @@ function roots_upper_bound(x::ComplexPoly) z = RealFieldElem() p = precision(Balls) GC.@preserve x z begin - t = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (Ref{RealFieldElem}, ), z) - ccall((:acb_poly_root_bound_fujiwara, libarb), Nothing, + t = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (Ref{RealFieldElem}, ), z) + ccall((:acb_poly_root_bound_fujiwara, libflint), Nothing, (Ptr{mag_struct}, Ref{ComplexPoly}), t, x) - s = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (Ref{RealFieldElem}, ), z) - ccall((:arf_set_mag, libarb), Nothing, (Ptr{arf_struct}, Ptr{mag_struct}), s, t) - ccall((:arf_set_round, libarb), Nothing, + s = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ref{RealFieldElem}, ), z) + ccall((:arf_set_mag, libflint), Nothing, (Ptr{arf_struct}, Ptr{mag_struct}), s, t) + ccall((:arf_set_round, libflint), Nothing, (Ptr{arf_struct}, Ptr{arf_struct}, Int, Cint), s, s, p, ARB_RND_CEIL) - ccall((:mag_zero, libarb), Nothing, (Ptr{mag_struct},), t) + ccall((:mag_zero, libflint), Nothing, (Ptr{mag_struct},), t) end return z end @@ -703,44 +703,44 @@ end ############################################################################### function zero!(z::ComplexPoly) - ccall((:acb_poly_zero, libarb), Nothing, (Ref{ComplexPoly},), z) + ccall((:acb_poly_zero, libflint), Nothing, (Ref{ComplexPoly},), z) return z end function fit!(z::ComplexPoly, n::Int) - ccall((:acb_poly_fit_length, libarb), Nothing, + ccall((:acb_poly_fit_length, libflint), Nothing, (Ref{ComplexPoly}, Int), z, n) return nothing end function setcoeff!(z::ComplexPoly, n::Int, x::ZZRingElem) - ccall((:acb_poly_set_coeff_fmpz, libarb), Nothing, + ccall((:acb_poly_set_coeff_fmpz, libflint), Nothing, (Ref{ComplexPoly}, Int, Ref{ZZRingElem}), z, n, x) return z end function setcoeff!(z::ComplexPoly, n::Int, x::ComplexFieldElem) - ccall((:acb_poly_set_coeff_acb, libarb), Nothing, + ccall((:acb_poly_set_coeff_acb, libflint), Nothing, (Ref{ComplexPoly}, Int, Ref{ComplexFieldElem}), z, n, x) return z end function mul!(z::ComplexPoly, x::ComplexPoly, y::ComplexPoly) - ccall((:acb_poly_mul, libarb), Nothing, + ccall((:acb_poly_mul, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, x, y, precision(parent(z))) return z end function addeq!(z::ComplexPoly, x::ComplexPoly) - ccall((:acb_poly_add, libarb), Nothing, + ccall((:acb_poly_add, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, z, x, precision(parent(z))) return z end function add!(z::ComplexPoly, x::ComplexPoly, y::ComplexPoly) - ccall((:acb_poly_add, libarb), Nothing, + ccall((:acb_poly_add, libflint), Nothing, (Ref{ComplexPoly}, Ref{ComplexPoly}, Ref{ComplexPoly}, Int), z, x, y, precision(parent(z))) return z diff --git a/src/arb/Real.jl b/src/arb/Real.jl index f49a47426..a90110476 100644 --- a/src/arb/Real.jl +++ b/src/arb/Real.jl @@ -40,12 +40,12 @@ Return the relative accuracy of $x$ measured in bits, capped between `typemax(Int)` and `-typemax(Int)`. """ function accuracy_bits(x::RealFieldElem) - return ccall((:arb_rel_accuracy_bits, libarb), Int, (Ref{RealFieldElem},), x) + return ccall((:arb_rel_accuracy_bits, libflint), Int, (Ref{RealFieldElem},), x) end function deepcopy_internal(a::RealFieldElem, dict::IdDict) b = parent(a)() - ccall((:arb_set, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), b, a) + ccall((:arb_set, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), b, a) return b end @@ -94,10 +94,10 @@ end function _arb_get_arf(x::RealFieldElem, ::RoundingMode{:Nearest}) t = arf_struct() GC.@preserve x begin - t1 = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, + t1 = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ref{RealFieldElem}, ), x) - ccall((:arf_set, libarb), Nothing, + ccall((:arf_set, libflint), Nothing, (Ref{arf_struct}, Ptr{arf_struct}), t, t1) end @@ -109,7 +109,7 @@ for (b, f) in ((RoundingMode{:Down}, :arb_get_lbound_arf), @eval begin function _arb_get_arf(x::RealFieldElem, ::$b, prec::Int = precision(Balls)) t = arf_struct() - ccall(($(string(f)), libarb), Nothing, + ccall(($(string(f)), libflint), Nothing, (Ref{arf_struct}, Ref{RealFieldElem}, Int), t, x, prec) return t @@ -155,7 +155,7 @@ end function native_string(x::RealFieldElem) d = ceil(precision(Balls) * 0.30102999566398119521) - cstr = ccall((:arb_get_str, libarb), Ptr{UInt8}, + cstr = ccall((:arb_get_str, libflint), Ptr{UInt8}, (Ref{RealFieldElem}, Int, UInt), x, Int(d), UInt(0)) res = unsafe_string(cstr) @@ -200,12 +200,12 @@ Returns `true` if any part of the ball $x$ overlaps any part of the ball $y$, otherwise return `false`. """ function overlaps(x::RealFieldElem, y::RealFieldElem) - r = ccall((:arb_overlaps, libarb), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y) + r = ccall((:arb_overlaps, libflint), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y) return Bool(r) end #function contains(x::RealFieldElem, y::arf) -# r = ccall((:arb_contains_arf, libarb), Cint, (Ref{RealFieldElem}, Ref{arf}), x, y) +# r = ccall((:arb_contains_arf, libflint), Cint, (Ref{RealFieldElem}, Ref{arf}), x, y) # return Bool(r) #end @@ -216,7 +216,7 @@ Returns `true` if the ball $x$ contains the given rational value, otherwise return `false`. """ function contains(x::RealFieldElem, y::QQFieldElem) - r = ccall((:arb_contains_fmpq, libarb), Cint, (Ref{RealFieldElem}, Ref{QQFieldElem}), x, y) + r = ccall((:arb_contains_fmpq, libflint), Cint, (Ref{RealFieldElem}, Ref{QQFieldElem}), x, y) return Bool(r) end @@ -227,12 +227,12 @@ Returns `true` if the ball $x$ contains the given integer value, otherwise return `false`. """ function contains(x::RealFieldElem, y::ZZRingElem) - r = ccall((:arb_contains_fmpz, libarb), Cint, (Ref{RealFieldElem}, Ref{ZZRingElem}), x, y) + r = ccall((:arb_contains_fmpz, libflint), Cint, (Ref{RealFieldElem}, Ref{ZZRingElem}), x, y) return Bool(r) end function contains(x::RealFieldElem, y::Int) - r = ccall((:arb_contains_si, libarb), Cint, (Ref{RealFieldElem}, Int), x, y) + r = ccall((:arb_contains_si, libflint), Cint, (Ref{RealFieldElem}, Int), x, y) return Bool(r) end @@ -259,7 +259,7 @@ Returns `true` if the ball $x$ contains the given floating point value, otherwise return `false`. """ function contains(x::RealFieldElem, y::BigFloat) - r = ccall((:arb_contains_mpfr, libarb), Cint, + r = ccall((:arb_contains_mpfr, libflint), Cint, (Ref{RealFieldElem}, Ref{BigFloat}), x, y) return Bool(r) end @@ -271,7 +271,7 @@ Returns `true` if the ball $x$ contains the ball $y$, otherwise return `false`. """ function contains(x::RealFieldElem, y::RealFieldElem) - r = ccall((:arb_contains, libarb), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y) + r = ccall((:arb_contains, libflint), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y) return Bool(r) end @@ -281,7 +281,7 @@ end Returns `true` if the ball $x$ contains zero, otherwise return `false`. """ function contains_zero(x::RealFieldElem) - r = ccall((:arb_contains_zero, libarb), Cint, (Ref{RealFieldElem}, ), x) + r = ccall((:arb_contains_zero, libflint), Cint, (Ref{RealFieldElem}, ), x) return Bool(r) end @@ -292,7 +292,7 @@ Returns `true` if the ball $x$ contains any negative value, otherwise return `false`. """ function contains_negative(x::RealFieldElem) - r = ccall((:arb_contains_negative, libarb), Cint, (Ref{RealFieldElem}, ), x) + r = ccall((:arb_contains_negative, libflint), Cint, (Ref{RealFieldElem}, ), x) return Bool(r) end @@ -303,7 +303,7 @@ Returns `true` if the ball $x$ contains any positive value, otherwise return `false`. """ function contains_positive(x::RealFieldElem) - r = ccall((:arb_contains_positive, libarb), Cint, (Ref{RealFieldElem}, ), x) + r = ccall((:arb_contains_positive, libflint), Cint, (Ref{RealFieldElem}, ), x) return Bool(r) end @@ -314,7 +314,7 @@ Returns `true` if the ball $x$ contains any non-negative value, otherwise return `false`. """ function contains_nonnegative(x::RealFieldElem) - r = ccall((:arb_contains_nonnegative, libarb), Cint, (Ref{RealFieldElem}, ), x) + r = ccall((:arb_contains_nonnegative, libflint), Cint, (Ref{RealFieldElem}, ), x) return Bool(r) end @@ -325,7 +325,7 @@ Returns `true` if the ball $x$ contains any nonpositive value, otherwise return `false`. """ function contains_nonpositive(x::RealFieldElem) - r = ccall((:arb_contains_nonpositive, libarb), Cint, (Ref{RealFieldElem}, ), x) + r = ccall((:arb_contains_nonpositive, libflint), Cint, (Ref{RealFieldElem}, ), x) return Bool(r) end @@ -342,24 +342,24 @@ Return `true` if the balls $x$ and $y$ are precisely equal, i.e. have the same midpoints and radii. """ function isequal(x::RealFieldElem, y::RealFieldElem) - r = ccall((:arb_equal, libarb), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y) + r = ccall((:arb_equal, libflint), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y) return Bool(r) end function ==(x::RealFieldElem, y::RealFieldElem) - return Bool(ccall((:arb_eq, libarb), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y)) + return Bool(ccall((:arb_eq, libflint), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y)) end function !=(x::RealFieldElem, y::RealFieldElem) - return Bool(ccall((:arb_ne, libarb), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y)) + return Bool(ccall((:arb_ne, libflint), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y)) end function isless(x::RealFieldElem, y::RealFieldElem) - return Bool(ccall((:arb_lt, libarb), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y)) + return Bool(ccall((:arb_lt, libflint), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y)) end function <=(x::RealFieldElem, y::RealFieldElem) - return Bool(ccall((:arb_le, libarb), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y)) + return Bool(ccall((:arb_le, libflint), Cint, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y)) end ==(x::RealFieldElem, y::Int) = x == RealFieldElem(y) @@ -449,7 +449,7 @@ end Return `true` if $x$ is certainly zero, otherwise return `false`. """ function iszero(x::RealFieldElem) - return Bool(ccall((:arb_is_zero, libarb), Cint, (Ref{RealFieldElem},), x)) + return Bool(ccall((:arb_is_zero, libflint), Cint, (Ref{RealFieldElem},), x)) end @doc raw""" @@ -459,7 +459,7 @@ Return `true` if $x$ is certainly not equal to zero, otherwise return `false`. """ function is_nonzero(x::RealFieldElem) - return Bool(ccall((:arb_is_nonzero, libarb), Cint, (Ref{RealFieldElem},), x)) + return Bool(ccall((:arb_is_nonzero, libflint), Cint, (Ref{RealFieldElem},), x)) end @doc raw""" @@ -468,7 +468,7 @@ end Return `true` if $x$ is certainly one, otherwise return `false`. """ function isone(x::RealFieldElem) - return Bool(ccall((:arb_is_one, libarb), Cint, (Ref{RealFieldElem},), x)) + return Bool(ccall((:arb_is_one, libflint), Cint, (Ref{RealFieldElem},), x)) end @doc raw""" @@ -478,7 +478,7 @@ Return `true` if $x$ is finite, i.e. having finite midpoint and radius, otherwise return `false`. """ function isfinite(x::RealFieldElem) - return Bool(ccall((:arb_is_finite, libarb), Cint, (Ref{RealFieldElem},), x)) + return Bool(ccall((:arb_is_finite, libflint), Cint, (Ref{RealFieldElem},), x)) end @doc raw""" @@ -488,7 +488,7 @@ Return `true` if $x$ is exact, i.e. has zero radius, otherwise return `false`. """ function is_exact(x::RealFieldElem) - return Bool(ccall((:arb_is_exact, libarb), Cint, (Ref{RealFieldElem},), x)) + return Bool(ccall((:arb_is_exact, libflint), Cint, (Ref{RealFieldElem},), x)) end @doc raw""" @@ -497,7 +497,7 @@ end Return `true` if $x$ is an exact integer, otherwise return `false`. """ function isinteger(x::RealFieldElem) - return Bool(ccall((:arb_is_int, libarb), Cint, (Ref{RealFieldElem},), x)) + return Bool(ccall((:arb_is_int, libflint), Cint, (Ref{RealFieldElem},), x)) end @doc raw""" @@ -506,7 +506,7 @@ end Return `true` if $x$ is certainly positive, otherwise return `false`. """ function is_positive(x::RealFieldElem) - return Bool(ccall((:arb_is_positive, libarb), Cint, (Ref{RealFieldElem},), x)) + return Bool(ccall((:arb_is_positive, libflint), Cint, (Ref{RealFieldElem},), x)) end @doc raw""" @@ -515,7 +515,7 @@ end Return `true` if $x$ is certainly non-negative, otherwise return `false`. """ function is_nonnegative(x::RealFieldElem) - return Bool(ccall((:arb_is_nonnegative, libarb), Cint, (Ref{RealFieldElem},), x)) + return Bool(ccall((:arb_is_nonnegative, libflint), Cint, (Ref{RealFieldElem},), x)) end @doc raw""" @@ -524,7 +524,7 @@ end Return `true` if $x$ is certainly negative, otherwise return `false`. """ function is_negative(x::RealFieldElem) - return Bool(ccall((:arb_is_negative, libarb), Cint, (Ref{RealFieldElem},), x)) + return Bool(ccall((:arb_is_negative, libflint), Cint, (Ref{RealFieldElem},), x)) end @doc raw""" @@ -533,7 +533,7 @@ end Return `true` if $x$ is certainly nonpositive, otherwise return `false`. """ function is_nonpositive(x::RealFieldElem) - return Bool(ccall((:arb_is_nonpositive, libarb), Cint, (Ref{RealFieldElem},), x)) + return Bool(ccall((:arb_is_nonpositive, libflint), Cint, (Ref{RealFieldElem},), x)) end ################################################################################ @@ -560,7 +560,7 @@ Return the radius of the ball $x$ as an Arb ball. """ function radius(x::RealFieldElem) z = RealFieldElem() - ccall((:arb_get_rad_arb, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, x) + ccall((:arb_get_rad_arb, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, x) return z end @@ -571,7 +571,7 @@ Return the midpoint of the ball $x$ as an Arb ball. """ function midpoint(x::RealFieldElem) z = RealFieldElem() - ccall((:arb_get_mid_arb, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, x) + ccall((:arb_get_mid_arb, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, x) return z end @@ -581,7 +581,7 @@ end Adds the absolute values of the midpoint and radius of $y$ to the radius of $x$. """ function add_error!(x::RealFieldElem, y::RealFieldElem) - ccall((:arb_add_error, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y) + ccall((:arb_add_error, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), x, y) end ################################################################################ @@ -592,7 +592,7 @@ end function -(x::RealFieldElem) z = RealFieldElem() - ccall((:arb_neg, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, x) + ccall((:arb_neg, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, x) return z end @@ -606,7 +606,7 @@ for (s,f) in ((:+,"arb_add"), (:*,"arb_mul"), (://, "arb_div"), (:-,"arb_sub")) @eval begin function ($s)(x::RealFieldElem, y::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall(($f, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), + ccall(($f, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, y, prec) return z end @@ -617,7 +617,7 @@ for (f,s) in ((:+, "add"), (:*, "mul")) @eval begin #function ($f)(x::RealFieldElem, y::arf) # z = RealFieldElem() - # ccall(($("arb_"*s*"_arf"), libarb), Nothing, + # ccall(($("arb_"*s*"_arf"), libflint), Nothing, # (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{arf}, Int), # z, x, y, precision(Balls)) # return z @@ -627,7 +627,7 @@ for (f,s) in ((:+, "add"), (:*, "mul")) function ($f)(x::RealFieldElem, y::UInt, prec::Int = precision(Balls)) z = RealFieldElem() - ccall(($("arb_"*s*"_ui"), libarb), Nothing, + ccall(($("arb_"*s*"_ui"), libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, UInt, Int), z, x, y, prec) return z @@ -637,7 +637,7 @@ for (f,s) in ((:+, "add"), (:*, "mul")) function ($f)(x::RealFieldElem, y::Int, prec::Int = precision(Balls)) z = RealFieldElem() - ccall(($("arb_"*s*"_si"), libarb), Nothing, + ccall(($("arb_"*s*"_si"), libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int, Int), z, x, y, prec) return z end @@ -646,7 +646,7 @@ for (f,s) in ((:+, "add"), (:*, "mul")) function ($f)(x::RealFieldElem, y::ZZRingElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall(($("arb_"*s*"_fmpz"), libarb), Nothing, + ccall(($("arb_"*s*"_fmpz"), libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{ZZRingElem}, Int), z, x, y, prec) return z @@ -658,7 +658,7 @@ end #function -(x::RealFieldElem, y::arf) # z = RealFieldElem() -# ccall((:arb_sub_arf, libarb), Nothing, +# ccall((:arb_sub_arf, libflint), Nothing, # (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{arf}, Int), z, x, y, precision(Balls)) # return z #end @@ -667,7 +667,7 @@ end function -(x::RealFieldElem, y::UInt, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_sub_ui, libarb), Nothing, + ccall((:arb_sub_ui, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, UInt, Int), z, x, y, prec) return z end @@ -676,7 +676,7 @@ end function -(x::RealFieldElem, y::Int, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_sub_si, libarb), Nothing, + ccall((:arb_sub_si, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int, Int), z, x, y, prec) return z end @@ -685,7 +685,7 @@ end function -(x::RealFieldElem, y::ZZRingElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_sub_fmpz, libarb), Nothing, + ccall((:arb_sub_fmpz, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{ZZRingElem}, Int), z, x, y, prec) return z @@ -711,28 +711,28 @@ end #function //(x::RealFieldElem, y::arf) # z = RealFieldElem() -# ccall((:arb_div_arf, libarb), Nothing, +# ccall((:arb_div_arf, libflint), Nothing, # (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{arf}, Int), z, x, y, precision(Balls)) # return z #end function //(x::RealFieldElem, y::UInt, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_div_ui, libarb), Nothing, + ccall((:arb_div_ui, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, UInt, Int), z, x, y, prec) return z end function //(x::RealFieldElem, y::Int, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_div_si, libarb), Nothing, + ccall((:arb_div_si, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int, Int), z, x, y, prec) return z end function //(x::RealFieldElem, y::ZZRingElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_div_fmpz, libarb), Nothing, + ccall((:arb_div_fmpz, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{ZZRingElem}, Int), z, x, y, prec) return z @@ -740,7 +740,7 @@ end function //(x::UInt, y::RealFieldElem, prec::Int = precision(Balls)) z = parent(y)() - ccall((:arb_ui_div, libarb), Nothing, + ccall((:arb_ui_div, libflint), Nothing, (Ref{RealFieldElem}, UInt, Ref{RealFieldElem}, Int), z, x, y, prec) return z end @@ -748,7 +748,7 @@ end function //(x::Int, y::RealFieldElem, prec::Int = precision(Balls)) z = parent(y)() t = RealFieldElem(x) - ccall((:arb_div, libarb), Nothing, + ccall((:arb_div, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, t, y, prec) return z end @@ -756,21 +756,21 @@ end function //(x::ZZRingElem, y::RealFieldElem, prec::Int = precision(Balls)) z = parent(y)() t = RealFieldElem(x) - ccall((:arb_div, libarb), Nothing, + ccall((:arb_div, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, t, y, prec) return z end function ^(x::RealFieldElem, y::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_pow, libarb), Nothing, + ccall((:arb_pow, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, y, prec) return z end function ^(x::RealFieldElem, y::ZZRingElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_pow_fmpz, libarb), Nothing, + ccall((:arb_pow_fmpz, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{ZZRingElem}, Int), z, x, y, prec) return z @@ -780,14 +780,14 @@ end function ^(x::RealFieldElem, y::UInt, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_pow_ui, libarb), Nothing, + ccall((:arb_pow_ui, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, UInt, Int), z, x, y, prec) return z end function ^(x::RealFieldElem, y::QQFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_pow_fmpq, libarb), Nothing, + ccall((:arb_pow_fmpq, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{QQFieldElem}, Int), z, x, y, prec) return z @@ -876,7 +876,7 @@ divexact(x::RealFieldElem, y::Rational{T}; check::Bool=true) where {T <: Integer function abs(x::RealFieldElem) z = RealFieldElem() - ccall((:arb_abs, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, x) + ccall((:arb_abs, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, x) return z end @@ -888,7 +888,7 @@ end function inv(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_inv, libarb), Nothing, + ccall((:arb_inv, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return parent(x)(z) end @@ -901,14 +901,14 @@ end function ldexp(x::RealFieldElem, y::Int) z = RealFieldElem() - ccall((:arb_mul_2exp_si, libarb), Nothing, + ccall((:arb_mul_2exp_si, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, y) return z end function ldexp(x::RealFieldElem, y::ZZRingElem) z = RealFieldElem() - ccall((:arb_mul_2exp_fmpz, libarb), Nothing, + ccall((:arb_mul_2exp_fmpz, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{ZZRingElem}), z, x, y) return z end @@ -927,7 +927,7 @@ by rounding off insignificant bits from the midpoint. """ function trim(x::RealFieldElem) z = RealFieldElem() - ccall((:arb_trim, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, x) + ccall((:arb_trim, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}), z, x) return z end @@ -941,7 +941,7 @@ integer. """ function unique_integer(x::RealFieldElem) z = ZZRingElem() - unique = ccall((:arb_get_unique_fmpz, libarb), Int, + unique = ccall((:arb_get_unique_fmpz, libflint), Int, (Ref{ZZRingElem}, Ref{RealFieldElem}), z, x) return (unique != 0, z) end @@ -958,7 +958,7 @@ $y$. """ function setunion(x::RealFieldElem, y::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_union, libarb), Nothing, + ccall((:arb_union, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, y, prec) return z end @@ -971,7 +971,7 @@ $x$ and $y$. """ function setintersection(x::RealFieldElem, y::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_intersection, libarb), Nothing, + ccall((:arb_intersection, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, y, prec) return z end @@ -989,7 +989,7 @@ Return $\pi = 3.14159\ldots$ as an element of $r$. """ function const_pi(r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_const_pi, libarb), Nothing, (Ref{RealFieldElem}, Int), z, prec) + ccall((:arb_const_pi, libflint), Nothing, (Ref{RealFieldElem}, Int), z, prec) return z end @@ -1000,7 +1000,7 @@ Return $e = 2.71828\ldots$ as an element of $r$. """ function const_e(r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_const_e, libarb), Nothing, (Ref{RealFieldElem}, Int), z, prec) + ccall((:arb_const_e, libflint), Nothing, (Ref{RealFieldElem}, Int), z, prec) return z end @@ -1011,7 +1011,7 @@ Return $\log(2) = 0.69314\ldots$ as an element of $r$. """ function const_log2(r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_const_log2, libarb), Nothing, (Ref{RealFieldElem}, Int), z, prec) + ccall((:arb_const_log2, libflint), Nothing, (Ref{RealFieldElem}, Int), z, prec) return z end @@ -1022,7 +1022,7 @@ Return $\log(10) = 2.302585\ldots$ as an element of $r$. """ function const_log10(r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_const_log10, libarb), Nothing, (Ref{RealFieldElem}, Int), z, prec) + ccall((:arb_const_log10, libflint), Nothing, (Ref{RealFieldElem}, Int), z, prec) return z end @@ -1033,7 +1033,7 @@ Return Euler's constant $\gamma = 0.577215\ldots$ as an element of $r$. """ function const_euler(r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_const_euler, libarb), Nothing, (Ref{RealFieldElem}, Int), z, prec) + ccall((:arb_const_euler, libflint), Nothing, (Ref{RealFieldElem}, Int), z, prec) return z end @@ -1044,7 +1044,7 @@ Return Catalan's constant $C = 0.915965\ldots$ as an element of $r$. """ function const_catalan(r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_const_catalan, libarb), Nothing, (Ref{RealFieldElem}, Int), z, prec) + ccall((:arb_const_catalan, libflint), Nothing, (Ref{RealFieldElem}, Int), z, prec) return z end @@ -1055,7 +1055,7 @@ Return Khinchin's constant $K = 2.685452\ldots$ as an element of $r$. """ function const_khinchin(r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_const_khinchin, libarb), Nothing, (Ref{RealFieldElem}, Int), z, prec) + ccall((:arb_const_khinchin, libflint), Nothing, (Ref{RealFieldElem}, Int), z, prec) return z end @@ -1066,7 +1066,7 @@ Return Glaisher's constant $A = 1.282427\ldots$ as an element of $r$. """ function const_glaisher(r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_const_glaisher, libarb), Nothing, (Ref{RealFieldElem}, Int), z, prec) + ccall((:arb_const_glaisher, libflint), Nothing, (Ref{RealFieldElem}, Int), z, prec) return z end @@ -1080,7 +1080,7 @@ end function floor(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_floor, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_floor, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end @@ -1090,7 +1090,7 @@ floor(::Type{T}, x::RealFieldElem) where {T <: Integer} = T(floor(x)) function ceil(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_ceil, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_ceil, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end @@ -1100,7 +1100,7 @@ ceil(::Type{T}, x::RealFieldElem) where {T <: Integer} = T(ceil(x)) function Base.sqrt(x::RealFieldElem, prec::Int = precision(Balls); check::Bool=true) z = RealFieldElem() - ccall((:arb_sqrt, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_sqrt, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end @@ -1111,7 +1111,7 @@ Return the reciprocal of the square root of $x$, i.e. $1/\sqrt{x}$. """ function rsqrt(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_rsqrt, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_rsqrt, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end @@ -1122,7 +1122,7 @@ Return $\sqrt{1+x}-1$, evaluated accurately for small $x$. """ function sqrt1pm1(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_sqrt1pm1, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_sqrt1pm1, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end @@ -1134,139 +1134,139 @@ number. Thus any negative number in the input interval is discarded. """ function sqrtpos(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_sqrtpos, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_sqrtpos, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function log(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_log, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_log, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function log1p(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_log1p, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_log1p, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function Base.exp(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_exp, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_exp, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function expm1(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_expm1, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_expm1, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function sin(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_sin, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_sin, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function cos(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_cos, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_cos, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function sinpi(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_sin_pi, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_sin_pi, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function cospi(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_cos_pi, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_cos_pi, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function tan(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_tan, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_tan, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function cot(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_cot, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_cot, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function tanpi(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_tan_pi, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_tan_pi, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function cotpi(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_cot_pi, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_cot_pi, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function sinh(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_sinh, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_sinh, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function cosh(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_cosh, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_cosh, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function tanh(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_tanh, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_tanh, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function coth(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_coth, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_coth, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function atan(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_atan, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_atan, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function asin(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_asin, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_asin, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function acos(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_acos, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_acos, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function atanh(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_atanh, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_atanh, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function asinh(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_asinh, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_asinh, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function acosh(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_acosh, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_acosh, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end @@ -1277,7 +1277,7 @@ Return the Gamma function evaluated at $x$. """ function gamma(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_gamma, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_gamma, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end @@ -1288,7 +1288,7 @@ Return the logarithm of the Gamma function evaluated at $x$. """ function lgamma(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_lgamma, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_lgamma, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end @@ -1299,7 +1299,7 @@ Return the reciprocal of the Gamma function evaluated at $x$. """ function rgamma(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_rgamma, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_rgamma, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end @@ -1311,7 +1311,7 @@ i.e. $\psi(x)$. """ function digamma(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_digamma, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_digamma, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end @@ -1322,7 +1322,7 @@ Return the upper incomplete gamma function $\Gamma(s,x)$. """ function gamma(s::RealFieldElem, x::RealFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:arb_hypgeom_gamma_upper, libarb), Nothing, + ccall((:arb_hypgeom_gamma_upper, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int, Int), z, s, x, 0, prec) return z end @@ -1335,7 +1335,7 @@ $\Gamma(s,x) / \Gamma(s)$. """ function gamma_regularized(s::RealFieldElem, x::RealFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:arb_hypgeom_gamma_upper, libarb), Nothing, + ccall((:arb_hypgeom_gamma_upper, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int, Int), z, s, x, 1, prec) return z end @@ -1347,7 +1347,7 @@ Return the lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$. """ function gamma_lower(s::RealFieldElem, x::RealFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:arb_hypgeom_gamma_lower, libarb), Nothing, + ccall((:arb_hypgeom_gamma_lower, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int, Int), z, s, x, 0, prec) return z end @@ -1360,7 +1360,7 @@ $\gamma(s,x) / \Gamma(s)$. """ function gamma_lower_regularized(s::RealFieldElem, x::RealFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:arb_hypgeom_gamma_lower, libarb), Nothing, + ccall((:arb_hypgeom_gamma_lower, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int, Int), z, s, x, 1, prec) return z end @@ -1373,14 +1373,14 @@ Return the Riemann zeta function evaluated at $x$. """ function zeta(x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_zeta, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) + ccall((:arb_zeta, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, prec) return z end function sincos(x::RealFieldElem, prec::Int = precision(Balls)) s = RealFieldElem() c = RealFieldElem() - ccall((:arb_sin_cos, libarb), Nothing, + ccall((:arb_sin_cos, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), s, c, x, prec) return (s, c) end @@ -1388,21 +1388,21 @@ end function sincospi(x::RealFieldElem, prec::Int = precision(Balls)) s = RealFieldElem() c = RealFieldElem() - ccall((:arb_sin_cos_pi, libarb), Nothing, + ccall((:arb_sin_cos_pi, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), s, c, x, prec) return (s, c) end function sinpi(x::QQFieldElem, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_sin_pi_fmpq, libarb), Nothing, + ccall((:arb_sin_pi_fmpq, libflint), Nothing, (Ref{RealFieldElem}, Ref{QQFieldElem}, Int), z, x, prec) return z end function cospi(x::QQFieldElem, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_cos_pi_fmpq, libarb), Nothing, + ccall((:arb_cos_pi_fmpq, libflint), Nothing, (Ref{RealFieldElem}, Ref{QQFieldElem}, Int), z, x, prec) return z end @@ -1410,7 +1410,7 @@ end function sincospi(x::QQFieldElem, r::RealField, prec::Int = precision(Balls)) s = r() c = r() - ccall((:arb_sin_cos_pi_fmpq, libarb), Nothing, + ccall((:arb_sin_cos_pi_fmpq, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{QQFieldElem}, Int), s, c, x, prec) return (s, c) end @@ -1418,14 +1418,14 @@ end function sinhcosh(x::RealFieldElem, prec::Int = precision(Balls)) s = RealFieldElem() c = RealFieldElem() - ccall((:arb_sinh_cosh, libarb), Nothing, + ccall((:arb_sinh_cosh, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), s, c, x, prec) return (s, c) end function atan(y::RealFieldElem, x::RealFieldElem, prec::Int = precision(Balls)) z = parent(y)() - ccall((:arb_atan2, libarb), Nothing, + ccall((:arb_atan2, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, y, x, prec) return z end @@ -1446,7 +1446,7 @@ Return the arithmetic-geometric mean of $x$ and $y$ """ function agm(x::RealFieldElem, y::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_agm, libarb), Nothing, + ccall((:arb_agm, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, y, prec) return z end @@ -1458,21 +1458,21 @@ Return the Hurwitz zeta function $\zeta(s,a)$. """ function zeta(s::RealFieldElem, a::RealFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:arb_hurwitz_zeta, libarb), Nothing, + ccall((:arb_hurwitz_zeta, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, s, a, prec) return z end function hypot(x::RealFieldElem, y::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_hypot, libarb), Nothing, + ccall((:arb_hypot, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, y, prec) return z end function root(x::RealFieldElem, n::UInt, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_root, libarb), Nothing, + ccall((:arb_root, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, UInt, Int), z, x, n, prec) return z end @@ -1496,7 +1496,7 @@ factorial(x::RealFieldElem, prec::Int = precision(Balls)) = gamma(x+1) function factorial(n::UInt, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_fac_ui, libarb), Nothing, (Ref{RealFieldElem}, UInt, Int), z, n, prec) + ccall((:arb_fac_ui, libflint), Nothing, (Ref{RealFieldElem}, UInt, Int), z, n, prec) return z end @@ -1514,7 +1514,7 @@ Return the binomial coefficient ${x \choose n}$. """ function binomial(x::RealFieldElem, n::UInt, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_bin_ui, libarb), Nothing, + ccall((:arb_bin_ui, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, UInt, Int), z, x, n, prec) return z end @@ -1526,7 +1526,7 @@ Return the binomial coefficient ${n \choose k}$ in the given Arb field. """ function binomial(n::UInt, k::UInt, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_bin_uiui, libarb), Nothing, + ccall((:arb_bin_uiui, libflint), Nothing, (Ref{RealFieldElem}, UInt, UInt, Int), z, n, k, prec) return z end @@ -1538,14 +1538,14 @@ Return the $n$-th Fibonacci number in the given Arb field. """ function fibonacci(n::ZZRingElem, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_fib_fmpz, libarb), Nothing, + ccall((:arb_fib_fmpz, libflint), Nothing, (Ref{RealFieldElem}, Ref{ZZRingElem}, Int), z, n, prec) return z end function fibonacci(n::UInt, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_fib_ui, libarb), Nothing, + ccall((:arb_fib_ui, libflint), Nothing, (Ref{RealFieldElem}, UInt, Int), z, n, prec) return z end @@ -1564,7 +1564,7 @@ Return the Gamma function evaluated at $x$ in the given Arb field. """ function gamma(x::ZZRingElem, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_gamma_fmpz, libarb), Nothing, + ccall((:arb_gamma_fmpz, libflint), Nothing, (Ref{RealFieldElem}, Ref{ZZRingElem}, Int), z, x, prec) return z end @@ -1576,7 +1576,7 @@ Return the Gamma function evaluated at $x$ in the given Arb field. """ function gamma(x::QQFieldElem, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_gamma_fmpq, libarb), Nothing, + ccall((:arb_gamma_fmpq, libflint), Nothing, (Ref{RealFieldElem}, Ref{QQFieldElem}, Int), z, x, prec) return z end @@ -1584,7 +1584,7 @@ end function zeta(n::UInt, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_zeta_ui, libarb), Nothing, + ccall((:arb_zeta_ui, libflint), Nothing, (Ref{RealFieldElem}, UInt, Int), z, n, prec) return z end @@ -1599,7 +1599,7 @@ zeta(n::Int, r::RealField, prec::Int = precision(Balls)) = n >= 0 ? zeta(UInt(n) function bernoulli(n::UInt, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_bernoulli_ui, libarb), Nothing, + ccall((:arb_bernoulli_ui, libflint), Nothing, (Ref{RealFieldElem}, UInt, Int), z, n, prec) return z end @@ -1613,7 +1613,7 @@ bernoulli(n::Int, r::RealField, prec::Int = precision(Balls)) = n >= 0 ? bernoul function rising_factorial(x::RealFieldElem, n::UInt, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_rising_ui, libarb), Nothing, + ccall((:arb_rising_ui, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, UInt, Int), z, x, n, prec) return z end @@ -1627,7 +1627,7 @@ rising_factorial(x::RealFieldElem, n::Int, prec::Int = precision(Balls)) = n < 0 function rising_factorial(x::QQFieldElem, n::UInt, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_rising_fmpq_ui, libarb), Nothing, + ccall((:arb_rising_fmpq_ui, libflint), Nothing, (Ref{RealFieldElem}, Ref{QQFieldElem}, UInt, Int), z, x, n, prec) return z end @@ -1643,7 +1643,7 @@ rising_factorial(x::QQFieldElem, n::Int, r::RealField, prec::Int = precision(Bal function rising_factorial2(x::RealFieldElem, n::UInt, prec::Int = precision(Balls)) z = RealFieldElem() w = RealFieldElem() - ccall((:arb_rising2_ui, libarb), Nothing, + ccall((:arb_rising2_ui, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, UInt, Int), z, w, x, n, prec) return (z, w) end @@ -1658,14 +1658,14 @@ rising_factorial2(x::RealFieldElem, n::Int, prec::Int = precision(Balls)) = n < function polylog(s::RealFieldElem, a::RealFieldElem, prec::Int = precision(Balls)) z = parent(s)() - ccall((:arb_polylog, libarb), Nothing, + ccall((:arb_polylog, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, s, a, prec) return z end function polylog(s::Int, a::RealFieldElem, prec::Int = precision(Balls)) z = parent(a)() - ccall((:arb_polylog_si, libarb), Nothing, + ccall((:arb_polylog_si, libflint), Nothing, (Ref{RealFieldElem}, Int, Ref{RealFieldElem}, Int), z, s, a, prec) return z end @@ -1678,14 +1678,14 @@ Return the polylogarithm Li$_s(a)$. function chebyshev_t(n::UInt, x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_chebyshev_t_ui, libarb), Nothing, + ccall((:arb_chebyshev_t_ui, libflint), Nothing, (Ref{RealFieldElem}, UInt, Ref{RealFieldElem}, Int), z, n, x, prec) return z end function chebyshev_u(n::UInt, x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() - ccall((:arb_chebyshev_u_ui, libarb), Nothing, + ccall((:arb_chebyshev_u_ui, libflint), Nothing, (Ref{RealFieldElem}, UInt, Ref{RealFieldElem}, Int), z, n, x, prec) return z end @@ -1693,7 +1693,7 @@ end function chebyshev_t2(n::UInt, x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() w = RealFieldElem() - ccall((:arb_chebyshev_t2_ui, libarb), Nothing, + ccall((:arb_chebyshev_t2_ui, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, UInt, Ref{RealFieldElem}, Int), z, w, n, x, prec) return z, w end @@ -1701,7 +1701,7 @@ end function chebyshev_u2(n::UInt, x::RealFieldElem, prec::Int = precision(Balls)) z = RealFieldElem() w = RealFieldElem() - ccall((:arb_chebyshev_u2_ui, libarb), Nothing, + ccall((:arb_chebyshev_u2_ui, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, UInt, Ref{RealFieldElem}, Int), z, w, n, x, prec) return z, w end @@ -1741,7 +1741,7 @@ Return the Bell number $B_n$ as an element of $r$. """ function bell(n::ZZRingElem, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_bell_fmpz, libarb), Nothing, + ccall((:arb_bell_fmpz, libflint), Nothing, (Ref{RealFieldElem}, Ref{ZZRingElem}, Int), z, n, prec) return z end @@ -1760,7 +1760,7 @@ Return the number of partitions $p(n)$ as an element of $r$. """ function numpart(n::ZZRingElem, r::RealField, prec::Int = precision(Balls)) z = r() - ccall((:arb_partitions_fmpz, libarb), Nothing, + ccall((:arb_partitions_fmpz, libflint), Nothing, (Ref{RealFieldElem}, Ref{ZZRingElem}, Int), z, n, prec) return z end @@ -1785,7 +1785,7 @@ Return the Airy function $\operatorname{Ai}(x)$. """ function airy_ai(x::RealFieldElem, prec::Int = precision(Balls)) ai = RealFieldElem() - ccall((:arb_hypgeom_airy, libarb), Nothing, + ccall((:arb_hypgeom_airy, libflint), Nothing, (Ref{RealFieldElem}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ref{RealFieldElem}, Int), ai, C_NULL, C_NULL, C_NULL, x, prec) return ai @@ -1798,7 +1798,7 @@ Return the Airy function $\operatorname{Bi}(x)$. """ function airy_bi(x::RealFieldElem, prec::Int = precision(Balls)) bi = RealFieldElem() - ccall((:arb_hypgeom_airy, libarb), Nothing, + ccall((:arb_hypgeom_airy, libflint), Nothing, (Ptr{Cvoid}, Ptr{Cvoid}, Ref{RealFieldElem}, Ptr{Cvoid}, Ref{RealFieldElem}, Int), C_NULL, C_NULL, bi, C_NULL, x, prec) return bi @@ -1811,7 +1811,7 @@ Return the derivative of the Airy function $\operatorname{Ai}^\prime(x)$. """ function airy_ai_prime(x::RealFieldElem, prec::Int = precision(Balls)) ai_prime = RealFieldElem() - ccall((:arb_hypgeom_airy, libarb), Nothing, + ccall((:arb_hypgeom_airy, libflint), Nothing, (Ptr{Cvoid}, Ref{RealFieldElem}, Ptr{Cvoid}, Ptr{Cvoid}, Ref{RealFieldElem}, Int), C_NULL, ai_prime, C_NULL, C_NULL, x, prec) return ai_prime @@ -1824,7 +1824,7 @@ Return the derivative of the Airy function $\operatorname{Bi}^\prime(x)$. """ function airy_bi_prime(x::RealFieldElem, prec::Int = precision(Balls)) bi_prime = RealFieldElem() - ccall((:arb_hypgeom_airy, libarb), Nothing, + ccall((:arb_hypgeom_airy, libflint), Nothing, (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), C_NULL, C_NULL, C_NULL, bi_prime, x, prec) return bi_prime @@ -1915,7 +1915,7 @@ function simplest_rational_inside(x::RealFieldElem) b = ZZRingElem() e = ZZRingElem() - ccall((:arb_get_interval_fmpz_2exp, libarb), Nothing, + ccall((:arb_get_interval_fmpz_2exp, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{RealFieldElem}), a, b, e, x) !fits(Int, e) && error("Result does not fit into an QQFieldElem") _e = Int(e) @@ -1934,7 +1934,7 @@ end ################################################################################ function zero!(z::RealFieldElem) - ccall((:arb_zero, libarb), Nothing, (Ref{RealFieldElem},), z) + ccall((:arb_zero, libflint), Nothing, (Ref{RealFieldElem},), z) return z end @@ -1942,7 +1942,7 @@ for (s,f) in (("add!","arb_add"), ("mul!","arb_mul"), ("div!", "arb_div"), ("sub!","arb_sub")) @eval begin function ($(Symbol(s)))(z::RealFieldElem, x::RealFieldElem, y::RealFieldElem, prec::Int = precision(Balls)) - ccall(($f, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), + ccall(($f, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, x, y, prec) return z end @@ -1950,7 +1950,7 @@ for (s,f) in (("add!","arb_add"), ("mul!","arb_mul"), ("div!", "arb_div"), end function addeq!(z::RealFieldElem, x::RealFieldElem, prec::Int = precision(Balls)) - ccall((:arb_add, libarb), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), + ccall((:arb_add, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int), z, z, x, prec) return z end @@ -1966,12 +1966,12 @@ for (typeofx, passtoc) in ((RealFieldElem, Ref{RealFieldElem}), (Ptr{RealFieldEl ("arb_set_d", Float64)) @eval begin function _arb_set(x::($typeofx), y::($t)) - ccall(($f, libarb), Nothing, (($passtoc), ($t)), x, y) + ccall(($f, libflint), Nothing, (($passtoc), ($t)), x, y) end function _arb_set(x::($typeofx), y::($t), p::Int) _arb_set(x, y) - ccall((:arb_set_round, libarb), Nothing, + ccall((:arb_set_round, libflint), Nothing, (($passtoc), ($passtoc), Int), x, x, p) end end @@ -1979,52 +1979,52 @@ for (typeofx, passtoc) in ((RealFieldElem, Ref{RealFieldElem}), (Ptr{RealFieldEl @eval begin function _arb_set(x::($typeofx), y::ZZRingElem) - ccall((:arb_set_fmpz, libarb), Nothing, (($passtoc), Ref{ZZRingElem}), x, y) + ccall((:arb_set_fmpz, libflint), Nothing, (($passtoc), Ref{ZZRingElem}), x, y) end function _arb_set(x::($typeofx), y::ZZRingElem, p::Int) - ccall((:arb_set_round_fmpz, libarb), Nothing, + ccall((:arb_set_round_fmpz, libflint), Nothing, (($passtoc), Ref{ZZRingElem}, Int), x, y, p) end function _arb_set(x::($typeofx), y::QQFieldElem, p::Int) - ccall((:arb_set_fmpq, libarb), Nothing, + ccall((:arb_set_fmpq, libflint), Nothing, (($passtoc), Ref{QQFieldElem}, Int), x, y, p) end function _arb_set(x::($typeofx), y::RealFieldElem) - ccall((:arb_set, libarb), Nothing, (($passtoc), Ref{RealFieldElem}), x, y) + ccall((:arb_set, libflint), Nothing, (($passtoc), Ref{RealFieldElem}), x, y) end function _arb_set(x::($typeofx), y::RealFieldElem, p::Int) - ccall((:arb_set_round, libarb), Nothing, + ccall((:arb_set_round, libflint), Nothing, (($passtoc), Ref{RealFieldElem}, Int), x, y, p) end function _arb_set(x::($typeofx), y::AbstractString, p::Int) s = string(y) - err = ccall((:arb_set_str, libarb), Int32, + err = ccall((:arb_set_str, libflint), Int32, (($passtoc), Ptr{UInt8}, Int), x, s, p) err == 0 || error("Invalid real string: $(repr(s))") end function _arb_set(x::($typeofx), y::BigFloat) - m = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, + m = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (($passtoc), ), x) - r = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, + r = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (($passtoc), ), x) - ccall((:arf_set_mpfr, libarb), Nothing, + ccall((:arf_set_mpfr, libflint), Nothing, (Ptr{arf_struct}, Ref{BigFloat}), m, y) - ccall((:mag_zero, libarb), Nothing, (Ptr{mag_struct}, ), r) + ccall((:mag_zero, libflint), Nothing, (Ptr{mag_struct}, ), r) end function _arb_set(x::($typeofx), y::BigFloat, p::Int) - m = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (($passtoc), ), x) - r = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (($passtoc), ), x) - ccall((:arf_set_mpfr, libarb), Nothing, + m = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (($passtoc), ), x) + r = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (($passtoc), ), x) + ccall((:arf_set_mpfr, libflint), Nothing, (Ptr{arf_struct}, Ref{BigFloat}), m, y) - ccall((:mag_zero, libarb), Nothing, (Ptr{mag_struct}, ), r) - ccall((:arb_set_round, libarb), Nothing, + ccall((:mag_zero, libflint), Nothing, (Ptr{mag_struct}, ), r) + ccall((:arb_set_round, libflint), Nothing, (($passtoc), ($passtoc), Int), x, x, p) end @@ -2107,22 +2107,22 @@ function rand(r::RealField, prec::Int = precision(Balls); randtype::Symbol=:uran x = r() if randtype == :urandom - ccall((:arb_urandom, libarb), Nothing, + ccall((:arb_urandom, libflint), Nothing, (Ref{RealFieldElem}, Ptr{Cvoid}, Int), x, state.ptr, prec) elseif randtype == :randtest - ccall((:arb_randtest, libarb), Nothing, + ccall((:arb_randtest, libflint), Nothing, (Ref{RealFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, prec, 30) elseif randtype == :randtest_exact - ccall((:arb_randtest_exact, libarb), Nothing, + ccall((:arb_randtest_exact, libflint), Nothing, (Ref{RealFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, prec, 30) elseif randtype == :randtest_precise - ccall((:arb_randtest_precise, libarb), Nothing, + ccall((:arb_randtest_precise, libflint), Nothing, (Ref{RealFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, prec, 30) elseif randtype == :randtest_wide - ccall((:arb_randtest_wide, libarb), Nothing, + ccall((:arb_randtest_wide, libflint), Nothing, (Ref{RealFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, prec, 30) elseif randtype == :randtest_special - ccall((:arb_randtest_special, libarb), Nothing, + ccall((:arb_randtest_special, libflint), Nothing, (Ref{RealFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, prec, 30) else error("Arb random generation `" * String(randtype) * "` is not defined") diff --git a/src/arb/RealMat.jl b/src/arb/RealMat.jl index b162bf416..021813f6b 100644 --- a/src/arb/RealMat.jl +++ b/src/arb/RealMat.jl @@ -43,9 +43,9 @@ end function getindex!(z::ArbFieldElem, x::RealMat, r::Int, c::Int) GC.@preserve x begin - v = ccall((:arb_mat_entry_ptr, libarb), Ptr{RealFieldElem}, + v = ccall((:arb_mat_entry_ptr, libflint), Ptr{RealFieldElem}, (Ref{RealMat}, Int, Int), x, r - 1, c - 1) - ccall((:arb_set, libarb), Nothing, (Ref{RealFieldElem}, Ptr{RealFieldElem}), z, v) + ccall((:arb_set, libflint), Nothing, (Ref{RealFieldElem}, Ptr{RealFieldElem}), z, v) end return z end @@ -55,9 +55,9 @@ end z = base_ring(x)() GC.@preserve x begin - v = ccall((:arb_mat_entry_ptr, libarb), Ptr{RealFieldElem}, + v = ccall((:arb_mat_entry_ptr, libflint), Ptr{RealFieldElem}, (Ref{RealMat}, Int, Int), x, r - 1, c - 1) - ccall((:arb_set, libarb), Nothing, (Ref{RealFieldElem}, Ptr{RealFieldElem}), z, v) + ccall((:arb_set, libflint), Nothing, (Ref{RealFieldElem}, Ptr{RealFieldElem}), z, v) end return z end @@ -68,7 +68,7 @@ for T in [Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, RealFieldElem, @boundscheck Generic._checkbounds(x, r, c) GC.@preserve x begin - z = ccall((:arb_mat_entry_ptr, libarb), Ptr{RealFieldElem}, + z = ccall((:arb_mat_entry_ptr, libflint), Ptr{RealFieldElem}, (Ref{RealMat}, Int, Int), x, r - 1, c - 1) Nemo._arb_set(z, y, precision(Balls)) end @@ -88,7 +88,7 @@ zero(a::RealMatSpace) = a() function one(x::RealMatSpace) z = x() - ccall((:arb_mat_one, libarb), Nothing, (Ref{RealMat}, ), z) + ccall((:arb_mat_one, libflint), Nothing, (Ref{RealMat}, ), z) return z end @@ -102,7 +102,7 @@ number_of_columns(a::RealMatSpace) = a.ncols function deepcopy_internal(x::RealMat, dict::IdDict) z = RealMat(nrows(x), ncols(x)) - ccall((:arb_mat_set, libarb), Nothing, (Ref{RealMat}, Ref{RealMat}), z, x) + ccall((:arb_mat_set, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}), z, x) return z end @@ -114,7 +114,7 @@ end function -(x::RealMat) z = similar(x) - ccall((:arb_mat_neg, libarb), Nothing, (Ref{RealMat}, Ref{RealMat}), z, x) + ccall((:arb_mat_neg, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}), z, x) return z end @@ -126,7 +126,7 @@ end function transpose(x::RealMat) z = similar(x, ncols(x), nrows(x)) - ccall((:arb_mat_transpose, libarb), Nothing, + ccall((:arb_mat_transpose, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}), z, x) return z end @@ -140,7 +140,7 @@ end function +(x::RealMat, y::RealMat) check_parent(x, y) z = similar(x) - ccall((:arb_mat_add, libarb), Nothing, + ccall((:arb_mat_add, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, Ref{RealMat}, Int), z, x, y, precision(Balls)) return z @@ -149,7 +149,7 @@ end function -(x::RealMat, y::RealMat) check_parent(x, y) z = similar(x) - ccall((:arb_mat_sub, libarb), Nothing, + ccall((:arb_mat_sub, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, Ref{RealMat}, Int), z, x, y, precision(Balls)) return z @@ -158,7 +158,7 @@ end function *(x::RealMat, y::RealMat) ncols(x) != nrows(y) && error("Matrices have wrong dimensions") z = similar(x, nrows(x), ncols(y)) - ccall((:arb_mat_mul, libarb), Nothing, + ccall((:arb_mat_mul, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, Ref{RealMat}, Int), z, x, y, precision(Balls)) return z @@ -173,7 +173,7 @@ end function ^(x::RealMat, y::UInt) nrows(x) != ncols(x) && error("Matrix must be square") z = similar(x) - ccall((:arb_mat_pow_ui, libarb), Nothing, + ccall((:arb_mat_pow_ui, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, UInt, Int), z, x, y, precision(Balls)) return z @@ -181,7 +181,7 @@ end function *(x::RealMat, y::Int) z = similar(x) - ccall((:arb_mat_scalar_mul_si, libarb), Nothing, + ccall((:arb_mat_scalar_mul_si, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, Int, Int), z, x, y, precision(Balls)) return z @@ -195,7 +195,7 @@ end function *(x::RealMat, y::ZZRingElem) z = similar(x) - ccall((:arb_mat_scalar_mul_fmpz, libarb), Nothing, + ccall((:arb_mat_scalar_mul_fmpz, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, Ref{ZZRingElem}, Int), z, x, y, precision(Balls)) return z @@ -205,7 +205,7 @@ end function *(x::RealMat, y::ArbFieldElem) z = similar(x) - ccall((:arb_mat_scalar_mul_arb, libarb), Nothing, + ccall((:arb_mat_scalar_mul_arb, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, Ref{RealFieldElem}, Int), z, x, y, precision(Balls)) return z @@ -277,7 +277,7 @@ end function ldexp(x::RealMat, y::Int) z = similar(x) - ccall((:arb_mat_scalar_mul_2exp_si, libarb), Nothing, + ccall((:arb_mat_scalar_mul_2exp_si, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, Int), z, x, y) return z end @@ -295,7 +295,7 @@ Return `true` if the matrices of balls $x$ and $y$ are precisely equal, i.e. if all matrix entries have the same midpoints and radii. """ function isequal(x::RealMat, y::RealMat) - r = ccall((:arb_mat_equal, libarb), Cint, + r = ccall((:arb_mat_equal, libflint), Cint, (Ref{RealMat}, Ref{RealMat}), x, y) return Bool(r) end @@ -303,12 +303,12 @@ end function ==(x::RealMat, y::RealMat) fl = check_parent(x, y, false) !fl && return false - r = ccall((:arb_mat_eq, libarb), Cint, (Ref{RealMat}, Ref{RealMat}), x, y) + r = ccall((:arb_mat_eq, libflint), Cint, (Ref{RealMat}, Ref{RealMat}), x, y) return Bool(r) end function !=(x::RealMat, y::RealMat) - r = ccall((:arb_mat_ne, libarb), Cint, (Ref{RealMat}, Ref{RealMat}), x, y) + r = ccall((:arb_mat_ne, libflint), Cint, (Ref{RealMat}, Ref{RealMat}), x, y) return Bool(r) end @@ -319,7 +319,7 @@ Returns `true` if all entries of $x$ overlap with the corresponding entry of $y$, otherwise return `false`. """ function overlaps(x::RealMat, y::RealMat) - r = ccall((:arb_mat_overlaps, libarb), Cint, + r = ccall((:arb_mat_overlaps, libflint), Cint, (Ref{RealMat}, Ref{RealMat}), x, y) return Bool(r) end @@ -331,7 +331,7 @@ Returns `true` if all entries of $x$ contain the corresponding entry of $y$, otherwise return `false`. """ function contains(x::RealMat, y::RealMat) - r = ccall((:arb_mat_contains, libarb), Cint, + r = ccall((:arb_mat_contains, libflint), Cint, (Ref{RealMat}, Ref{RealMat}), x, y) return Bool(r) end @@ -349,7 +349,7 @@ Returns `true` if all entries of $x$ contain the corresponding entry of $y$, otherwise return `false`. """ function contains(x::RealMat, y::ZZMatrix) - r = ccall((:arb_mat_contains_fmpz_mat, libarb), Cint, + r = ccall((:arb_mat_contains_fmpz_mat, libflint), Cint, (Ref{RealMat}, Ref{ZZMatrix}), x, y) return Bool(r) end @@ -362,7 +362,7 @@ Returns `true` if all entries of $x$ contain the corresponding entry of $y$, otherwise return `false`. """ function contains(x::RealMat, y::QQMatrix) - r = ccall((:arb_mat_contains_fmpq_mat, libarb), Cint, + r = ccall((:arb_mat_contains_fmpq_mat, libflint), Cint, (Ref{RealMat}, Ref{QQMatrix}), x, y) return Bool(r) end @@ -401,7 +401,7 @@ end function is_invertible_with_inverse(x::RealMat) ncols(x) != nrows(x) && return false, x z = similar(x) - r = ccall((:arb_mat_inv, libarb), Cint, + r = ccall((:arb_mat_inv, libflint), Cint, (Ref{RealMat}, Ref{RealMat}, Int), z, x, precision(Balls)) return Bool(r), z end @@ -426,7 +426,7 @@ end function divexact(x::RealMat, y::Int; check::Bool=true) y == 0 && throw(DivideError()) z = similar(x) - ccall((:arb_mat_scalar_div_si, libarb), Nothing, + ccall((:arb_mat_scalar_div_si, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, Int, Int), z, x, y, precision(Balls)) return z @@ -434,7 +434,7 @@ end function divexact(x::RealMat, y::ZZRingElem; check::Bool=true) z = similar(x) - ccall((:arb_mat_scalar_div_fmpz, libarb), Nothing, + ccall((:arb_mat_scalar_div_fmpz, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, Ref{ZZRingElem}, Int), z, x, y, precision(Balls)) return z @@ -442,7 +442,7 @@ end function divexact(x::RealMat, y::ArbFieldElem; check::Bool=true) z = similar(x) - ccall((:arb_mat_scalar_div_arb, libarb), Nothing, + ccall((:arb_mat_scalar_div_arb, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, Ref{RealFieldElem}, Int), z, x, y, precision(Balls)) return z @@ -457,7 +457,7 @@ end function charpoly(x::RealPolyRing, y::RealMat, prec::Int = precision(Balls)) base_ring(y) != base_ring(x) && error("Base rings must coincide") z = x() - ccall((:arb_mat_charpoly, libarb), Nothing, + ccall((:arb_mat_charpoly, libflint), Nothing, (Ref{RealPoly}, Ref{RealMat}, Int), z, y, prec) return z end @@ -471,7 +471,7 @@ end function det(x::RealMat, prec::Int = precision(Balls)) ncols(x) != nrows(x) && error("Matrix must be square") z = base_ring(x)() - ccall((:arb_mat_det, libarb), Nothing, + ccall((:arb_mat_det, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealMat}, Int), z, x, prec) return z end @@ -485,7 +485,7 @@ end function Base.exp(x::RealMat) ncols(x) != nrows(x) && error("Matrix must be square") z = similar(x) - ccall((:arb_mat_exp, libarb), Nothing, + ccall((:arb_mat_exp, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, Int), z, x, precision(Balls)) return z end @@ -499,7 +499,7 @@ end function lu!(P::Generic.Perm, x::RealMat) parent(P).n != nrows(x) && error("Permutation does not match matrix") P.d .-= 1 - r = ccall((:arb_mat_lu, libarb), Cint, + r = ccall((:arb_mat_lu, libflint), Cint, (Ptr{Int}, Ref{RealMat}, Ref{RealMat}, Int), P.d, x, x, precision(Balls)) r == 0 && error("Could not find $(nrows(x)) invertible pivot elements") @@ -509,7 +509,7 @@ function lu!(P::Generic.Perm, x::RealMat) end function _solve!(z::RealMat, x::RealMat, y::RealMat) - r = ccall((:arb_mat_solve, libarb), Cint, + r = ccall((:arb_mat_solve, libflint), Cint, (Ref{RealMat}, Ref{RealMat}, Ref{RealMat}, Int), z, x, y, precision(Balls)) r == 0 && error("Matrix cannot be inverted numerically") @@ -518,7 +518,7 @@ end function _solve_lu_precomp!(z::RealMat, P::Generic.Perm, LU::RealMat, y::RealMat) Q = inv(P) - ccall((:arb_mat_solve_lu_precomp, libarb), Nothing, + ccall((:arb_mat_solve_lu_precomp, libflint), Nothing, (Ref{RealMat}, Ptr{Int}, Ref{RealMat}, Ref{RealMat}, Int), z, Q.d .- 1, LU, y, precision(Balls)) nothing @@ -539,7 +539,7 @@ function Solve._can_solve_internal_no_check(A::RealMat, b::RealMat, task::Symbol end x = similar(A, ncols(A), ncols(b)) - fl = ccall((:arb_mat_solve, libarb), Cint, + fl = ccall((:arb_mat_solve, libflint), Cint, (Ref{RealMat}, Ref{RealMat}, Ref{RealMat}, Int), x, A, b, precision(Balls)) fl == 0 && error("Matrix cannot be inverted numerically") @@ -571,7 +571,7 @@ function Solve._init_reduce(C::Solve.SolveCtx{RealFieldElem}) P = Generic.Perm(nrows(C)) x = similar(A, nrows(A), ncols(A)) P.d .-= 1 - fl = ccall((:arb_mat_lu, libarb), Cint, + fl = ccall((:arb_mat_lu, libflint), Cint, (Ptr{Int}, Ref{RealMat}, Ref{RealMat}, Int), P.d, x, A, precision(Balls)) fl == 0 && error("Could not find $(nrows(x)) invertible pivot elements") @@ -594,7 +594,7 @@ function Solve._init_reduce_transpose(C::Solve.SolveCtx{RealFieldElem}) P = Generic.Perm(nrows(C)) x = similar(A, nrows(A), ncols(A)) P.d .-= 1 - fl = ccall((:arb_mat_lu, libarb), Cint, + fl = ccall((:arb_mat_lu, libflint), Cint, (Ptr{Int}, Ref{RealMat}, Ref{RealMat}, Int), P.d, x, A, precision(Balls)) fl == 0 && error("Could not find $(nrows(x)) invertible pivot elements") @@ -617,7 +617,7 @@ function Solve._can_solve_internal_no_check(C::Solve.SolveCtx{RealFieldElem}, b: end x = similar(b, ncols(C), ncols(b)) - ccall((:arb_mat_solve_lu_precomp, libarb), Nothing, + ccall((:arb_mat_solve_lu_precomp, libflint), Nothing, (Ref{RealMat}, Ptr{Int}, Ref{RealMat}, Ref{RealMat}, Int), x, inv(p).d .- 1, LU, b, precision(Balls)) @@ -651,7 +651,7 @@ function swap_rows(x::RealMat, i::Int, j::Int) end function swap_rows!(x::RealMat, i::Int, j::Int) - ccall((:arb_mat_swap_rows, libarb), Nothing, + ccall((:arb_mat_swap_rows, libflint), Nothing, (Ref{RealMat}, Ptr{Nothing}, Int, Int), x, C_NULL, i - 1, j - 1) end @@ -671,13 +671,13 @@ bound for the infinity norm for every matrix in $x$ function bound_inf_norm(x::RealMat) z = RealFieldElem() GC.@preserve x z begin - t = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (Ref{RealFieldElem}, ), z) - ccall((:arb_mat_bound_inf_norm, libarb), Nothing, + t = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (Ref{RealFieldElem}, ), z) + ccall((:arb_mat_bound_inf_norm, libflint), Nothing, (Ptr{mag_struct}, Ref{RealMat}), t, x) - s = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (Ref{RealFieldElem}, ), z) - ccall((:arf_set_mag, libarb), Nothing, + s = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ref{RealFieldElem}, ), z) + ccall((:arf_set_mag, libflint), Nothing, (Ptr{arf_struct}, Ptr{mag_struct}), s, t) - ccall((:mag_zero, libarb), Nothing, + ccall((:mag_zero, libflint), Nothing, (Ptr{mag_struct},), t) end return base_ring(x)(z) @@ -693,7 +693,7 @@ for (s,f) in (("add!","arb_mat_add"), ("mul!","arb_mat_mul"), ("sub!","arb_mat_sub")) @eval begin function ($(Symbol(s)))(z::RealMat, x::RealMat, y::RealMat, prec::Int = precision(Balls)) - ccall(($f, libarb), Nothing, + ccall(($f, libflint), Nothing, (Ref{RealMat}, Ref{RealMat}, Ref{RealMat}, Int), z, x, y, prec) return z @@ -808,7 +808,7 @@ function identity_matrix(R::RealField, n::Int) error("dimension must not be negative") end z = RealMat(n, n) - ccall((:arb_mat_one, libarb), Nothing, (Ref{RealMat}, ), z) + ccall((:arb_mat_one, libflint), Nothing, (Ref{RealMat}, ), z) return z end diff --git a/src/arb/RealPoly.jl b/src/arb/RealPoly.jl index b0c2f9654..a452c80b0 100644 --- a/src/arb/RealPoly.jl +++ b/src/arb/RealPoly.jl @@ -16,11 +16,11 @@ elem_type(::Type{RealPolyRing}) = RealPoly dense_poly_type(::Type{RealFieldElem}) = RealPoly -length(x::RealPoly) = ccall((:arb_poly_length, libarb), Int, +length(x::RealPoly) = ccall((:arb_poly_length, libflint), Int, (Ref{RealPoly},), x) function set_length!(x::RealPoly, n::Int) - ccall((:_arb_poly_set_length, libarb), Nothing, + ccall((:_arb_poly_set_length, libflint), Nothing, (Ref{RealPoly}, Int), x, n) return x end @@ -30,7 +30,7 @@ degree(x::RealPoly) = length(x) - 1 function coeff(a::RealPoly, n::Int) n < 0 && throw(DomainError(n, "Index must be non-negative")) t = base_ring(parent(a))() - ccall((:arb_poly_get_coeff_arb, libarb), Nothing, + ccall((:arb_poly_get_coeff_arb, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealPoly}, Int), t, a, n) return t end @@ -41,7 +41,7 @@ one(a::RealPolyRing) = a(1) function gen(a::RealPolyRing) z = RealPoly() - ccall((:arb_poly_set_coeff_si, libarb), Nothing, + ccall((:arb_poly_set_coeff_si, libflint), Nothing, (Ref{RealPoly}, Int, Int), z, 1, 1) z.parent = a return z @@ -99,7 +99,7 @@ end ############################################################################### function isequal(x::RealPoly, y::RealPoly) - return ccall((:arb_poly_equal, libarb), Bool, + return ccall((:arb_poly_equal, libflint), Bool, (Ref{RealPoly}, Ref{RealPoly}), x, y) end @@ -110,7 +110,7 @@ Return `true` if the coefficient balls of $x$ overlap the coefficient balls of $y$, otherwise return `false`. """ function overlaps(x::RealPoly, y::RealPoly) - return ccall((:arb_poly_overlaps, libarb), Bool, + return ccall((:arb_poly_overlaps, libflint), Bool, (Ref{RealPoly}, Ref{RealPoly}), x, y) end @@ -121,7 +121,7 @@ Return `true` if the coefficient balls of $x$ contain the corresponding coefficient balls of $y$, otherwise return `false`. """ function contains(x::RealPoly, y::RealPoly) - return ccall((:arb_poly_contains, libarb), Bool, + return ccall((:arb_poly_contains, libflint), Bool, (Ref{RealPoly}, Ref{RealPoly}), x, y) end @@ -132,7 +132,7 @@ Return `true` if the coefficient balls of $x$ contain the corresponding exact coefficients of $y$, otherwise return `false`. """ function contains(x::RealPoly, y::ZZPolyRingElem) - return ccall((:arb_poly_contains_fmpz_poly, libarb), Bool, + return ccall((:arb_poly_contains_fmpz_poly, libflint), Bool, (Ref{RealPoly}, Ref{ZZPolyRingElem}), x, y) end @@ -143,7 +143,7 @@ Return `true` if the coefficient balls of $x$ contain the corresponding exact coefficients of $y$, otherwise return `false`. """ function contains(x::RealPoly, y::QQPolyRingElem) - return ccall((:arb_poly_contains_fmpq_poly, libarb), Bool, + return ccall((:arb_poly_contains_fmpq_poly, libflint), Bool, (Ref{RealPoly}, Ref{QQPolyRingElem}), x, y) end @@ -177,7 +177,7 @@ In the former case, $z$ is set to the integer polynomial. """ function unique_integer(x::RealPoly) z = ZZPolyRing(ZZ, var(parent(x)))() - unique = ccall((:arb_poly_get_unique_fmpz_poly, libarb), Int, + unique = ccall((:arb_poly_get_unique_fmpz_poly, libflint), Int, (Ref{ZZPolyRingElem}, Ref{RealPoly}), z, x) return (unique != 0, z) end @@ -191,7 +191,7 @@ end function shift_left(x::RealPoly, len::Int) len < 0 && throw(DomainError(len, "Shift must be non-negative")) z = parent(x)() - ccall((:arb_poly_shift_left, libarb), Nothing, + ccall((:arb_poly_shift_left, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Int), z, x, len) return z end @@ -199,7 +199,7 @@ end function shift_right(x::RealPoly, len::Int) len < 0 && throw(DomainError(len, "Shift must be non-negative")) z = parent(x)() - ccall((:arb_poly_shift_right, libarb), Nothing, + ccall((:arb_poly_shift_right, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Int), z, x, len) return z end @@ -212,7 +212,7 @@ end function -(x::RealPoly) z = parent(x)() - ccall((:arb_poly_neg, libarb), Nothing, (Ref{RealPoly}, Ref{RealPoly}), z, x) + ccall((:arb_poly_neg, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}), z, x) return z end @@ -224,7 +224,7 @@ end function +(x::RealPoly, y::RealPoly) z = parent(x)() - ccall((:arb_poly_add, libarb), Nothing, + ccall((:arb_poly_add, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Ref{RealPoly}, Int), z, x, y, precision(Balls)) return z @@ -232,7 +232,7 @@ end function *(x::RealPoly, y::RealPoly) z = parent(x)() - ccall((:arb_poly_mul, libarb), Nothing, + ccall((:arb_poly_mul, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Ref{RealPoly}, Int), z, x, y, precision(Balls)) return z @@ -240,7 +240,7 @@ end function -(x::RealPoly, y::RealPoly) z = parent(x)() - ccall((:arb_poly_sub, libarb), Nothing, + ccall((:arb_poly_sub, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Ref{RealPoly}, Int), z, x, y, precision(Balls)) return z @@ -249,7 +249,7 @@ end function ^(x::RealPoly, y::Int) y < 0 && throw(DomainError(y, "Exponent must be non-negative")) z = parent(x)() - ccall((:arb_poly_pow_ui, libarb), Nothing, + ccall((:arb_poly_pow_ui, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, UInt, Int), z, x, y, precision(Balls)) return z @@ -305,7 +305,7 @@ function Base.divrem(x::RealPoly, y::RealPoly) iszero(y) && throw(DivideError()) q = parent(x)() r = parent(x)() - if (ccall((:arb_poly_divrem, libarb), Int, + if (ccall((:arb_poly_divrem, libflint), Int, (Ref{RealPoly}, Ref{RealPoly}, Ref{RealPoly}, Ref{RealPoly}, Int), q, r, x, y, precision(Balls)) == 1) return (q, r) @@ -335,7 +335,7 @@ function truncate(a::RealPoly, n::Int) end # todo: implement set_trunc in ArbFieldElem z = deepcopy(a) - ccall((:arb_poly_truncate, libarb), Nothing, + ccall((:arb_poly_truncate, libflint), Nothing, (Ref{RealPoly}, Int), z, n) return z end @@ -343,7 +343,7 @@ end function mullow(x::RealPoly, y::RealPoly, n::Int, prec::Int = precision(Balls)) n < 0 && throw(DomainError(n, "Index must be non-negative")) z = parent(x)() - ccall((:arb_poly_mullow, libarb), Nothing, + ccall((:arb_poly_mullow, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Ref{RealPoly}, Int, Int), z, x, y, n, prec) return z @@ -358,7 +358,7 @@ end #function reverse(x::RealPoly, len::Int) # len < 0 && throw(DomainError()) # z = parent(x)() -# ccall((:arb_poly_reverse, libarb), Nothing, +# ccall((:arb_poly_reverse, libflint), Nothing, # (Ref{RealPoly}, Ref{RealPoly}, Int), z, x, len) # return z #end @@ -371,7 +371,7 @@ end function evaluate(x::RealPoly, y::RealFieldElem, prec::Int = precision(Balls)) z = parent(y)() - ccall((:arb_poly_evaluate, libarb), Nothing, + ccall((:arb_poly_evaluate, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealPoly}, Ref{RealFieldElem}, Int), z, x, y, prec) return z @@ -379,7 +379,7 @@ end function evaluate(x::RealPoly, y::AcbFieldElem, prec::Int = precision(Balls)) z = parent(y)() - ccall((:arb_poly_evaluate_acb, libarb), Nothing, + ccall((:arb_poly_evaluate_acb, libflint), Nothing, (Ref{AcbFieldElem}, Ref{RealPoly}, Ref{AcbFieldElem}, Int), z, x, y, prec) return z @@ -400,7 +400,7 @@ its derivative evaluated at $y$. function evaluate2(x::RealPoly, y::RealFieldElem, prec::Int = precision(Balls)) z = parent(y)() w = parent(y)() - ccall((:arb_poly_evaluate2, libarb), Nothing, + ccall((:arb_poly_evaluate2, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealPoly}, Ref{RealFieldElem}, Int), z, w, x, y, prec) return z, w @@ -409,7 +409,7 @@ end function evaluate2(x::RealPoly, y::ComplexFieldElem, prec::Int = precision(Balls)) z = parent(y)() w = parent(y)() - ccall((:arb_poly_evaluate2_acb, libarb), Nothing, + ccall((:arb_poly_evaluate2_acb, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{RealPoly}, Ref{AcbFieldElem}, Int), z, w, x, y, prec) return z, w @@ -432,7 +432,7 @@ function compose(x::RealPoly, y::RealPoly, prec::Int = precision(Balls); inner:: @assert inner == :second z = parent(x)() - ccall((:arb_poly_compose, libarb), Nothing, + ccall((:arb_poly_compose, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Ref{RealPoly}, Int), z, x, y, prec) return z @@ -446,14 +446,14 @@ end function derivative(x::RealPoly, prec::Int = precision(Balls)) z = parent(x)() - ccall((:arb_poly_derivative, libarb), Nothing, + ccall((:arb_poly_derivative, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Int), z, x, prec) return z end function integral(x::RealPoly, prec::Int = precision(Balls)) z = parent(x)() - ccall((:arb_poly_integral, libarb), Nothing, + ccall((:arb_poly_integral, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Int), z, x, prec) return z end @@ -465,13 +465,13 @@ end ############################################################################### function arb_vec(n::Int) - return ccall((:_arb_vec_init, libarb), Ptr{arb_struct}, (Int,), n) + return ccall((:_arb_vec_init, libflint), Ptr{arb_struct}, (Int,), n) end function arb_vec(b::Vector{RealFieldElem}) - v = ccall((:_arb_vec_init, libarb), Ptr{arb_struct}, (Int,), length(b)) + v = ccall((:_arb_vec_init, libflint), Ptr{arb_struct}, (Int,), length(b)) for i=1:length(b) - ccall((:arb_set, libarb), Nothing, (Ptr{arb_struct}, Ref{RealFieldElem}), + ccall((:arb_set, libflint), Nothing, (Ptr{arb_struct}, Ref{RealFieldElem}), v + (i-1)*sizeof(arb_struct), b[i]) end return v @@ -481,14 +481,14 @@ function array(R::RealField, v::Ptr{arb_struct}, n::Int) r = Vector{RealFieldElem}(undef, n) for i=1:n r[i] = R() - ccall((:arb_set, libarb), Nothing, (Ref{RealFieldElem}, Ptr{arb_struct}), + ccall((:arb_set, libflint), Nothing, (Ref{RealFieldElem}, Ptr{arb_struct}), r[i], v + (i-1)*sizeof(arb_struct)) end return r end function arb_vec_clear(v::Ptr{arb_struct}, n::Int) - ccall((:_arb_vec_clear, libarb), Nothing, (Ptr{arb_struct}, Int), v, n) + ccall((:_arb_vec_clear, libflint), Nothing, (Ptr{arb_struct}, Int), v, n) end @doc raw""" @@ -499,7 +499,7 @@ Construct a polynomial in the given polynomial ring from a list of its roots. function from_roots(R::RealPolyRing, b::Vector{RealFieldElem}, prec::Int = precision(Balls)) z = R() tmp = arb_vec(b) - ccall((:arb_poly_product_roots, libarb), Nothing, + ccall((:arb_poly_product_roots, libflint), Nothing, (Ref{RealPoly}, Ptr{arb_struct}, Int, Int), z, tmp, length(b), prec) arb_vec_clear(tmp, length(b)) return z @@ -511,7 +511,7 @@ end function evaluate_fast(x::RealPoly, b::Vector{RealFieldElem}, prec::Int = precision(Balls)) tmp = arb_vec(b) - ccall((:arb_poly_evaluate_vec_fast, libarb), Nothing, + ccall((:arb_poly_evaluate_vec_fast, libflint), Nothing, (Ptr{arb_struct}, Ref{RealPoly}, Ptr{arb_struct}, Int, Int), tmp, x, tmp, length(b), prec) res = array(base_ring(parent(x)), tmp, length(b)) @@ -524,7 +524,7 @@ function interpolate_newton(R::RealPolyRing, xs::Vector{RealFieldElem}, ys::Vect z = R() xsv = arb_vec(xs) ysv = arb_vec(ys) - ccall((:arb_poly_interpolate_newton, libarb), Nothing, + ccall((:arb_poly_interpolate_newton, libflint), Nothing, (Ref{RealPoly}, Ptr{arb_struct}, Ptr{arb_struct}, Int, Int), z, xsv, ysv, length(xs), prec) arb_vec_clear(xsv, length(xs)) @@ -537,7 +537,7 @@ function interpolate_barycentric(R::RealPolyRing, xs::Vector{RealFieldElem}, ys: z = R() xsv = arb_vec(xs) ysv = arb_vec(ys) - ccall((:arb_poly_interpolate_barycentric, libarb), Nothing, + ccall((:arb_poly_interpolate_barycentric, libflint), Nothing, (Ref{RealPoly}, Ptr{arb_struct}, Ptr{arb_struct}, Int, Int), z, xsv, ysv, length(xs), prec) arb_vec_clear(xsv, length(xs)) @@ -550,7 +550,7 @@ function interpolate_fast(R::RealPolyRing, xs::Vector{RealFieldElem}, ys::Vector z = R() xsv = arb_vec(xs) ysv = arb_vec(ys) - ccall((:arb_poly_interpolate_fast, libarb), Nothing, + ccall((:arb_poly_interpolate_fast, libflint), Nothing, (Ref{RealPoly}, Ptr{arb_struct}, Ptr{arb_struct}, Int, Int), z, xsv, ysv, length(xs), prec) arb_vec_clear(xsv, length(xs)) @@ -583,14 +583,14 @@ function roots_upper_bound(x::RealPoly) z = base_ring(x)() p = precision(Balls) GC.@preserve x z begin - t = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (Ref{RealFieldElem}, ), z) - ccall((:arb_poly_root_bound_fujiwara, libarb), Nothing, + t = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (Ref{RealFieldElem}, ), z) + ccall((:arb_poly_root_bound_fujiwara, libflint), Nothing, (Ptr{mag_struct}, Ref{RealPoly}), t, x) - s = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (Ref{RealFieldElem}, ), z) - ccall((:arf_set_mag, libarb), Nothing, (Ptr{arf_struct}, Ptr{mag_struct}), s, t) - ccall((:arf_set_round, libarb), Nothing, + s = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ref{RealFieldElem}, ), z) + ccall((:arf_set_mag, libflint), Nothing, (Ptr{arf_struct}, Ptr{mag_struct}), s, t) + ccall((:arf_set_round, libflint), Nothing, (Ptr{arf_struct}, Ptr{arf_struct}, Int, Cint), s, s, p, ARB_RND_CEIL) - ccall((:mag_zero, libarb), Nothing, (Ptr{mag_struct},), t) + ccall((:mag_zero, libflint), Nothing, (Ptr{mag_struct},), t) end return z end @@ -602,45 +602,45 @@ end ############################################################################### function zero!(z::RealPoly) - ccall((:arb_poly_zero, libarb), Nothing, + ccall((:arb_poly_zero, libflint), Nothing, (Ref{RealPoly}, ), z) return z end function fit!(z::RealPoly, n::Int) - ccall((:arb_poly_fit_length, libarb), Nothing, + ccall((:arb_poly_fit_length, libflint), Nothing, (Ref{RealPoly}, Int), z, n) return nothing end function setcoeff!(z::RealPoly, n::Int, x::ZZRingElem) - ccall((:arb_poly_set_coeff_fmpz, libarb), Nothing, + ccall((:arb_poly_set_coeff_fmpz, libflint), Nothing, (Ref{RealPoly}, Int, Ref{ZZRingElem}), z, n, x) return z end function setcoeff!(z::RealPoly, n::Int, x::RealFieldElem) - ccall((:arb_poly_set_coeff_arb, libarb), Nothing, + ccall((:arb_poly_set_coeff_arb, libflint), Nothing, (Ref{RealPoly}, Int, Ref{RealFieldElem}), z, n, x) return z end function mul!(z::RealPoly, x::RealPoly, y::RealPoly) - ccall((:arb_poly_mul, libarb), Nothing, + ccall((:arb_poly_mul, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Ref{RealPoly}, Int), z, x, y, precision(parent(z))) return z end function addeq!(z::RealPoly, x::RealPoly) - ccall((:arb_poly_add, libarb), Nothing, + ccall((:arb_poly_add, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Ref{RealPoly}, Int), z, z, x, precision(parent(z))) return z end function add!(z::RealPoly, x::RealPoly, y::RealPoly) - ccall((:arb_poly_add, libarb), Nothing, + ccall((:arb_poly_add, libflint), Nothing, (Ref{RealPoly}, Ref{RealPoly}, Ref{RealPoly}, Int), z, x, y, precision(parent(z))) return z diff --git a/src/arb/acb.jl b/src/arb/acb.jl index e02289157..b10524384 100644 --- a/src/arb/acb.jl +++ b/src/arb/acb.jl @@ -35,7 +35,7 @@ end function one(r::AcbField) z = AcbFieldElem() - ccall((:acb_one, libarb), Nothing, (Ref{AcbFieldElem}, ), z) + ccall((:acb_one, libflint), Nothing, (Ref{AcbFieldElem}, ), z) z.parent = r return z end @@ -47,7 +47,7 @@ Return exact one times $i$ in the given Arb complex field. """ function onei(r::AcbField) z = AcbFieldElem() - ccall((:acb_onei, libarb), Nothing, (Ref{AcbFieldElem}, ), z) + ccall((:acb_onei, libflint), Nothing, (Ref{AcbFieldElem}, ), z) z.parent = r return z end @@ -60,12 +60,12 @@ Return the relative accuracy of $x$ measured in bits, capped between """ function accuracy_bits(x::AcbFieldElem) # bug in acb.h: rel_accuracy_bits is not in the library - return -ccall((:acb_rel_error_bits, libarb), Int, (Ref{AcbFieldElem},), x) + return -ccall((:acb_rel_error_bits, libflint), Int, (Ref{AcbFieldElem},), x) end function deepcopy_internal(a::AcbFieldElem, dict::IdDict) b = parent(a)() - ccall((:acb_set, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), b, a) + ccall((:acb_set, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), b, a) return b end @@ -90,13 +90,13 @@ characteristic(::AcbField) = 0 function convert(::Type{ComplexF64}, x::AcbFieldElem) GC.@preserve x begin - re = ccall((:acb_real_ptr, libarb), Ptr{arb_struct}, (Ref{AcbFieldElem}, ), x) - im = ccall((:acb_imag_ptr, libarb), Ptr{arb_struct}, (Ref{AcbFieldElem}, ), x) - t = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (Ptr{ArbFieldElem}, ), re) - u = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (Ptr{ArbFieldElem}, ), im) + re = ccall((:acb_real_ptr, libflint), Ptr{arb_struct}, (Ref{AcbFieldElem}, ), x) + im = ccall((:acb_imag_ptr, libflint), Ptr{arb_struct}, (Ref{AcbFieldElem}, ), x) + t = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ptr{ArbFieldElem}, ), re) + u = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ptr{ArbFieldElem}, ), im) # 4 == round to nearest - v = ccall((:arf_get_d, libarb), Float64, (Ptr{arf_struct}, Int), t, 4) - w = ccall((:arf_get_d, libarb), Float64, (Ptr{arf_struct}, Int), u, 4) + v = ccall((:arf_get_d, libflint), Float64, (Ptr{arf_struct}, Int), t, 4) + w = ccall((:arf_get_d, libflint), Float64, (Ptr{arf_struct}, Int), u, 4) end return complex(v, w) end @@ -109,14 +109,14 @@ end function real(x::AcbFieldElem) z = ArbFieldElem() - ccall((:acb_get_real, libarb), Nothing, (Ref{ArbFieldElem}, Ref{AcbFieldElem}), z, x) + ccall((:acb_get_real, libflint), Nothing, (Ref{ArbFieldElem}, Ref{AcbFieldElem}), z, x) z.parent = ArbField(parent(x).prec) return z end function imag(x::AcbFieldElem) z = ArbFieldElem() - ccall((:acb_get_imag, libarb), Nothing, (Ref{ArbFieldElem}, Ref{AcbFieldElem}), z, x) + ccall((:acb_get_imag, libflint), Nothing, (Ref{ArbFieldElem}, Ref{AcbFieldElem}), z, x) z.parent = ArbField(parent(x).prec) return z end @@ -167,7 +167,7 @@ end function -(x::AcbFieldElem) z = parent(x)() - ccall((:acb_neg, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, x) + ccall((:acb_neg, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, x) return z end @@ -183,7 +183,7 @@ for (s,f) in ((:+,"acb_add"), (:*,"acb_mul"), (://, "acb_div"), (:-,"acb_sub"), @eval begin function ($s)(x::AcbFieldElem, y::AcbFieldElem) z = parent(x)() - ccall(($f, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), + ccall(($f, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, y, parent(x).prec) return z end @@ -195,7 +195,7 @@ for (f,s) in ((:+, "add"), (:-, "sub"), (:*, "mul"), (://, "div"), (:^, "pow")) function ($f)(x::AcbFieldElem, y::UInt) z = parent(x)() - ccall(($("acb_"*s*"_ui"), libarb), Nothing, + ccall(($("acb_"*s*"_ui"), libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, UInt, Int), z, x, y, parent(x).prec) return z @@ -203,14 +203,14 @@ for (f,s) in ((:+, "add"), (:-, "sub"), (:*, "mul"), (://, "div"), (:^, "pow")) function ($f)(x::AcbFieldElem, y::Int) z = parent(x)() - ccall(($("acb_"*s*"_si"), libarb), Nothing, + ccall(($("acb_"*s*"_si"), libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int, Int), z, x, y, parent(x).prec) return z end function ($f)(x::AcbFieldElem, y::ZZRingElem) z = parent(x)() - ccall(($("acb_"*s*"_fmpz"), libarb), Nothing, + ccall(($("acb_"*s*"_fmpz"), libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{ZZRingElem}, Int), z, x, y, parent(x).prec) return z @@ -218,7 +218,7 @@ for (f,s) in ((:+, "add"), (:-, "sub"), (:*, "mul"), (://, "div"), (:^, "pow")) function ($f)(x::AcbFieldElem, y::ArbFieldElem) z = parent(x)() - ccall(($("acb_"*s*"_arb"), libarb), Nothing, + ccall(($("acb_"*s*"_arb"), libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{ArbFieldElem}, Int), z, x, y, parent(x).prec) return z @@ -247,29 +247,29 @@ end function -(x::UInt, y::AcbFieldElem) z = parent(y)() - ccall((:acb_sub_ui, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, UInt, Int), z, y, x, parent(y).prec) - ccall((:acb_neg, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, z) + ccall((:acb_sub_ui, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, UInt, Int), z, y, x, parent(y).prec) + ccall((:acb_neg, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, z) return z end function -(x::Int, y::AcbFieldElem) z = parent(y)() - ccall((:acb_sub_si, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int, Int), z, y, x, parent(y).prec) - ccall((:acb_neg, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, z) + ccall((:acb_sub_si, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int, Int), z, y, x, parent(y).prec) + ccall((:acb_neg, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, z) return z end function -(x::ZZRingElem, y::AcbFieldElem) z = parent(y)() - ccall((:acb_sub_fmpz, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{ZZRingElem}, Int), z, y, x, parent(y).prec) - ccall((:acb_neg, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, z) + ccall((:acb_sub_fmpz, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{ZZRingElem}, Int), z, y, x, parent(y).prec) + ccall((:acb_neg, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, z) return z end function -(x::ArbFieldElem, y::AcbFieldElem) z = parent(y)() - ccall((:acb_sub_arb, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{ArbFieldElem}, Int), z, y, x, parent(y).prec) - ccall((:acb_neg, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, z) + ccall((:acb_sub_arb, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{ArbFieldElem}, Int), z, y, x, parent(y).prec) + ccall((:acb_neg, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, z) return z end @@ -338,17 +338,17 @@ Return `true` if the boxes $x$ and $y$ are precisely equal, i.e. their real and imaginary parts have the same midpoints and radii. """ function isequal(x::AcbFieldElem, y::AcbFieldElem) - r = ccall((:acb_equal, libarb), Cint, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), x, y) + r = ccall((:acb_equal, libflint), Cint, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), x, y) return Bool(r) end function ==(x::AcbFieldElem, y::AcbFieldElem) - r = ccall((:acb_eq, libarb), Cint, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), x, y) + r = ccall((:acb_eq, libflint), Cint, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), x, y) return Bool(r) end function !=(x::AcbFieldElem, y::AcbFieldElem) - r = ccall((:acb_ne, libarb), Cint, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), x, y) + r = ccall((:acb_ne, libflint), Cint, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), x, y) return Bool(r) end @@ -392,7 +392,7 @@ Returns `true` if any part of the box $x$ overlaps any part of the box $y$, otherwise return `false`. """ function overlaps(x::AcbFieldElem, y::AcbFieldElem) - r = ccall((:acb_overlaps, libarb), Cint, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), x, y) + r = ccall((:acb_overlaps, libflint), Cint, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), x, y) return Bool(r) end @@ -403,7 +403,7 @@ Returns `true` if the box $x$ contains the box $y$, otherwise return `false`. """ function contains(x::AcbFieldElem, y::AcbFieldElem) - r = ccall((:acb_contains, libarb), Cint, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), x, y) + r = ccall((:acb_contains, libflint), Cint, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), x, y) return Bool(r) end @@ -414,7 +414,7 @@ Returns `true` if the box $x$ contains the given rational value, otherwise return `false`. """ function contains(x::AcbFieldElem, y::QQFieldElem) - r = ccall((:acb_contains_fmpq, libarb), Cint, (Ref{AcbFieldElem}, Ref{QQFieldElem}), x, y) + r = ccall((:acb_contains_fmpq, libflint), Cint, (Ref{AcbFieldElem}, Ref{QQFieldElem}), x, y) return Bool(r) end @@ -425,13 +425,13 @@ Returns `true` if the box $x$ contains the given integer value, otherwise return `false`. """ function contains(x::AcbFieldElem, y::ZZRingElem) - r = ccall((:acb_contains_fmpz, libarb), Cint, (Ref{AcbFieldElem}, Ref{ZZRingElem}), x, y) + r = ccall((:acb_contains_fmpz, libflint), Cint, (Ref{AcbFieldElem}, Ref{ZZRingElem}), x, y) return Bool(r) end function contains(x::AcbFieldElem, y::Int) v = ZZRingElem(y) - r = ccall((:acb_contains_fmpz, libarb), Cint, (Ref{AcbFieldElem}, Ref{ZZRingElem}), x, v) + r = ccall((:acb_contains_fmpz, libflint), Cint, (Ref{AcbFieldElem}, Ref{ZZRingElem}), x, v) return Bool(r) end @@ -457,7 +457,7 @@ contains(x::AcbFieldElem, y::Rational{T}) where {T <: Integer} = contains(x, ZZR Returns `true` if the box $x$ contains zero, otherwise return `false`. """ function contains_zero(x::AcbFieldElem) - return Bool(ccall((:acb_contains_zero, libarb), Cint, (Ref{AcbFieldElem},), x)) + return Bool(ccall((:acb_contains_zero, libflint), Cint, (Ref{AcbFieldElem},), x)) end ################################################################################ @@ -476,7 +476,7 @@ end Return `true` if $x$ is certainly zero, otherwise return `false`. """ function iszero(x::AcbFieldElem) - return Bool(ccall((:acb_is_zero, libarb), Cint, (Ref{AcbFieldElem},), x)) + return Bool(ccall((:acb_is_zero, libflint), Cint, (Ref{AcbFieldElem},), x)) end @doc raw""" @@ -485,7 +485,7 @@ end Return `true` if $x$ is certainly one, otherwise return `false`. """ function isone(x::AcbFieldElem) - return Bool(ccall((:acb_is_one, libarb), Cint, (Ref{AcbFieldElem},), x)) + return Bool(ccall((:acb_is_one, libflint), Cint, (Ref{AcbFieldElem},), x)) end @doc raw""" @@ -495,7 +495,7 @@ Return `true` if $x$ is finite, i.e. its real and imaginary parts have finite midpoint and radius, otherwise return `false`. """ function isfinite(x::AcbFieldElem) - return Bool(ccall((:acb_is_finite, libarb), Cint, (Ref{AcbFieldElem},), x)) + return Bool(ccall((:acb_is_finite, libflint), Cint, (Ref{AcbFieldElem},), x)) end @doc raw""" @@ -505,7 +505,7 @@ Return `true` if $x$ is exact, i.e. has its real and imaginary parts have zero radius, otherwise return `false`. """ function is_exact(x::AcbFieldElem) - return Bool(ccall((:acb_is_exact, libarb), Cint, (Ref{AcbFieldElem},), x)) + return Bool(ccall((:acb_is_exact, libflint), Cint, (Ref{AcbFieldElem},), x)) end @doc raw""" @@ -514,11 +514,11 @@ end Return `true` if $x$ is an exact integer, otherwise return `false`. """ function isinteger(x::AcbFieldElem) - return Bool(ccall((:acb_is_int, libarb), Cint, (Ref{AcbFieldElem},), x)) + return Bool(ccall((:acb_is_int, libflint), Cint, (Ref{AcbFieldElem},), x)) end function isreal(x::AcbFieldElem) - return Bool(ccall((:acb_is_real, libarb), Cint, (Ref{AcbFieldElem},), x)) + return Bool(ccall((:acb_is_real, libflint), Cint, (Ref{AcbFieldElem},), x)) end is_negative(x::AcbFieldElem) = isreal(x) && is_negative(real(x)) @@ -531,7 +531,7 @@ is_negative(x::AcbFieldElem) = isreal(x) && is_negative(real(x)) function abs(x::AcbFieldElem) z = ArbFieldElem() - ccall((:acb_abs, libarb), Nothing, + ccall((:acb_abs, libflint), Nothing, (Ref{ArbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) z.parent = ArbField(parent(x).prec) return z @@ -545,7 +545,7 @@ end function inv(x::AcbFieldElem) z = parent(x)() - ccall((:acb_inv, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_inv, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -571,14 +571,14 @@ end function ldexp(x::AcbFieldElem, y::Int) z = parent(x)() - ccall((:acb_mul_2exp_si, libarb), Nothing, + ccall((:acb_mul_2exp_si, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, y) return z end function ldexp(x::AcbFieldElem, y::ZZRingElem) z = parent(x)() - ccall((:acb_mul_2exp_fmpz, libarb), Nothing, + ccall((:acb_mul_2exp_fmpz, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{ZZRingElem}), z, x, y) return z end @@ -597,7 +597,7 @@ by rounding off insignificant bits from midpoints. """ function trim(x::AcbFieldElem) z = parent(x)() - ccall((:acb_trim, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, x) + ccall((:acb_trim, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, x) return z end @@ -611,20 +611,20 @@ integer. """ function unique_integer(x::AcbFieldElem) z = ZZRingElem() - unique = ccall((:acb_get_unique_fmpz, libarb), Int, + unique = ccall((:acb_get_unique_fmpz, libflint), Int, (Ref{ZZRingElem}, Ref{AcbFieldElem}), z, x) return (unique != 0, z) end function conj(x::AcbFieldElem) z = parent(x)() - ccall((:acb_conj, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, x) + ccall((:acb_conj, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}), z, x) return z end function angle(x::AcbFieldElem) z = ArbFieldElem() - ccall((:acb_arg, libarb), Nothing, + ccall((:acb_arg, libflint), Nothing, (Ref{ArbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) z.parent = ArbField(parent(x).prec) return z @@ -643,7 +643,7 @@ Return $\pi = 3.14159\ldots$ as an element of $r$. """ function const_pi(r::AcbField) z = r() - ccall((:acb_const_pi, libarb), Nothing, (Ref{AcbFieldElem}, Int), z, precision(r)) + ccall((:acb_const_pi, libflint), Nothing, (Ref{AcbFieldElem}, Int), z, precision(r)) return z end @@ -657,7 +657,7 @@ end function Base.sqrt(x::AcbFieldElem; check::Bool=true) z = parent(x)() - ccall((:acb_sqrt, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_sqrt, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -668,31 +668,31 @@ Return the reciprocal of the square root of $x$, i.e. $1/\sqrt{x}$. """ function rsqrt(x::AcbFieldElem) z = parent(x)() - ccall((:acb_rsqrt, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_rsqrt, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function log(x::AcbFieldElem) z = parent(x)() - ccall((:acb_log, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_log, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function log1p(x::AcbFieldElem) z = parent(x)() - ccall((:acb_log1p, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_log1p, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function Base.exp(x::AcbFieldElem) z = parent(x)() - ccall((:acb_exp, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_exp, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function Base.expm1(x::AcbFieldElem) z = parent(x)() - ccall((:acb_expm1, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_expm1, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -703,7 +703,7 @@ Return the exponential of $\pi i x$. """ function cispi(x::AcbFieldElem) z = parent(x)() - ccall((:acb_exp_pi_i, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_exp_pi_i, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -715,85 +715,85 @@ Return $\exp(2\pi i/k)$. function root_of_unity(C::AcbField, k::Int) k <= 0 && throw(ArgumentError("Order must be positive ($k)")) z = C() - ccall((:acb_unit_root, libarb), Nothing, (Ref{AcbFieldElem}, UInt, Int), z, k, C.prec) + ccall((:acb_unit_root, libflint), Nothing, (Ref{AcbFieldElem}, UInt, Int), z, k, C.prec) return z end function sin(x::AcbFieldElem) z = parent(x)() - ccall((:acb_sin, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_sin, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function cos(x::AcbFieldElem) z = parent(x)() - ccall((:acb_cos, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_cos, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function tan(x::AcbFieldElem) z = parent(x)() - ccall((:acb_tan, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_tan, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function cot(x::AcbFieldElem) z = parent(x)() - ccall((:acb_cot, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_cot, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function sinpi(x::AcbFieldElem) z = parent(x)() - ccall((:acb_sin_pi, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_sin_pi, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function cospi(x::AcbFieldElem) z = parent(x)() - ccall((:acb_cos_pi, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_cos_pi, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function tanpi(x::AcbFieldElem) z = parent(x)() - ccall((:acb_tan_pi, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_tan_pi, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function cotpi(x::AcbFieldElem) z = parent(x)() - ccall((:acb_cot_pi, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_cot_pi, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function sinh(x::AcbFieldElem) z = parent(x)() - ccall((:acb_sinh, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_sinh, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function cosh(x::AcbFieldElem) z = parent(x)() - ccall((:acb_cosh, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_cosh, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function tanh(x::AcbFieldElem) z = parent(x)() - ccall((:acb_tanh, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_tanh, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function coth(x::AcbFieldElem) z = parent(x)() - ccall((:acb_coth, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_coth, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function atan(x::AcbFieldElem) z = parent(x)() - ccall((:acb_atan, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_atan, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -804,7 +804,7 @@ Return $\log\sin(\pi x)$, constructed without branch cuts off the real line. """ function log_sinpi(x::AcbFieldElem) z = parent(x)() - ccall((:acb_log_sin_pi, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_log_sin_pi, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -815,7 +815,7 @@ Return the Gamma function evaluated at $x$. """ function gamma(x::AcbFieldElem) z = parent(x)() - ccall((:acb_gamma, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_gamma, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -826,7 +826,7 @@ Return the reciprocal of the Gamma function evaluated at $x$. """ function rgamma(x::AcbFieldElem) z = parent(x)() - ccall((:acb_rgamma, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_rgamma, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -837,7 +837,7 @@ Return the logarithm of the Gamma function evaluated at $x$. """ function lgamma(x::AcbFieldElem) z = parent(x)() - ccall((:acb_lgamma, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_lgamma, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -849,7 +849,7 @@ i.e. $\psi(x)$. """ function digamma(x::AcbFieldElem) z = parent(x)() - ccall((:acb_digamma, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_digamma, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -860,7 +860,7 @@ Return the Riemann zeta function evaluated at $x$. """ function zeta(x::AcbFieldElem) z = parent(x)() - ccall((:acb_zeta, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_zeta, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -871,7 +871,7 @@ Return the Barnes $G$-function, evaluated at $x$. """ function barnes_g(x::AcbFieldElem) z = parent(x)() - ccall((:acb_barnes_g, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_barnes_g, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -882,7 +882,7 @@ Return the logarithm of the Barnes $G$-function, evaluated at $x$. """ function log_barnes_g(x::AcbFieldElem) z = parent(x)() - ccall((:acb_log_barnes_g, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_log_barnes_g, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -893,7 +893,7 @@ Return the arithmetic-geometric mean of $1$ and $x$. """ function agm(x::AcbFieldElem) z = parent(x)() - ccall((:acb_agm1, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_agm1, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -904,7 +904,7 @@ Return the error function evaluated at $x$. """ function erf(x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_erf, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_hypgeom_erf, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -915,7 +915,7 @@ Return the imaginary error function evaluated at $x$. """ function erfi(x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_erfi, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_hypgeom_erfi, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -926,7 +926,7 @@ Return the complementary error function evaluated at $x$. """ function erfc(x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_erfc, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_hypgeom_erfc, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -937,7 +937,7 @@ Return the exponential integral evaluated at $x$. """ function exp_integral_ei(x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_ei, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_hypgeom_ei, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -948,7 +948,7 @@ Return the sine integral evaluated at $x$. """ function sin_integral(x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_si, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_hypgeom_si, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -959,7 +959,7 @@ Return the exponential cosine integral evaluated at $x$. """ function cos_integral(x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_ci, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_hypgeom_ci, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -970,7 +970,7 @@ Return the hyperbolic sine integral evaluated at $x$. """ function sinh_integral(x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_shi, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_hypgeom_shi, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -981,7 +981,7 @@ Return the hyperbolic cosine integral evaluated at $x$. """ function cosh_integral(x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_chi, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_hypgeom_chi, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -992,7 +992,7 @@ Return the Dedekind eta function $\eta(\tau)$ at $\tau = x$. """ function dedekind_eta(x::AcbFieldElem) z = parent(x)() - ccall((:acb_modular_eta, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_modular_eta, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1040,7 +1040,7 @@ Return the $j$-invariant $j(\tau)$ at $\tau = x$. """ function j_invariant(x::AcbFieldElem) z = parent(x)() - ccall((:acb_modular_j, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_modular_j, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1051,7 +1051,7 @@ Return the modular lambda function $\lambda(\tau)$ at $\tau = x$. """ function modular_lambda(x::AcbFieldElem) z = parent(x)() - ccall((:acb_modular_lambda, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_modular_lambda, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1062,7 +1062,7 @@ Return the modular delta function $\Delta(\tau)$ at $\tau = x$. """ function modular_delta(x::AcbFieldElem) z = parent(x)() - ccall((:acb_modular_delta, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_modular_delta, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1082,7 +1082,7 @@ function eisenstein_g(k::Int, x::AcbFieldElem) len = div(k, 2) - 1 vec = acb_vec(len) - ccall((:acb_modular_eisenstein, libarb), Nothing, + ccall((:acb_modular_eisenstein, libflint), Nothing, (Ptr{acb_struct}, Ref{AcbFieldElem}, Int, Int), vec, x, len, CC.prec) z = array(CC, vec, len) acb_vec_clear(vec, len) @@ -1096,7 +1096,7 @@ Return the complete elliptic integral $K(x)$. """ function elliptic_k(x::AcbFieldElem) z = parent(x)() - ccall((:acb_modular_elliptic_k, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_modular_elliptic_k, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1107,14 +1107,14 @@ Return the complete elliptic integral $E(x)$. """ function elliptic_e(x::AcbFieldElem) z = parent(x)() - ccall((:acb_modular_elliptic_e, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) + ccall((:acb_modular_elliptic_e, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, parent(x).prec) return z end function sincos(x::AcbFieldElem) s = parent(x)() c = parent(x)() - ccall((:acb_sin_cos, libarb), Nothing, + ccall((:acb_sin_cos, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), s, c, x, parent(x).prec) return (s, c) end @@ -1122,7 +1122,7 @@ end function sincospi(x::AcbFieldElem) s = parent(x)() c = parent(x)() - ccall((:acb_sin_cos_pi, libarb), Nothing, + ccall((:acb_sin_cos_pi, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), s, c, x, parent(x).prec) return (s, c) end @@ -1135,7 +1135,7 @@ Return a tuple $s, c$ consisting of the hyperbolic sine and cosine of $x$. function sinhcosh(x::AcbFieldElem) s = parent(x)() c = parent(x)() - ccall((:acb_sinh_cosh, libarb), Nothing, + ccall((:acb_sinh_cosh, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), s, c, x, parent(x).prec) return (s, c) end @@ -1147,7 +1147,7 @@ Return the Hurwitz zeta function $\zeta(s,a)$. """ function zeta(s::AcbFieldElem, a::AcbFieldElem) z = parent(s)() - ccall((:acb_hurwitz_zeta, libarb), Nothing, + ccall((:acb_hurwitz_zeta, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, s, a, parent(s).prec) return z end @@ -1159,14 +1159,14 @@ Return the generalised polygamma function $\psi(s,z)$. """ function polygamma(s::AcbFieldElem, a::AcbFieldElem) z = parent(s)() - ccall((:acb_polygamma, libarb), Nothing, + ccall((:acb_polygamma, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, s, a, parent(s).prec) return z end function rising_factorial(x::AcbFieldElem, n::UInt) z = parent(x)() - ccall((:acb_rising_ui, libarb), Nothing, + ccall((:acb_rising_ui, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, UInt, Int), z, x, n, parent(x).prec) return z end @@ -1184,7 +1184,7 @@ end function rising_factorial2(x::AcbFieldElem, n::UInt) z = parent(x)() w = parent(x)() - ccall((:acb_rising2_ui, libarb), Nothing, + ccall((:acb_rising2_ui, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, UInt, Int), z, w, x, n, parent(x).prec) return (z, w) end @@ -1202,14 +1202,14 @@ end function polylog(s::AcbFieldElem, a::AcbFieldElem) z = parent(s)() - ccall((:acb_polylog, libarb), Nothing, + ccall((:acb_polylog, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, s, a, parent(s).prec) return z end function polylog(s::Int, a::AcbFieldElem) z = parent(a)() - ccall((:acb_polylog_si, libarb), Nothing, + ccall((:acb_polylog_si, libflint), Nothing, (Ref{AcbFieldElem}, Int, Ref{AcbFieldElem}, Int), z, s, a, parent(a).prec) return z end @@ -1227,7 +1227,7 @@ Return the logarithmic integral, evaluated at $x$. """ function log_integral(x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_li, libarb), Nothing, + ccall((:acb_hypgeom_li, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int, Int), z, x, 0, parent(x).prec) return z end @@ -1239,7 +1239,7 @@ Return the offset logarithmic integral, evaluated at $x$. """ function log_integral_offset(x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_li, libarb), Nothing, + ccall((:acb_hypgeom_li, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int, Int), z, x, 1, parent(x).prec) return z end @@ -1251,7 +1251,7 @@ Return the generalised exponential integral $E_s(x)$. """ function exp_integral_e(s::AcbFieldElem, x::AcbFieldElem) z = parent(s)() - ccall((:acb_hypgeom_expint, libarb), Nothing, + ccall((:acb_hypgeom_expint, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, s, x, parent(s).prec) return z end @@ -1263,7 +1263,7 @@ Return the upper incomplete gamma function $\Gamma(s,x)$. """ function gamma(s::AcbFieldElem, x::AcbFieldElem) z = parent(s)() - ccall((:acb_hypgeom_gamma_upper, libarb), Nothing, + ccall((:acb_hypgeom_gamma_upper, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int, Int), z, s, x, 0, parent(s).prec) return z end @@ -1276,7 +1276,7 @@ $\Gamma(s,x) / \Gamma(s)$. """ function gamma_regularized(s::AcbFieldElem, x::AcbFieldElem) z = parent(s)() - ccall((:acb_hypgeom_gamma_upper, libarb), Nothing, + ccall((:acb_hypgeom_gamma_upper, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int, Int), z, s, x, 1, parent(s).prec) return z end @@ -1288,7 +1288,7 @@ Return the lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$. """ function gamma_lower(s::AcbFieldElem, x::AcbFieldElem) z = parent(s)() - ccall((:acb_hypgeom_gamma_lower, libarb), Nothing, + ccall((:acb_hypgeom_gamma_lower, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int, Int), z, s, x, 0, parent(s).prec) return z end @@ -1301,7 +1301,7 @@ $\gamma(s,x) / \Gamma(s)$. """ function gamma_lower_regularized(s::AcbFieldElem, x::AcbFieldElem) z = parent(s)() - ccall((:acb_hypgeom_gamma_lower, libarb), Nothing, + ccall((:acb_hypgeom_gamma_lower, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int, Int), z, s, x, 1, parent(s).prec) return z end @@ -1313,7 +1313,7 @@ Return the Bessel function $J_{\nu}(x)$. """ function bessel_j(nu::AcbFieldElem, x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_bessel_j, libarb), Nothing, + ccall((:acb_hypgeom_bessel_j, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, nu, x, parent(x).prec) return z end @@ -1325,7 +1325,7 @@ Return the Bessel function $Y_{\nu}(x)$. """ function bessel_y(nu::AcbFieldElem, x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_bessel_y, libarb), Nothing, + ccall((:acb_hypgeom_bessel_y, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, nu, x, parent(x).prec) return z end @@ -1337,7 +1337,7 @@ Return the Bessel function $I_{\nu}(x)$. """ function bessel_i(nu::AcbFieldElem, x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_bessel_i, libarb), Nothing, + ccall((:acb_hypgeom_bessel_i, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, nu, x, parent(x).prec) return z end @@ -1349,7 +1349,7 @@ Return the Bessel function $K_{\nu}(x)$. """ function bessel_k(nu::AcbFieldElem, x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_bessel_k, libarb), Nothing, + ccall((:acb_hypgeom_bessel_k, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, nu, x, parent(x).prec) return z end @@ -1361,7 +1361,7 @@ Return the Airy function $\operatorname{Ai}(x)$. """ function airy_ai(x::AcbFieldElem) ai = parent(x)() - ccall((:acb_hypgeom_airy, libarb), Nothing, + ccall((:acb_hypgeom_airy, libflint), Nothing, (Ref{AcbFieldElem}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ref{AcbFieldElem}, Int), ai, C_NULL, C_NULL, C_NULL, x, parent(x).prec) return ai @@ -1374,7 +1374,7 @@ Return the Airy function $\operatorname{Bi}(x)$. """ function airy_bi(x::AcbFieldElem) bi = parent(x)() - ccall((:acb_hypgeom_airy, libarb), Nothing, + ccall((:acb_hypgeom_airy, libflint), Nothing, (Ptr{Cvoid}, Ptr{Cvoid}, Ref{AcbFieldElem}, Ptr{Cvoid}, Ref{AcbFieldElem}, Int), C_NULL, C_NULL, bi, C_NULL, x, parent(x).prec) return bi @@ -1387,7 +1387,7 @@ Return the derivative of the Airy function $\operatorname{Ai}^\prime(x)$. """ function airy_ai_prime(x::AcbFieldElem) ai_prime = parent(x)() - ccall((:acb_hypgeom_airy, libarb), Nothing, + ccall((:acb_hypgeom_airy, libflint), Nothing, (Ptr{Cvoid}, Ref{AcbFieldElem}, Ptr{Cvoid}, Ptr{Cvoid}, Ref{AcbFieldElem}, Int), C_NULL, ai_prime, C_NULL, C_NULL, x, parent(x).prec) return ai_prime @@ -1400,7 +1400,7 @@ Return the derivative of the Airy function $\operatorname{Bi}^\prime(x)$. """ function airy_bi_prime(x::AcbFieldElem) bi_prime = parent(x)() - ccall((:acb_hypgeom_airy, libarb), Nothing, + ccall((:acb_hypgeom_airy, libflint), Nothing, (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), C_NULL, C_NULL, C_NULL, bi_prime, x, parent(x).prec) return bi_prime @@ -1413,7 +1413,7 @@ Return the confluent hypergeometric function ${}_1F_1(a,b,x)$. """ function hypergeometric_1f1(a::AcbFieldElem, b::AcbFieldElem, x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_m, libarb), Nothing, + ccall((:acb_hypgeom_m, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int, Int), z, a, b, x, 0, parent(x).prec) return z end @@ -1426,7 +1426,7 @@ ${}_1F_1(a,b,x) / \Gamma(b)$. """ function hypergeometric_1f1_regularized(a::AcbFieldElem, b::AcbFieldElem, x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_m, libarb), Nothing, + ccall((:acb_hypgeom_m, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int, Int), z, a, b, x, 1, parent(x).prec) return z end @@ -1438,7 +1438,7 @@ Return the confluent hypergeometric function $U(a,b,x)$. """ function hypergeometric_u(a::AcbFieldElem, b::AcbFieldElem, x::AcbFieldElem) z = parent(x)() - ccall((:acb_hypgeom_u, libarb), Nothing, + ccall((:acb_hypgeom_u, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, a, b, x, parent(x).prec) return z end @@ -1450,7 +1450,7 @@ Return the Gauss hypergeometric function ${}_2F_1(a,b,c,x)$. """ function hypergeometric_2f1(a::AcbFieldElem, b::AcbFieldElem, c::AcbFieldElem, x::AcbFieldElem; flags=0) z = parent(x)() - ccall((:acb_hypgeom_2f1, libarb), Nothing, + ccall((:acb_hypgeom_2f1, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int, Int), z, a, b, c, x, flags, parent(x).prec) return z end @@ -1466,7 +1466,7 @@ function jacobi_theta(z::AcbFieldElem, tau::AcbFieldElem) t2 = parent(z)() t3 = parent(z)() t4 = parent(z)() - ccall((:acb_modular_theta, libarb), Nothing, + ccall((:acb_modular_theta, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), t1, t2, t3, t4, z, tau, parent(z).prec) return (t1, t2, t3, t4) @@ -1479,7 +1479,7 @@ Return the Weierstrass elliptic function $\wp(z,\tau)$. """ function weierstrass_p(z::AcbFieldElem, tau::AcbFieldElem) r = parent(z)() - ccall((:acb_elliptic_p, libarb), Nothing, + ccall((:acb_elliptic_p, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), r, z, tau, parent(z).prec) return r end @@ -1491,7 +1491,7 @@ Return the derivative of the Weierstrass elliptic function $\frac{\partial}{\par """ function weierstrass_p_prime(z::AcbFieldElem, tau::AcbFieldElem) r = parent(z)() - ccall((:acb_elliptic_p_prime, libarb), Nothing, + ccall((:acb_elliptic_p_prime, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), r, z, tau, parent(z).prec) return r end @@ -1575,36 +1575,36 @@ end ################################################################################ function zero!(z::AcbFieldElem) - ccall((:acb_zero, libarb), Nothing, (Ref{AcbFieldElem},), z) + ccall((:acb_zero, libflint), Nothing, (Ref{AcbFieldElem},), z) return z end function add!(z::AcbFieldElem, x::AcbFieldElem, y::AcbFieldElem) - ccall((:acb_add, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), + ccall((:acb_add, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, y, parent(z).prec) return z end function addeq!(z::AcbFieldElem, y::AcbFieldElem) - ccall((:acb_add, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), + ccall((:acb_add, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, z, y, parent(z).prec) return z end function sub!(z::AcbFieldElem, x::AcbFieldElem, y::AcbFieldElem) - ccall((:acb_sub, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), + ccall((:acb_sub, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, y, parent(z).prec) return z end function mul!(z::AcbFieldElem, x::AcbFieldElem, y::AcbFieldElem) - ccall((:acb_mul, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), + ccall((:acb_mul, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, y, parent(z).prec) return z end function div!(z::AcbFieldElem, x::AcbFieldElem, y::AcbFieldElem) - ccall((:acb_div, libarb), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), + ccall((:acb_div, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int), z, x, y, parent(z).prec) return z end @@ -1620,12 +1620,12 @@ for (typeofx, passtoc) in ((AcbFieldElem, Ref{AcbFieldElem}), (Ptr{AcbFieldElem} ("acb_set_d", Float64)) @eval begin function _acb_set(x::($typeofx), y::($t)) - ccall(($f, libarb), Nothing, (($passtoc), ($t)), x, y) + ccall(($f, libflint), Nothing, (($passtoc), ($t)), x, y) end function _acb_set(x::($typeofx), y::($t), p::Int) _acb_set(x, y) - ccall((:acb_set_round, libarb), Nothing, + ccall((:acb_set_round, libflint), Nothing, (($passtoc), ($passtoc), Int), x, x, p) end end @@ -1633,102 +1633,102 @@ for (typeofx, passtoc) in ((AcbFieldElem, Ref{AcbFieldElem}), (Ptr{AcbFieldElem} @eval begin function _acb_set(x::($typeofx), y::ZZRingElem) - ccall((:acb_set_fmpz, libarb), Nothing, (($passtoc), Ref{ZZRingElem}), x, y) + ccall((:acb_set_fmpz, libflint), Nothing, (($passtoc), Ref{ZZRingElem}), x, y) end function _acb_set(x::($typeofx), y::ZZRingElem, p::Int) - ccall((:acb_set_round_fmpz, libarb), Nothing, + ccall((:acb_set_round_fmpz, libflint), Nothing, (($passtoc), Ref{ZZRingElem}, Int), x, y, p) end function _acb_set(x::($typeofx), y::QQFieldElem, p::Int) - ccall((:acb_set_fmpq, libarb), Nothing, + ccall((:acb_set_fmpq, libflint), Nothing, (($passtoc), Ref{QQFieldElem}, Int), x, y, p) end function _acb_set(x::($typeofx), y::ArbFieldElem) - ccall((:acb_set_arb, libarb), Nothing, (($passtoc), Ref{ArbFieldElem}), x, y) + ccall((:acb_set_arb, libflint), Nothing, (($passtoc), Ref{ArbFieldElem}), x, y) end function _acb_set(x::($typeofx), y::ArbFieldElem, p::Int) _acb_set(x, y) - ccall((:acb_set_round, libarb), Nothing, + ccall((:acb_set_round, libflint), Nothing, (($passtoc), ($passtoc), Int), x, x, p) end function _acb_set(x::($typeofx), y::AcbFieldElem) - ccall((:acb_set, libarb), Nothing, (($passtoc), Ref{AcbFieldElem}), x, y) + ccall((:acb_set, libflint), Nothing, (($passtoc), Ref{AcbFieldElem}), x, y) end function _acb_set(x::($typeofx), y::AcbFieldElem, p::Int) - ccall((:acb_set_round, libarb), Nothing, + ccall((:acb_set_round, libflint), Nothing, (($passtoc), Ref{AcbFieldElem}, Int), x, y, p) end function _acb_set(x::($typeofx), y::AbstractString, p::Int) - r = ccall((:acb_real_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) _arb_set(r, y, p) - i = ccall((:acb_imag_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) - ccall((:arb_zero, libarb), Nothing, (Ptr{ArbFieldElem}, ), i) + i = ccall((:acb_imag_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) + ccall((:arb_zero, libflint), Nothing, (Ptr{ArbFieldElem}, ), i) end function _acb_set(x::($typeofx), y::BigFloat) - r = ccall((:acb_real_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) _arb_set(r, y) - i = ccall((:acb_imag_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) - ccall((:arb_zero, libarb), Nothing, (Ptr{ArbFieldElem}, ), i) + i = ccall((:acb_imag_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) + ccall((:arb_zero, libflint), Nothing, (Ptr{ArbFieldElem}, ), i) end function _acb_set(x::($typeofx), y::BigFloat, p::Int) - r = ccall((:acb_real_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) _arb_set(r, y, p) - i = ccall((:acb_imag_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) - ccall((:arb_zero, libarb), Nothing, (Ptr{ArbFieldElem}, ), i) + i = ccall((:acb_imag_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) + ccall((:arb_zero, libflint), Nothing, (Ptr{ArbFieldElem}, ), i) end function _acb_set(x::($typeofx), y::Int, z::Int, p::Int) - ccall((:acb_set_si_si, libarb), Nothing, + ccall((:acb_set_si_si, libflint), Nothing, (($passtoc), Int, Int), x, y, z) - ccall((:acb_set_round, libarb), Nothing, + ccall((:acb_set_round, libflint), Nothing, (($passtoc), ($passtoc), Int), x, x, p) end function _acb_set(x::($typeofx), y::ArbFieldElem, z::ArbFieldElem) - ccall((:acb_set_arb_arb, libarb), Nothing, + ccall((:acb_set_arb_arb, libflint), Nothing, (($passtoc), Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y, z) end function _acb_set(x::($typeofx), y::ArbFieldElem, z::ArbFieldElem, p::Int) _acb_set(x, y, z) - ccall((:acb_set_round, libarb), Nothing, + ccall((:acb_set_round, libflint), Nothing, (($passtoc), ($passtoc), Int), x, x, p) end function _acb_set(x::($typeofx), y::QQFieldElem, z::QQFieldElem, p::Int) - r = ccall((:acb_real_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) _arb_set(r, y, p) - i = ccall((:acb_imag_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) + i = ccall((:acb_imag_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) _arb_set(i, z, p) end function _acb_set(x::($typeofx), y::T, z::T, p::Int) where {T <: AbstractString} - r = ccall((:acb_real_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) _arb_set(r, y, p) - i = ccall((:acb_imag_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) + i = ccall((:acb_imag_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) _arb_set(i, z, p) end function _acb_set(x::($typeofx), y::Real, p::Int) - r = ccall((:acb_real_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) _arb_set(r, y, p) - i = ccall((:acb_imag_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) - ccall((:arb_zero, libarb), Nothing, (Ptr{ArbFieldElem}, ), i) + i = ccall((:acb_imag_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) + ccall((:arb_zero, libflint), Nothing, (Ptr{ArbFieldElem}, ), i) end function _acb_set(x::($typeofx), y::Complex, p::Int) - r = ccall((:acb_real_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) _arb_set(r, real(y), p) - i = ccall((:acb_imag_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) + i = ccall((:acb_imag_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) _arb_set(i, imag(y), p) end @@ -1737,9 +1737,9 @@ for (typeofx, passtoc) in ((AcbFieldElem, Ref{AcbFieldElem}), (Ptr{AcbFieldElem} for T in (Real, ZZRingElem) @eval begin function _acb_set(x::($typeofx), y::($T), z::($T), p::Int) - r = ccall((:acb_real_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) + r = ccall((:acb_real_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) _arb_set(r, y, p) - i = ccall((:acb_imag_ptr, libarb), Ptr{ArbFieldElem}, (($passtoc), ), x) + i = ccall((:acb_imag_ptr, libflint), Ptr{ArbFieldElem}, (($passtoc), ), x) _arb_set(i, z, p) end end diff --git a/src/arb/acb_calc.jl b/src/arb/acb_calc.jl index ccc538c9c..024186f4d 100644 --- a/src/arb/acb_calc.jl +++ b/src/arb/acb_calc.jl @@ -2,7 +2,7 @@ function acb_calc_func_wrap(res::Ptr{ComplexFieldElem}, x::Ptr{ComplexFieldElem} xx = unsafe_load(x) F = unsafe_pointer_to_objref(param) w = F(xx) - ccall((:acb_set, libarb), Ptr{Nothing}, (Ptr{ComplexFieldElem}, Ref{ComplexFieldElem}), res, w) + ccall((:acb_set, libflint), Ptr{Nothing}, (Ptr{ComplexFieldElem}, Ref{ComplexFieldElem}), res, w) return zero(Cint) end @@ -37,10 +37,10 @@ function integrate(C::ComplexField, F, a, b; end ctol = mag_struct(0, 0) - ccall((:mag_init, libarb), Nothing, (Ref{mag_struct},), ctol) + ccall((:mag_init, libflint), Nothing, (Ref{mag_struct},), ctol) if abs_tol === -1.0 - ccall((:mag_set_ui_2exp_si, libarb), Nothing, (Ref{mag_struct}, UInt, Int), ctol, 1, -precision(Balls)) + ccall((:mag_set_ui_2exp_si, libflint), Nothing, (Ref{mag_struct}, UInt, Int), ctol, 1, -precision(Balls)) else t = BigFloat(abs_tol, RoundDown) expo = Ref{Clong}() @@ -48,14 +48,14 @@ function integrate(C::ComplexField, F, a, b; (Ref{Clong}, Ref{BigFloat}, Cint), expo, t, Base.convert(Base.MPFR.MPFRRoundingMode, RoundDown)) - ccall((:mag_set_d, libarb), Nothing, (Ref{mag_struct}, Float64), ctol, d) - ccall((:mag_mul_2exp_si, libarb), Nothing, + ccall((:mag_set_d, libflint), Nothing, (Ref{mag_struct}, Float64), ctol, d) + ccall((:mag_mul_2exp_si, libflint), Nothing, (Ref{mag_struct}, Ref{mag_struct}, Int), ctol, ctol, Int(expo[])) end res = C() - status = ccall((:acb_calc_integrate, libarb), UInt, + status = ccall((:acb_calc_integrate, libflint), UInt, (Ref{ComplexFieldElem}, #res Ptr{Nothing}, #func Any, #params @@ -67,7 +67,7 @@ function integrate(C::ComplexField, F, a, b; Int), res, acb_calc_func_wrap_c(), F, lower, upper, cgoal, ctol, opts, precision(Balls)) - ccall((:mag_clear, libarb), Nothing, (Ref{mag_struct},), ctol) + ccall((:mag_clear, libflint), Nothing, (Ref{mag_struct},), ctol) if status == ARB_CALC_SUCCESS nothing diff --git a/src/arb/acb_mat.jl b/src/arb/acb_mat.jl index 5f343c5c9..0a04031a4 100644 --- a/src/arb/acb_mat.jl +++ b/src/arb/acb_mat.jl @@ -46,9 +46,9 @@ end function getindex!(z::AcbFieldElem, x::AcbMatrix, r::Int, c::Int) GC.@preserve x begin - v = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + v = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), x, r - 1, c - 1) - ccall((:acb_set, libarb), Nothing, (Ref{AcbFieldElem}, Ptr{AcbFieldElem}), z, v) + ccall((:acb_set, libflint), Nothing, (Ref{AcbFieldElem}, Ptr{AcbFieldElem}), z, v) end return z end @@ -58,9 +58,9 @@ end z = base_ring(x)() GC.@preserve x begin - v = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + v = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), x, r - 1, c - 1) - ccall((:acb_set, libarb), Nothing, (Ref{AcbFieldElem}, Ptr{AcbFieldElem}), z, v) + ccall((:acb_set, libflint), Nothing, (Ref{AcbFieldElem}, Ptr{AcbFieldElem}), z, v) end return z end @@ -71,7 +71,7 @@ for T in [Integer, Float64, ZZRingElem, QQFieldElem, ArbFieldElem, BigFloat, Acb @boundscheck Generic._checkbounds(x, r, c) GC.@preserve x begin - z = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + z = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), x, r - 1, c - 1) _acb_set(z, y, precision(base_ring(x))) end @@ -89,7 +89,7 @@ for T in [Integer, Float64, ZZRingElem, QQFieldElem, ArbFieldElem, BigFloat, Abs @boundscheck Generic._checkbounds(x, r, c) GC.@preserve x begin - z = ccall((:acb_mat_entry_ptr, libarb), Ptr{AcbFieldElem}, + z = ccall((:acb_mat_entry_ptr, libflint), Ptr{AcbFieldElem}, (Ref{AcbMatrix}, Int, Int), x, r - 1, c - 1) _acb_set(z, y[1], y[2], precision(base_ring(x))) end @@ -104,7 +104,7 @@ zero(x::AcbMatSpace) = x() function one(x::AcbMatSpace) z = x() - ccall((:acb_mat_one, libarb), Nothing, (Ref{AcbMatrix}, ), z) + ccall((:acb_mat_one, libflint), Nothing, (Ref{AcbMatrix}, ), z) return z end @@ -118,7 +118,7 @@ number_of_columns(a::AcbMatSpace) = a.ncols function deepcopy_internal(x::AcbMatrix, dict::IdDict) z = similar(x) - ccall((:acb_mat_set, libarb), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}), z, x) + ccall((:acb_mat_set, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}), z, x) return z end @@ -130,7 +130,7 @@ end function -(x::AcbMatrix) z = similar(x) - ccall((:acb_mat_neg, libarb), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}), z, x) + ccall((:acb_mat_neg, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}), z, x) return z end @@ -142,7 +142,7 @@ end function transpose(x::AcbMatrix) z = similar(x, ncols(x), nrows(x)) - ccall((:acb_mat_transpose, libarb), Nothing, + ccall((:acb_mat_transpose, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}), z, x) return z end @@ -156,7 +156,7 @@ end function +(x::AcbMatrix, y::AcbMatrix) check_parent(x, y) z = similar(x) - ccall((:acb_mat_add, libarb), Nothing, + ccall((:acb_mat_add, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{AcbMatrix}, Int), z, x, y, precision(base_ring(x))) return z @@ -165,7 +165,7 @@ end function -(x::AcbMatrix, y::AcbMatrix) check_parent(x, y) z = similar(x) - ccall((:acb_mat_sub, libarb), Nothing, + ccall((:acb_mat_sub, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{AcbMatrix}, Int), z, x, y, precision(base_ring(x))) return z @@ -174,7 +174,7 @@ end function *(x::AcbMatrix, y::AcbMatrix) ncols(x) != nrows(y) && error("Matrices have wrong dimensions") z = similar(x, nrows(x), ncols(y)) - ccall((:acb_mat_mul, libarb), Nothing, + ccall((:acb_mat_mul, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{AcbMatrix}, Int), z, x, y, precision(base_ring(x))) return z @@ -189,7 +189,7 @@ end function ^(x::AcbMatrix, y::UInt) nrows(x) != ncols(x) && error("Matrix must be square") z = similar(x) - ccall((:acb_mat_pow_ui, libarb), Nothing, + ccall((:acb_mat_pow_ui, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, UInt, Int), z, x, y, precision(base_ring(x))) return z @@ -197,7 +197,7 @@ end function *(x::AcbMatrix, y::Int) z = similar(x) - ccall((:acb_mat_scalar_mul_si, libarb), Nothing, + ccall((:acb_mat_scalar_mul_si, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Int, Int), z, x, y, precision(base_ring(x))) return z @@ -207,7 +207,7 @@ end function *(x::AcbMatrix, y::ZZRingElem) z = similar(x) - ccall((:acb_mat_scalar_mul_fmpz, libarb), Nothing, + ccall((:acb_mat_scalar_mul_fmpz, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{ZZRingElem}, Int), z, x, y, precision(base_ring(x))) return z @@ -217,7 +217,7 @@ end function *(x::AcbMatrix, y::ArbFieldElem) z = similar(x) - ccall((:acb_mat_scalar_mul_arb, libarb), Nothing, + ccall((:acb_mat_scalar_mul_arb, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{ArbFieldElem}, Int), z, x, y, precision(base_ring(x))) return z @@ -227,7 +227,7 @@ end function *(x::AcbMatrix, y::AcbFieldElem) z = similar(x) - ccall((:acb_mat_scalar_mul_acb, libarb), Nothing, + ccall((:acb_mat_scalar_mul_acb, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{AcbFieldElem}, Int), z, x, y, precision(base_ring(x))) return z @@ -319,7 +319,7 @@ end function ldexp(x::AcbMatrix, y::Int) z = similar(x) - ccall((:acb_mat_scalar_mul_2exp_si, libarb), Nothing, + ccall((:acb_mat_scalar_mul_2exp_si, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Int), z, x, y) return z end @@ -337,7 +337,7 @@ Return `true` if the matrices of balls $x$ and $y$ are precisely equal, i.e. if all matrix entries have the same midpoints and radii. """ function isequal(x::AcbMatrix, y::AcbMatrix) - r = ccall((:acb_mat_equal, libarb), Cint, + r = ccall((:acb_mat_equal, libflint), Cint, (Ref{AcbMatrix}, Ref{AcbMatrix}), x, y) return Bool(r) end @@ -345,12 +345,12 @@ end function ==(x::AcbMatrix, y::AcbMatrix) fl = check_parent(x, y, false) !fl && return false - r = ccall((:acb_mat_eq, libarb), Cint, (Ref{AcbMatrix}, Ref{AcbMatrix}), x, y) + r = ccall((:acb_mat_eq, libflint), Cint, (Ref{AcbMatrix}, Ref{AcbMatrix}), x, y) return Bool(r) end function !=(x::AcbMatrix, y::AcbMatrix) - r = ccall((:acb_mat_ne, libarb), Cint, (Ref{AcbMatrix}, Ref{AcbMatrix}), x, y) + r = ccall((:acb_mat_ne, libflint), Cint, (Ref{AcbMatrix}, Ref{AcbMatrix}), x, y) return Bool(r) end @@ -361,7 +361,7 @@ Returns `true` if all entries of $x$ overlap with the corresponding entry of $y$, otherwise return `false`. """ function overlaps(x::AcbMatrix, y::AcbMatrix) - r = ccall((:acb_mat_overlaps, libarb), Cint, + r = ccall((:acb_mat_overlaps, libflint), Cint, (Ref{AcbMatrix}, Ref{AcbMatrix}), x, y) return Bool(r) end @@ -373,7 +373,7 @@ Returns `true` if all entries of $x$ contain the corresponding entry of $y$, otherwise return `false`. """ function contains(x::AcbMatrix, y::AcbMatrix) - r = ccall((:acb_mat_contains, libarb), Cint, + r = ccall((:acb_mat_contains, libflint), Cint, (Ref{AcbMatrix}, Ref{AcbMatrix}), x, y) return Bool(r) end @@ -391,7 +391,7 @@ Returns `true` if all entries of $x$ contain the corresponding entry of $y$, otherwise return `false`. """ function contains(x::AcbMatrix, y::ZZMatrix) - r = ccall((:acb_mat_contains_fmpz_mat, libarb), Cint, + r = ccall((:acb_mat_contains_fmpz_mat, libflint), Cint, (Ref{AcbMatrix}, Ref{ZZMatrix}), x, y) return Bool(r) end @@ -403,7 +403,7 @@ Returns `true` if all entries of $x$ contain the corresponding entry of $y$, otherwise return `false`. """ function contains(x::AcbMatrix, y::QQMatrix) - r = ccall((:acb_mat_contains_fmpq_mat, libarb), Cint, + r = ccall((:acb_mat_contains_fmpq_mat, libflint), Cint, (Ref{AcbMatrix}, Ref{QQMatrix}), x, y) return Bool(r) end @@ -423,7 +423,7 @@ end ################################################################################ isreal(x::AcbMatrix) = - Bool(ccall((:acb_mat_is_real, libarb), Cint, (Ref{AcbMatrix}, ), x)) + Bool(ccall((:acb_mat_is_real, libflint), Cint, (Ref{AcbMatrix}, ), x)) ############################################################################### # @@ -447,7 +447,7 @@ end function is_invertible_with_inverse(x::AcbMatrix) ncols(x) != nrows(x) && return false, x z = similar(x) - r = ccall((:acb_mat_inv, libarb), Cint, + r = ccall((:acb_mat_inv, libflint), Cint, (Ref{AcbMatrix}, Ref{AcbMatrix}, Int), z, x, precision(base_ring(x))) return Bool(r), z end @@ -472,7 +472,7 @@ end function divexact(x::AcbMatrix, y::Int; check::Bool=true) y == 0 && throw(DivideError()) z = similar(x) - ccall((:acb_mat_scalar_div_si, libarb), Nothing, + ccall((:acb_mat_scalar_div_si, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Int, Int), z, x, y, precision(base_ring(x))) return z @@ -480,7 +480,7 @@ end function divexact(x::AcbMatrix, y::ZZRingElem; check::Bool=true) z = similar(x) - ccall((:acb_mat_scalar_div_fmpz, libarb), Nothing, + ccall((:acb_mat_scalar_div_fmpz, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{ZZRingElem}, Int), z, x, y, precision(base_ring(x))) return z @@ -488,7 +488,7 @@ end function divexact(x::AcbMatrix, y::ArbFieldElem; check::Bool=true) z = similar(x) - ccall((:acb_mat_scalar_div_arb, libarb), Nothing, + ccall((:acb_mat_scalar_div_arb, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{ArbFieldElem}, Int), z, x, y, precision(base_ring(x))) return z @@ -496,7 +496,7 @@ end function divexact(x::AcbMatrix, y::AcbFieldElem; check::Bool=true) z = similar(x) - ccall((:acb_mat_scalar_div_acb, libarb), Nothing, + ccall((:acb_mat_scalar_div_acb, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{AcbFieldElem}, Int), z, x, y, precision(base_ring(x))) return z @@ -519,7 +519,7 @@ divexact(x::AcbMatrix, y::Rational{T}; check::Bool=true) where T <: Union{Int, B function charpoly(x::AcbPolyRing, y::AcbMatrix) base_ring(x) != base_ring(y) && error("Base rings must coincide") z = x() - ccall((:acb_mat_charpoly, libarb), Nothing, + ccall((:acb_mat_charpoly, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbMatrix}, Int), z, y, precision(base_ring(y))) return z end @@ -533,7 +533,7 @@ end function det(x::AcbMatrix) ncols(x) != nrows(x) && error("Matrix must be square") z = base_ring(x)() - ccall((:acb_mat_det, libarb), Nothing, + ccall((:acb_mat_det, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbMatrix}, Int), z, x, precision(base_ring(x))) return z end @@ -547,7 +547,7 @@ end function Base.exp(x::AcbMatrix) ncols(x) != nrows(x) && error("Matrix must be square") z = similar(x) - ccall((:acb_mat_exp, libarb), Nothing, + ccall((:acb_mat_exp, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Int), z, x, precision(base_ring(x))) return z end @@ -560,7 +560,7 @@ end function lu!(P::Generic.Perm, x::AcbMatrix) P.d .-= 1 - r = ccall((:acb_mat_lu, libarb), Cint, + r = ccall((:acb_mat_lu, libflint), Cint, (Ptr{Int}, Ref{AcbMatrix}, Ref{AcbMatrix}, Int), P.d, x, x, precision(base_ring(x))) r == 0 && error("Could not find $(nrows(x)) invertible pivot elements") @@ -570,7 +570,7 @@ function lu!(P::Generic.Perm, x::AcbMatrix) end function _solve!(z::AcbMatrix, x::AcbMatrix, y::AcbMatrix) - r = ccall((:acb_mat_solve, libarb), Cint, + r = ccall((:acb_mat_solve, libflint), Cint, (Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{AcbMatrix}, Int), z, x, y, precision(base_ring(x))) r == 0 && error("Matrix cannot be inverted numerically") @@ -579,7 +579,7 @@ end function _solve_lu_precomp!(z::AcbMatrix, P::Generic.Perm, LU::AcbMatrix, y::AcbMatrix) Q = inv(P) - ccall((:acb_mat_solve_lu_precomp, libarb), Nothing, + ccall((:acb_mat_solve_lu_precomp, libflint), Nothing, (Ref{AcbMatrix}, Ptr{Int}, Ref{AcbMatrix}, Ref{AcbMatrix}, Int), z, Q.d .- 1, LU, y, precision(base_ring(LU))) nothing @@ -600,7 +600,7 @@ function Solve._can_solve_internal_no_check(A::AcbMatrix, b::AcbMatrix, task::Sy end x = similar(A, ncols(A), ncols(b)) - fl = ccall((:acb_mat_solve, libarb), Cint, + fl = ccall((:acb_mat_solve, libflint), Cint, (Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{AcbMatrix}, Int), x, A, b, precision(base_ring(A))) fl == 0 && error("Matrix cannot be inverted numerically") @@ -632,7 +632,7 @@ function Solve._init_reduce(C::Solve.SolveCtx{AcbFieldElem}) P = Generic.Perm(nrows(C)) x = similar(A, nrows(A), ncols(A)) P.d .-= 1 - fl = ccall((:acb_mat_lu, libarb), Cint, + fl = ccall((:acb_mat_lu, libflint), Cint, (Ptr{Int}, Ref{AcbMatrix}, Ref{AcbMatrix}, Int), P.d, x, A, precision(base_ring(A))) fl == 0 && error("Could not find $(nrows(x)) invertible pivot elements") @@ -655,7 +655,7 @@ function Solve._init_reduce_transpose(C::Solve.SolveCtx{AcbFieldElem}) P = Generic.Perm(nrows(C)) x = similar(A, nrows(A), ncols(A)) P.d .-= 1 - fl = ccall((:acb_mat_lu, libarb), Cint, + fl = ccall((:acb_mat_lu, libflint), Cint, (Ptr{Int}, Ref{AcbMatrix}, Ref{AcbMatrix}, Int), P.d, x, A, precision(base_ring(A))) fl == 0 && error("Could not find $(nrows(x)) invertible pivot elements") @@ -678,7 +678,7 @@ function Solve._can_solve_internal_no_check(C::Solve.SolveCtx{AcbFieldElem}, b:: end x = similar(b, ncols(C), ncols(b)) - ccall((:acb_mat_solve_lu_precomp, libarb), Nothing, + ccall((:acb_mat_solve_lu_precomp, libflint), Nothing, (Ref{AcbMatrix}, Ptr{Int}, Ref{AcbMatrix}, Ref{AcbMatrix}, Int), x, inv(p).d .- 1, LU, b, precision(base_ring(LU))) @@ -712,7 +712,7 @@ function swap_rows(x::AcbMatrix, i::Int, j::Int) end function swap_rows!(x::AcbMatrix, i::Int, j::Int) - ccall((:acb_mat_swap_rows, libarb), Nothing, + ccall((:acb_mat_swap_rows, libflint), Nothing, (Ref{AcbMatrix}, Ptr{Nothing}, Int, Int), x, C_NULL, i - 1, j - 1) end @@ -732,13 +732,13 @@ bound for the infinity norm for every matrix in $x$ function bound_inf_norm(x::AcbMatrix) z = ArbFieldElem() GC.@preserve x z begin - t = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (Ref{ArbFieldElem}, ), z) - ccall((:acb_mat_bound_inf_norm, libarb), Nothing, + t = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (Ref{ArbFieldElem}, ), z) + ccall((:acb_mat_bound_inf_norm, libflint), Nothing, (Ptr{mag_struct}, Ref{AcbMatrix}), t, x) - s = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (Ref{ArbFieldElem}, ), z) - ccall((:arf_set_mag, libarb), Nothing, + s = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ref{ArbFieldElem}, ), z) + ccall((:arf_set_mag, libflint), Nothing, (Ptr{arf_struct}, Ptr{mag_struct}), s, t) - ccall((:mag_zero, libarb), Nothing, + ccall((:mag_zero, libflint), Nothing, (Ptr{mag_struct},), t) end return ArbField(precision(base_ring(x)))(z) @@ -754,7 +754,7 @@ for (s,f) in (("add!","acb_mat_add"), ("mul!","acb_mat_mul"), ("sub!","acb_mat_sub")) @eval begin function ($(Symbol(s)))(z::AcbMatrix, x::AcbMatrix, y::AcbMatrix) - ccall(($f, libarb), Nothing, + ccall(($f, libflint), Nothing, (Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{AcbMatrix}, Int), z, x, y, precision(base_ring(x))) return z @@ -931,7 +931,7 @@ function identity_matrix(R::AcbField, n::Int) error("dimension must not be negative") end z = AcbMatrix(n, n) - ccall((:acb_mat_one, libarb), Nothing, (Ref{AcbMatrix}, ), z) + ccall((:acb_mat_one, libflint), Nothing, (Ref{AcbMatrix}, ), z) z.base_ring = R return z end @@ -968,7 +968,7 @@ promote_rule(::Type{AcbMatrix}, ::Type{ArbMatrix}) = AcbMatrix function __approx_eig_qr!(v::Ptr{acb_struct}, R::AcbMatrix, A::AcbMatrix) n = nrows(A) - ccall((:acb_mat_approx_eig_qr, libarb), Cint, + ccall((:acb_mat_approx_eig_qr, libflint), Cint, (Ptr{acb_struct}, Ptr{Nothing}, Ref{AcbMatrix}, Ref{AcbMatrix}, Ptr{Nothing}, Int, Int), v, C_NULL, R, A, C_NULL, 0, precision(parent(A))) @@ -991,7 +991,7 @@ function _eig_multiple(A::AcbMatrix, check::Bool = true) v_approx = acb_vec(n) R = zero_matrix(base_ring(A), n, n) __approx_eig_qr!(v, R, A) - b = ccall((:acb_mat_eig_multiple, libarb), Cint, + b = ccall((:acb_mat_eig_multiple, libflint), Cint, (Ptr{acb_struct}, Ref{AcbMatrix}, Ptr{acb_struct}, Ref{AcbMatrix}, Int), v_approx, A, v, R, precision(base_ring(A))) check && b == 0 && error("Could not isolate eigenvalues of matrix $A") @@ -1025,17 +1025,17 @@ function _eig_simple(A::AcbMatrix; check::Bool = true, algorithm::Symbol = :defa R = zero_matrix(base_ring(A), n, n) __approx_eig_qr!(v, Rapprox, A) if algorithm == :vdhoeven_mourrain - b = ccall((:acb_mat_eig_simple_vdhoeven_mourrain, libarb), Cint, + b = ccall((:acb_mat_eig_simple_vdhoeven_mourrain, libflint), Cint, (Ptr{acb_struct}, Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{AcbMatrix}, Ptr{acb_struct}, Ref{AcbMatrix}, Int), v_approx, L, R, A, v, Rapprox, precision(base_ring(A))) elseif algorithm == :rump - b = ccall((:acb_mat_eig_simple_rump, libarb), Cint, + b = ccall((:acb_mat_eig_simple_rump, libflint), Cint, (Ptr{acb_struct}, Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{AcbMatrix}, Ptr{acb_struct}, Ref{AcbMatrix}, Int), v_approx, L, R, A, v, Rapprox, precision(base_ring(A))) elseif algorithm == :default - b = ccall((:acb_mat_eig_simple, libarb), Cint, + b = ccall((:acb_mat_eig_simple, libflint), Cint, (Ptr{acb_struct}, Ref{AcbMatrix}, Ref{AcbMatrix}, Ref{AcbMatrix}, Ptr{acb_struct}, Ref{AcbMatrix}, Int), v_approx, L, R, A, v, Rapprox, precision(base_ring(A))) diff --git a/src/arb/acb_poly.jl b/src/arb/acb_poly.jl index f9384a3e2..68f298feb 100644 --- a/src/arb/acb_poly.jl +++ b/src/arb/acb_poly.jl @@ -16,11 +16,11 @@ elem_type(::Type{AcbPolyRing}) = AcbPolyRingElem dense_poly_type(::Type{AcbFieldElem}) = AcbPolyRingElem -length(x::AcbPolyRingElem) = ccall((:acb_poly_length, libarb), Int, +length(x::AcbPolyRingElem) = ccall((:acb_poly_length, libflint), Int, (Ref{AcbPolyRingElem},), x) function set_length!(x::AcbPolyRingElem, n::Int) - ccall((:_acb_poly_set_length, libarb), Nothing, + ccall((:_acb_poly_set_length, libflint), Nothing, (Ref{AcbPolyRingElem}, Int), x, n) return x end @@ -30,7 +30,7 @@ degree(x::AcbPolyRingElem) = length(x) - 1 function coeff(a::AcbPolyRingElem, n::Int) n < 0 && throw(DomainError(n, "Index must be non-negative")) t = parent(a).base_ring() - ccall((:acb_poly_get_coeff_acb, libarb), Nothing, + ccall((:acb_poly_get_coeff_acb, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbPolyRingElem}, Int), t, a, n) return t end @@ -41,7 +41,7 @@ one(a::AcbPolyRing) = a(1) function gen(a::AcbPolyRing) z = AcbPolyRingElem() - ccall((:acb_poly_set_coeff_si, libarb), Nothing, + ccall((:acb_poly_set_coeff_si, libflint), Nothing, (Ref{AcbPolyRingElem}, Int, Int), z, 1, 1) z.parent = a return z @@ -118,7 +118,7 @@ end ############################################################################### function isequal(x::AcbPolyRingElem, y::AcbPolyRingElem) - return ccall((:acb_poly_equal, libarb), Bool, + return ccall((:acb_poly_equal, libflint), Bool, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}), x, y) end @@ -129,7 +129,7 @@ Return `true` if the coefficient boxes of $x$ overlap the coefficient boxes of $y$, otherwise return `false`. """ function overlaps(x::AcbPolyRingElem, y::AcbPolyRingElem) - return ccall((:acb_poly_overlaps, libarb), Bool, + return ccall((:acb_poly_overlaps, libflint), Bool, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}), x, y) end @@ -140,7 +140,7 @@ Return `true` if the coefficient boxes of $x$ contain the corresponding coefficient boxes of $y$, otherwise return `false`. """ function contains(x::AcbPolyRingElem, y::AcbPolyRingElem) - return ccall((:acb_poly_contains, libarb), Bool, + return ccall((:acb_poly_contains, libflint), Bool, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}), x, y) end @@ -151,7 +151,7 @@ Return `true` if the coefficient boxes of $x$ contain the corresponding exact coefficients of $y$, otherwise return `false`. """ function contains(x::AcbPolyRingElem, y::ZZPolyRingElem) - return ccall((:acb_poly_contains_fmpz_poly, libarb), Bool, + return ccall((:acb_poly_contains_fmpz_poly, libflint), Bool, (Ref{AcbPolyRingElem}, Ref{ZZPolyRingElem}), x, y) end @@ -162,7 +162,7 @@ Return `true` if the coefficient boxes of $x$ contain the corresponding exact coefficients of $y$, otherwise return `false`. """ function contains(x::AcbPolyRingElem, y::QQPolyRingElem) - return ccall((:acb_poly_contains_fmpq_poly, libarb), Bool, + return ccall((:acb_poly_contains_fmpq_poly, libflint), Bool, (Ref{AcbPolyRingElem}, Ref{QQPolyRingElem}), x, y) end @@ -196,13 +196,13 @@ in case it is, otherwise sets $t$ to `false`. """ function unique_integer(x::AcbPolyRingElem) z = ZZPolyRing(ZZ, var(parent(x)))() - unique = ccall((:acb_poly_get_unique_fmpz_poly, libarb), Int, + unique = ccall((:acb_poly_get_unique_fmpz_poly, libflint), Int, (Ref{ZZPolyRingElem}, Ref{AcbPolyRingElem}), z, x) return (unique != 0, z) end function isreal(x::AcbPolyRingElem) - return ccall((:acb_poly_is_real, libarb), Cint, (Ref{AcbPolyRingElem}, ), x) != 0 + return ccall((:acb_poly_is_real, libflint), Cint, (Ref{AcbPolyRingElem}, ), x) != 0 end ############################################################################### @@ -214,7 +214,7 @@ end function shift_left(x::AcbPolyRingElem, len::Int) len < 0 && throw(DomainError(len, "Shift must be non-negative")) z = parent(x)() - ccall((:acb_poly_shift_left, libarb), Nothing, + ccall((:acb_poly_shift_left, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, x, len) return z end @@ -222,7 +222,7 @@ end function shift_right(x::AcbPolyRingElem, len::Int) len < 0 && throw(DomainError(len, "Shift must be non-negative")) z = parent(x)() - ccall((:acb_poly_shift_right, libarb), Nothing, + ccall((:acb_poly_shift_right, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, x, len) return z end @@ -235,7 +235,7 @@ end function -(x::AcbPolyRingElem) z = parent(x)() - ccall((:acb_poly_neg, libarb), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}), z, x) + ccall((:acb_poly_neg, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}), z, x) return z end @@ -247,7 +247,7 @@ end function +(x::AcbPolyRingElem, y::AcbPolyRingElem) z = parent(x)() - ccall((:acb_poly_add, libarb), Nothing, + ccall((:acb_poly_add, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, x, y, precision(parent(x))) return z @@ -255,7 +255,7 @@ end function *(x::AcbPolyRingElem, y::AcbPolyRingElem) z = parent(x)() - ccall((:acb_poly_mul, libarb), Nothing, + ccall((:acb_poly_mul, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, x, y, precision(parent(x))) return z @@ -263,7 +263,7 @@ end function -(x::AcbPolyRingElem, y::AcbPolyRingElem) z = parent(x)() - ccall((:acb_poly_sub, libarb), Nothing, + ccall((:acb_poly_sub, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, x, y, precision(parent(x))) return z @@ -272,7 +272,7 @@ end function ^(x::AcbPolyRingElem, y::Int) y < 0 && throw(DomainError(y, "Exponent must be non-negative")) z = parent(x)() - ccall((:acb_poly_pow_ui, libarb), Nothing, + ccall((:acb_poly_pow_ui, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, UInt, Int), z, x, y, precision(parent(x))) return z @@ -328,7 +328,7 @@ function Base.divrem(x::AcbPolyRingElem, y::AcbPolyRingElem) iszero(y) && throw(DivideError()) q = parent(x)() r = parent(x)() - if (ccall((:acb_poly_divrem, libarb), Int, + if (ccall((:acb_poly_divrem, libflint), Int, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), q, r, x, y, precision(parent(x))) == 1) return (q, r) @@ -358,7 +358,7 @@ function truncate(a::AcbPolyRingElem, n::Int) end # todo: implement set_trunc in ArbFieldElem z = deepcopy(a) - ccall((:acb_poly_truncate, libarb), Nothing, + ccall((:acb_poly_truncate, libflint), Nothing, (Ref{AcbPolyRingElem}, Int), z, n) return z end @@ -366,7 +366,7 @@ end function mullow(x::AcbPolyRingElem, y::AcbPolyRingElem, n::Int) n < 0 && throw(DomainError(n, "Index must be non-negative")) z = parent(x)() - ccall((:acb_poly_mullow, libarb), Nothing, + ccall((:acb_poly_mullow, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int, Int), z, x, y, n, precision(parent(x))) return z @@ -381,7 +381,7 @@ end #function reverse(x::AcbPolyRingElem, len::Int) # len < 0 && throw(DomainError()) # z = parent(x)() -# ccall((:acb_poly_reverse, libarb), Nothing, +# ccall((:acb_poly_reverse, libflint), Nothing, # (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, x, len) # return z #end @@ -394,7 +394,7 @@ end function evaluate(x::AcbPolyRingElem, y::AcbFieldElem) z = parent(y)() - ccall((:acb_poly_evaluate, libarb), Nothing, + ccall((:acb_poly_evaluate, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbPolyRingElem}, Ref{AcbFieldElem}, Int), z, x, y, precision(parent(y))) return z @@ -415,7 +415,7 @@ its derivative evaluated at $y$. function evaluate2(x::AcbPolyRingElem, y::AcbFieldElem) z = parent(y)() w = parent(y)() - ccall((:acb_poly_evaluate2, libarb), Nothing, + ccall((:acb_poly_evaluate2, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbPolyRingElem}, Ref{AcbFieldElem}, Int), z, w, x, y, precision(parent(y))) return z, w @@ -431,7 +431,7 @@ evaluate2(x::AcbPolyRingElem, y::RingElement) = evaluate2(x, base_ring(parent(x) function AbstractAlgebra._compose_right(x::AcbPolyRingElem, y::AcbPolyRingElem) z = parent(x)() - ccall((:acb_poly_compose, libarb), Nothing, + ccall((:acb_poly_compose, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, x, y, precision(parent(x))) return z @@ -445,14 +445,14 @@ end function derivative(x::AcbPolyRingElem) z = parent(x)() - ccall((:acb_poly_derivative, libarb), Nothing, + ccall((:acb_poly_derivative, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, x, precision(parent(x))) return z end function integral(x::AcbPolyRingElem) z = parent(x)() - ccall((:acb_poly_integral, libarb), Nothing, + ccall((:acb_poly_integral, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, x, precision(parent(x))) return z end @@ -464,9 +464,9 @@ end ############################################################################### function acb_vec(b::Vector{AcbFieldElem}) - v = ccall((:_acb_vec_init, libarb), Ptr{acb_struct}, (Int,), length(b)) + v = ccall((:_acb_vec_init, libflint), Ptr{acb_struct}, (Int,), length(b)) for i=1:length(b) - ccall((:acb_set, libarb), Nothing, (Ptr{acb_struct}, Ref{AcbFieldElem}), + ccall((:acb_set, libflint), Nothing, (Ptr{acb_struct}, Ref{AcbFieldElem}), v + (i-1)*sizeof(acb_struct), b[i]) end return v @@ -476,7 +476,7 @@ function array(R::AcbField, v::Ptr{acb_struct}, n::Int) r = Vector{AcbFieldElem}(undef, n) for i=1:n r[i] = R() - ccall((:acb_set, libarb), Nothing, (Ref{AcbFieldElem}, Ptr{acb_struct}), + ccall((:acb_set, libflint), Nothing, (Ref{AcbFieldElem}, Ptr{acb_struct}), r[i], v + (i-1)*sizeof(acb_struct)) end return r @@ -490,7 +490,7 @@ Construct a polynomial in the given polynomial ring from a list of its roots. function from_roots(R::AcbPolyRing, b::Vector{AcbFieldElem}) z = R() tmp = acb_vec(b) - ccall((:acb_poly_product_roots, libarb), Nothing, + ccall((:acb_poly_product_roots, libflint), Nothing, (Ref{AcbPolyRingElem}, Ptr{acb_struct}, Int, Int), z, tmp, length(b), precision(R)) acb_vec_clear(tmp, length(b)) return z @@ -502,7 +502,7 @@ end function evaluate_fast(x::AcbPolyRingElem, b::Vector{AcbFieldElem}) tmp = acb_vec(b) - ccall((:acb_poly_evaluate_vec_fast, libarb), Nothing, + ccall((:acb_poly_evaluate_vec_fast, libflint), Nothing, (Ptr{acb_struct}, Ref{AcbPolyRingElem}, Ptr{acb_struct}, Int, Int), tmp, x, tmp, length(b), precision(parent(x))) res = array(base_ring(parent(x)), tmp, length(b)) @@ -515,7 +515,7 @@ function interpolate_newton(R::AcbPolyRing, xs::Vector{AcbFieldElem}, ys::Vector z = R() xsv = acb_vec(xs) ysv = acb_vec(ys) - ccall((:acb_poly_interpolate_newton, libarb), Nothing, + ccall((:acb_poly_interpolate_newton, libflint), Nothing, (Ref{AcbPolyRingElem}, Ptr{acb_struct}, Ptr{acb_struct}, Int, Int), z, xsv, ysv, length(xs), precision(R)) acb_vec_clear(xsv, length(xs)) @@ -528,7 +528,7 @@ function interpolate_barycentric(R::AcbPolyRing, xs::Vector{AcbFieldElem}, ys::V z = R() xsv = acb_vec(xs) ysv = acb_vec(ys) - ccall((:acb_poly_interpolate_barycentric, libarb), Nothing, + ccall((:acb_poly_interpolate_barycentric, libflint), Nothing, (Ref{AcbPolyRingElem}, Ptr{acb_struct}, Ptr{acb_struct}, Int, Int), z, xsv, ysv, length(xs), precision(R)) acb_vec_clear(xsv, length(xs)) @@ -541,7 +541,7 @@ function interpolate_fast(R::AcbPolyRing, xs::Vector{AcbFieldElem}, ys::Vector{A z = R() xsv = acb_vec(xs) ysv = acb_vec(ys) - ccall((:acb_poly_interpolate_fast, libarb), Nothing, + ccall((:acb_poly_interpolate_fast, libflint), Nothing, (Ref{AcbPolyRingElem}, Ptr{acb_struct}, Ptr{acb_struct}, Int, Int), z, xsv, ysv, length(xs), precision(R)) acb_vec_clear(xsv, length(xs)) @@ -597,7 +597,7 @@ function roots(x::AcbPolyRingElem; target=0, isolate_real=false, initial_prec=0, while true in_roots = (wp == initial_prec) ? C_NULL : roots step_max_iter = (max_iter >= 1) ? max_iter : min(max(deg, 32), wp) - isolated = ccall((:acb_poly_find_roots, libarb), Int, + isolated = ccall((:acb_poly_find_roots, libflint), Int, (Ptr{acb_struct}, Ref{AcbPolyRingElem}, Ptr{acb_struct}, Int, Int), roots, x, in_roots, step_max_iter, wp) @@ -607,21 +607,21 @@ function roots(x::AcbPolyRingElem; target=0, isolate_real=false, initial_prec=0, ok = true if target > 0 for i = 0 : deg-1 - re = ccall((:acb_real_ptr, libarb), Ptr{arb_struct}, + re = ccall((:acb_real_ptr, libflint), Ptr{arb_struct}, (Ptr{AcbFieldElem}, ), roots + i * sizeof(acb_struct)) - im = ccall((:acb_imag_ptr, libarb), Ptr{arb_struct}, + im = ccall((:acb_imag_ptr, libflint), Ptr{arb_struct}, (Ptr{AcbFieldElem}, ), roots + i * sizeof(acb_struct)) - t = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (Ptr{ArbFieldElem}, ), re) - u = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (Ptr{ArbFieldElem}, ), im) - ok = ok && (ccall((:mag_cmp_2exp_si, libarb), Cint, + t = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (Ptr{ArbFieldElem}, ), re) + u = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (Ptr{ArbFieldElem}, ), im) + ok = ok && (ccall((:mag_cmp_2exp_si, libflint), Cint, (Ptr{mag_struct}, Int), t, -target) <= 0) - ok = ok && (ccall((:mag_cmp_2exp_si, libarb), Cint, + ok = ok && (ccall((:mag_cmp_2exp_si, libflint), Cint, (Ptr{mag_struct}, Int), u, -target) <= 0) end end if isreal(x) - real_ok = ccall((:acb_poly_validate_real_roots, libarb), + real_ok = ccall((:acb_poly_validate_real_roots, libflint), Bool, (Ptr{acb_struct}, Ref{AcbPolyRingElem}, Int), roots, x, wp) if isolate_real && !real_ok @@ -630,10 +630,10 @@ function roots(x::AcbPolyRingElem; target=0, isolate_real=false, initial_prec=0, if real_ok for i = 0 : deg - 1 - im = ccall((:acb_imag_ptr, libarb), Ptr{arb_struct}, + im = ccall((:acb_imag_ptr, libflint), Ptr{arb_struct}, (Ptr{AcbFieldElem}, ), roots + i * sizeof(acb_struct)) - if ccall((:arb_contains_zero, libarb), Bool, (Ptr{arb_struct}, ), im) - ccall((:arb_zero, libarb), Nothing, (Ptr{arb_struct}, ), im) + if ccall((:arb_contains_zero, libflint), Bool, (Ptr{arb_struct}, ), im) + ccall((:arb_zero, libflint), Nothing, (Ptr{arb_struct}, ), im) end end end @@ -650,7 +650,7 @@ function roots(x::AcbPolyRingElem; target=0, isolate_real=false, initial_prec=0, end if isolated == deg - ccall((:_acb_vec_sort_pretty, libarb), Nothing, + ccall((:_acb_vec_sort_pretty, libflint), Nothing, (Ptr{acb_struct}, Int), roots, deg) res = array(base_ring(parent(x)), roots, deg) end @@ -679,14 +679,14 @@ function roots_upper_bound(x::AcbPolyRingElem) z = ArbField(precision(base_ring(x)))() p = precision(base_ring(x)) GC.@preserve x z begin - t = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (Ref{ArbFieldElem}, ), z) - ccall((:acb_poly_root_bound_fujiwara, libarb), Nothing, + t = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (Ref{ArbFieldElem}, ), z) + ccall((:acb_poly_root_bound_fujiwara, libflint), Nothing, (Ptr{mag_struct}, Ref{AcbPolyRingElem}), t, x) - s = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (Ref{ArbFieldElem}, ), z) - ccall((:arf_set_mag, libarb), Nothing, (Ptr{arf_struct}, Ptr{mag_struct}), s, t) - ccall((:arf_set_round, libarb), Nothing, + s = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ref{ArbFieldElem}, ), z) + ccall((:arf_set_mag, libflint), Nothing, (Ptr{arf_struct}, Ptr{mag_struct}), s, t) + ccall((:arf_set_round, libflint), Nothing, (Ptr{arf_struct}, Ptr{arf_struct}, Int, Cint), s, s, p, ARB_RND_CEIL) - ccall((:mag_zero, libarb), Nothing, (Ptr{mag_struct},), t) + ccall((:mag_zero, libflint), Nothing, (Ptr{mag_struct},), t) end return z end @@ -698,44 +698,44 @@ end ############################################################################### function zero!(z::AcbPolyRingElem) - ccall((:acb_poly_zero, libarb), Nothing, (Ref{AcbPolyRingElem},), z) + ccall((:acb_poly_zero, libflint), Nothing, (Ref{AcbPolyRingElem},), z) return z end function fit!(z::AcbPolyRingElem, n::Int) - ccall((:acb_poly_fit_length, libarb), Nothing, + ccall((:acb_poly_fit_length, libflint), Nothing, (Ref{AcbPolyRingElem}, Int), z, n) return nothing end function setcoeff!(z::AcbPolyRingElem, n::Int, x::ZZRingElem) - ccall((:acb_poly_set_coeff_fmpz, libarb), Nothing, + ccall((:acb_poly_set_coeff_fmpz, libflint), Nothing, (Ref{AcbPolyRingElem}, Int, Ref{ZZRingElem}), z, n, x) return z end function setcoeff!(z::AcbPolyRingElem, n::Int, x::AcbFieldElem) - ccall((:acb_poly_set_coeff_acb, libarb), Nothing, + ccall((:acb_poly_set_coeff_acb, libflint), Nothing, (Ref{AcbPolyRingElem}, Int, Ref{AcbFieldElem}), z, n, x) return z end function mul!(z::AcbPolyRingElem, x::AcbPolyRingElem, y::AcbPolyRingElem) - ccall((:acb_poly_mul, libarb), Nothing, + ccall((:acb_poly_mul, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, x, y, precision(parent(z))) return z end function addeq!(z::AcbPolyRingElem, x::AcbPolyRingElem) - ccall((:acb_poly_add, libarb), Nothing, + ccall((:acb_poly_add, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, z, x, precision(parent(z))) return z end function add!(z::AcbPolyRingElem, x::AcbPolyRingElem, y::AcbPolyRingElem) - ccall((:acb_poly_add, libarb), Nothing, + ccall((:acb_poly_add, libflint), Nothing, (Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int), z, x, y, precision(parent(z))) return z diff --git a/src/arb/arb.jl b/src/arb/arb.jl index 9a2962113..3b49bc060 100644 --- a/src/arb/arb.jl +++ b/src/arb/arb.jl @@ -40,12 +40,12 @@ Return the relative accuracy of $x$ measured in bits, capped between `typemax(Int)` and `-typemax(Int)`. """ function accuracy_bits(x::ArbFieldElem) - return ccall((:arb_rel_accuracy_bits, libarb), Int, (Ref{ArbFieldElem},), x) + return ccall((:arb_rel_accuracy_bits, libflint), Int, (Ref{ArbFieldElem},), x) end function deepcopy_internal(a::ArbFieldElem, dict::IdDict) b = parent(a)() - ccall((:arb_set, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), b, a) + ccall((:arb_set, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), b, a) return b end @@ -96,10 +96,10 @@ end function _arb_get_arf(x::ArbFieldElem, ::RoundingMode{:Nearest}) t = arf_struct() GC.@preserve x begin - t1 = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, + t1 = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ref{ArbFieldElem}, ), x) - ccall((:arf_set, libarb), Nothing, + ccall((:arf_set, libflint), Nothing, (Ref{arf_struct}, Ptr{arf_struct}), t, t1) end @@ -111,7 +111,7 @@ for (b, f) in ((RoundingMode{:Down}, :arb_get_lbound_arf), @eval begin function _arb_get_arf(x::ArbFieldElem, ::$b) t = arf_struct() - ccall(($(string(f)), libarb), Nothing, + ccall(($(string(f)), libflint), Nothing, (Ref{arf_struct}, Ref{ArbFieldElem}, Int), t, x, parent(x).prec) return t @@ -124,14 +124,14 @@ for (b, i) in ((RoundingMode{:Down}, 2), (RoundingMode{:Nearest}, 4)) @eval begin function _arf_get_d(t::arf_struct, ::$b) - d = ccall((:arf_get_d, libarb), Float64, + d = ccall((:arf_get_d, libflint), Float64, (Ref{arf_struct}, Int), t, $i) return d end function _arf_get_mpfr(t::arf_struct, ::$b) d = BigFloat() - ccall((:arf_get_mpfr, libarb), Int32, + ccall((:arf_get_mpfr, libflint), Int32, (Ref{BigFloat}, Ref{arf_struct}, Base.MPFR.MPFRRoundingMode), d, t, $b()) return d @@ -177,7 +177,7 @@ end function native_string(x::ArbFieldElem) d = ceil(parent(x).prec * 0.30102999566398119521) - cstr = ccall((:arb_get_str, libarb), Ptr{UInt8}, + cstr = ccall((:arb_get_str, libflint), Ptr{UInt8}, (Ref{ArbFieldElem}, Int, UInt), x, Int(d), UInt(0)) res = unsafe_string(cstr) @@ -221,12 +221,12 @@ Returns `true` if any part of the ball $x$ overlaps any part of the ball $y$, otherwise return `false`. """ function overlaps(x::ArbFieldElem, y::ArbFieldElem) - r = ccall((:arb_overlaps, libarb), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y) + r = ccall((:arb_overlaps, libflint), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y) return Bool(r) end #function contains(x::ArbFieldElem, y::arf) -# r = ccall((:arb_contains_arf, libarb), Cint, (Ref{ArbFieldElem}, Ref{arf}), x, y) +# r = ccall((:arb_contains_arf, libflint), Cint, (Ref{ArbFieldElem}, Ref{arf}), x, y) # return Bool(r) #end @@ -237,7 +237,7 @@ Returns `true` if the ball $x$ contains the given rational value, otherwise return `false`. """ function contains(x::ArbFieldElem, y::QQFieldElem) - r = ccall((:arb_contains_fmpq, libarb), Cint, (Ref{ArbFieldElem}, Ref{QQFieldElem}), x, y) + r = ccall((:arb_contains_fmpq, libflint), Cint, (Ref{ArbFieldElem}, Ref{QQFieldElem}), x, y) return Bool(r) end @@ -248,12 +248,12 @@ Returns `true` if the ball $x$ contains the given integer value, otherwise return `false`. """ function contains(x::ArbFieldElem, y::ZZRingElem) - r = ccall((:arb_contains_fmpz, libarb), Cint, (Ref{ArbFieldElem}, Ref{ZZRingElem}), x, y) + r = ccall((:arb_contains_fmpz, libflint), Cint, (Ref{ArbFieldElem}, Ref{ZZRingElem}), x, y) return Bool(r) end function contains(x::ArbFieldElem, y::Int) - r = ccall((:arb_contains_si, libarb), Cint, (Ref{ArbFieldElem}, Int), x, y) + r = ccall((:arb_contains_si, libflint), Cint, (Ref{ArbFieldElem}, Int), x, y) return Bool(r) end @@ -280,7 +280,7 @@ Returns `true` if the ball $x$ contains the given floating point value, otherwise return `false`. """ function contains(x::ArbFieldElem, y::BigFloat) - r = ccall((:arb_contains_mpfr, libarb), Cint, + r = ccall((:arb_contains_mpfr, libflint), Cint, (Ref{ArbFieldElem}, Ref{BigFloat}), x, y) return Bool(r) end @@ -292,7 +292,7 @@ Returns `true` if the ball $x$ contains the ball $y$, otherwise return `false`. """ function contains(x::ArbFieldElem, y::ArbFieldElem) - r = ccall((:arb_contains, libarb), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y) + r = ccall((:arb_contains, libflint), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y) return Bool(r) end @@ -302,7 +302,7 @@ end Returns `true` if the ball $x$ contains zero, otherwise return `false`. """ function contains_zero(x::ArbFieldElem) - r = ccall((:arb_contains_zero, libarb), Cint, (Ref{ArbFieldElem}, ), x) + r = ccall((:arb_contains_zero, libflint), Cint, (Ref{ArbFieldElem}, ), x) return Bool(r) end @@ -313,7 +313,7 @@ Returns `true` if the ball $x$ contains any negative value, otherwise return `false`. """ function contains_negative(x::ArbFieldElem) - r = ccall((:arb_contains_negative, libarb), Cint, (Ref{ArbFieldElem}, ), x) + r = ccall((:arb_contains_negative, libflint), Cint, (Ref{ArbFieldElem}, ), x) return Bool(r) end @@ -324,7 +324,7 @@ Returns `true` if the ball $x$ contains any positive value, otherwise return `false`. """ function contains_positive(x::ArbFieldElem) - r = ccall((:arb_contains_positive, libarb), Cint, (Ref{ArbFieldElem}, ), x) + r = ccall((:arb_contains_positive, libflint), Cint, (Ref{ArbFieldElem}, ), x) return Bool(r) end @@ -335,7 +335,7 @@ Returns `true` if the ball $x$ contains any non-negative value, otherwise return `false`. """ function contains_nonnegative(x::ArbFieldElem) - r = ccall((:arb_contains_nonnegative, libarb), Cint, (Ref{ArbFieldElem}, ), x) + r = ccall((:arb_contains_nonnegative, libflint), Cint, (Ref{ArbFieldElem}, ), x) return Bool(r) end @@ -346,7 +346,7 @@ Returns `true` if the ball $x$ contains any nonpositive value, otherwise return `false`. """ function contains_nonpositive(x::ArbFieldElem) - r = ccall((:arb_contains_nonpositive, libarb), Cint, (Ref{ArbFieldElem}, ), x) + r = ccall((:arb_contains_nonpositive, libflint), Cint, (Ref{ArbFieldElem}, ), x) return Bool(r) end @@ -363,24 +363,24 @@ Return `true` if the balls $x$ and $y$ are precisely equal, i.e. have the same midpoints and radii. """ function isequal(x::ArbFieldElem, y::ArbFieldElem) - r = ccall((:arb_equal, libarb), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y) + r = ccall((:arb_equal, libflint), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y) return Bool(r) end function ==(x::ArbFieldElem, y::ArbFieldElem) - return Bool(ccall((:arb_eq, libarb), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y)) + return Bool(ccall((:arb_eq, libflint), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y)) end function !=(x::ArbFieldElem, y::ArbFieldElem) - return Bool(ccall((:arb_ne, libarb), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y)) + return Bool(ccall((:arb_ne, libflint), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y)) end function isless(x::ArbFieldElem, y::ArbFieldElem) - return Bool(ccall((:arb_lt, libarb), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y)) + return Bool(ccall((:arb_lt, libflint), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y)) end function <=(x::ArbFieldElem, y::ArbFieldElem) - return Bool(ccall((:arb_le, libarb), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y)) + return Bool(ccall((:arb_le, libflint), Cint, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y)) end ==(x::ArbFieldElem, y::Int) = x == ArbFieldElem(y) @@ -470,7 +470,7 @@ end Return `true` if $x$ is certainly zero, otherwise return `false`. """ function iszero(x::ArbFieldElem) - return Bool(ccall((:arb_is_zero, libarb), Cint, (Ref{ArbFieldElem},), x)) + return Bool(ccall((:arb_is_zero, libflint), Cint, (Ref{ArbFieldElem},), x)) end @doc raw""" @@ -480,7 +480,7 @@ Return `true` if $x$ is certainly not equal to zero, otherwise return `false`. """ function is_nonzero(x::ArbFieldElem) - return Bool(ccall((:arb_is_nonzero, libarb), Cint, (Ref{ArbFieldElem},), x)) + return Bool(ccall((:arb_is_nonzero, libflint), Cint, (Ref{ArbFieldElem},), x)) end @doc raw""" @@ -489,7 +489,7 @@ end Return `true` if $x$ is certainly one, otherwise return `false`. """ function isone(x::ArbFieldElem) - return Bool(ccall((:arb_is_one, libarb), Cint, (Ref{ArbFieldElem},), x)) + return Bool(ccall((:arb_is_one, libflint), Cint, (Ref{ArbFieldElem},), x)) end @doc raw""" @@ -499,7 +499,7 @@ Return `true` if $x$ is finite, i.e. having finite midpoint and radius, otherwise return `false`. """ function isfinite(x::ArbFieldElem) - return Bool(ccall((:arb_is_finite, libarb), Cint, (Ref{ArbFieldElem},), x)) + return Bool(ccall((:arb_is_finite, libflint), Cint, (Ref{ArbFieldElem},), x)) end @doc raw""" @@ -509,7 +509,7 @@ Return `true` if $x$ is exact, i.e. has zero radius, otherwise return `false`. """ function is_exact(x::ArbFieldElem) - return Bool(ccall((:arb_is_exact, libarb), Cint, (Ref{ArbFieldElem},), x)) + return Bool(ccall((:arb_is_exact, libflint), Cint, (Ref{ArbFieldElem},), x)) end @doc raw""" @@ -518,7 +518,7 @@ end Return `true` if $x$ is an exact integer, otherwise return `false`. """ function isinteger(x::ArbFieldElem) - return Bool(ccall((:arb_is_int, libarb), Cint, (Ref{ArbFieldElem},), x)) + return Bool(ccall((:arb_is_int, libflint), Cint, (Ref{ArbFieldElem},), x)) end @doc raw""" @@ -527,7 +527,7 @@ end Return `true` if $x$ is certainly positive, otherwise return `false`. """ function is_positive(x::ArbFieldElem) - return Bool(ccall((:arb_is_positive, libarb), Cint, (Ref{ArbFieldElem},), x)) + return Bool(ccall((:arb_is_positive, libflint), Cint, (Ref{ArbFieldElem},), x)) end @doc raw""" @@ -536,7 +536,7 @@ end Return `true` if $x$ is certainly non-negative, otherwise return `false`. """ function is_nonnegative(x::ArbFieldElem) - return Bool(ccall((:arb_is_nonnegative, libarb), Cint, (Ref{ArbFieldElem},), x)) + return Bool(ccall((:arb_is_nonnegative, libflint), Cint, (Ref{ArbFieldElem},), x)) end @doc raw""" @@ -545,7 +545,7 @@ end Return `true` if $x$ is certainly negative, otherwise return `false`. """ function is_negative(x::ArbFieldElem) - return Bool(ccall((:arb_is_negative, libarb), Cint, (Ref{ArbFieldElem},), x)) + return Bool(ccall((:arb_is_negative, libflint), Cint, (Ref{ArbFieldElem},), x)) end @doc raw""" @@ -554,7 +554,7 @@ end Return `true` if $x$ is certainly nonpositive, otherwise return `false`. """ function is_nonpositive(x::ArbFieldElem) - return Bool(ccall((:arb_is_nonpositive, libarb), Cint, (Ref{ArbFieldElem},), x)) + return Bool(ccall((:arb_is_nonpositive, libflint), Cint, (Ref{ArbFieldElem},), x)) end ################################################################################ @@ -582,7 +582,7 @@ Return the radius of the ball $x$ as an Arb ball. """ function radius(x::ArbFieldElem) z = parent(x)() - ccall((:arb_get_rad_arb, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, x) + ccall((:arb_get_rad_arb, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, x) return z end @@ -593,7 +593,7 @@ Return the midpoint of the ball $x$ as an Arb ball. """ function midpoint(x::ArbFieldElem) z = parent(x)() - ccall((:arb_get_mid_arb, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, x) + ccall((:arb_get_mid_arb, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, x) return z end @@ -603,7 +603,7 @@ end Adds the absolute values of the midpoint and radius of $y$ to the radius of $x$. """ function add_error!(x::ArbFieldElem, y::ArbFieldElem) - ccall((:arb_add_error, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y) + ccall((:arb_add_error, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), x, y) end ################################################################################ @@ -632,7 +632,7 @@ Base.signbit(x::ArbFieldElem) = signbit(sign(Int, x)) function -(x::ArbFieldElem) z = parent(x)() - ccall((:arb_neg, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, x) + ccall((:arb_neg, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, x) return z end @@ -646,7 +646,7 @@ for (s,f) in ((:+,"arb_add"), (:*,"arb_mul"), (://, "arb_div"), (:-,"arb_sub")) @eval begin function ($s)(x::ArbFieldElem, y::ArbFieldElem) z = parent(x)() - ccall(($f, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), + ccall(($f, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, y, parent(x).prec) return z end @@ -657,7 +657,7 @@ for (f,s) in ((:+, "add"), (:*, "mul")) @eval begin #function ($f)(x::ArbFieldElem, y::arf) # z = parent(x)() - # ccall(($("arb_"*s*"_arf"), libarb), Nothing, + # ccall(($("arb_"*s*"_arf"), libflint), Nothing, # (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{arf}, Int), # z, x, y, parent(x).prec) # return z @@ -667,7 +667,7 @@ for (f,s) in ((:+, "add"), (:*, "mul")) function ($f)(x::ArbFieldElem, y::UInt) z = parent(x)() - ccall(($("arb_"*s*"_ui"), libarb), Nothing, + ccall(($("arb_"*s*"_ui"), libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, UInt, Int), z, x, y, parent(x).prec) return z @@ -677,7 +677,7 @@ for (f,s) in ((:+, "add"), (:*, "mul")) function ($f)(x::ArbFieldElem, y::Int) z = parent(x)() - ccall(($("arb_"*s*"_si"), libarb), Nothing, + ccall(($("arb_"*s*"_si"), libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int, Int), z, x, y, parent(x).prec) return z end @@ -686,7 +686,7 @@ for (f,s) in ((:+, "add"), (:*, "mul")) function ($f)(x::ArbFieldElem, y::ZZRingElem) z = parent(x)() - ccall(($("arb_"*s*"_fmpz"), libarb), Nothing, + ccall(($("arb_"*s*"_fmpz"), libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ZZRingElem}, Int), z, x, y, parent(x).prec) return z @@ -698,7 +698,7 @@ end #function -(x::ArbFieldElem, y::arf) # z = parent(x)() -# ccall((:arb_sub_arf, libarb), Nothing, +# ccall((:arb_sub_arf, libflint), Nothing, # (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{arf}, Int), z, x, y, parent(x).prec) # return z #end @@ -707,7 +707,7 @@ end function -(x::ArbFieldElem, y::UInt) z = parent(x)() - ccall((:arb_sub_ui, libarb), Nothing, + ccall((:arb_sub_ui, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, UInt, Int), z, x, y, parent(x).prec) return z end @@ -716,7 +716,7 @@ end function -(x::ArbFieldElem, y::Int) z = parent(x)() - ccall((:arb_sub_si, libarb), Nothing, + ccall((:arb_sub_si, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int, Int), z, x, y, parent(x).prec) return z end @@ -725,7 +725,7 @@ end function -(x::ArbFieldElem, y::ZZRingElem) z = parent(x)() - ccall((:arb_sub_fmpz, libarb), Nothing, + ccall((:arb_sub_fmpz, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ZZRingElem}, Int), z, x, y, parent(x).prec) return z @@ -751,28 +751,28 @@ end #function //(x::ArbFieldElem, y::arf) # z = parent(x)() -# ccall((:arb_div_arf, libarb), Nothing, +# ccall((:arb_div_arf, libflint), Nothing, # (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{arf}, Int), z, x, y, parent(x).prec) # return z #end function //(x::ArbFieldElem, y::UInt) z = parent(x)() - ccall((:arb_div_ui, libarb), Nothing, + ccall((:arb_div_ui, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, UInt, Int), z, x, y, parent(x).prec) return z end function //(x::ArbFieldElem, y::Int) z = parent(x)() - ccall((:arb_div_si, libarb), Nothing, + ccall((:arb_div_si, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int, Int), z, x, y, parent(x).prec) return z end function //(x::ArbFieldElem, y::ZZRingElem) z = parent(x)() - ccall((:arb_div_fmpz, libarb), Nothing, + ccall((:arb_div_fmpz, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ZZRingElem}, Int), z, x, y, parent(x).prec) return z @@ -780,7 +780,7 @@ end function //(x::UInt, y::ArbFieldElem) z = parent(y)() - ccall((:arb_ui_div, libarb), Nothing, + ccall((:arb_ui_div, libflint), Nothing, (Ref{ArbFieldElem}, UInt, Ref{ArbFieldElem}, Int), z, x, y, parent(y).prec) return z end @@ -788,7 +788,7 @@ end function //(x::Int, y::ArbFieldElem) z = parent(y)() t = ArbFieldElem(x) - ccall((:arb_div, libarb), Nothing, + ccall((:arb_div, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, t, y, parent(y).prec) return z end @@ -796,21 +796,21 @@ end function //(x::ZZRingElem, y::ArbFieldElem) z = parent(y)() t = ArbFieldElem(x) - ccall((:arb_div, libarb), Nothing, + ccall((:arb_div, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, t, y, parent(y).prec) return z end function ^(x::ArbFieldElem, y::ArbFieldElem) z = parent(x)() - ccall((:arb_pow, libarb), Nothing, + ccall((:arb_pow, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, y, parent(x).prec) return z end function ^(x::ArbFieldElem, y::ZZRingElem) z = parent(x)() - ccall((:arb_pow_fmpz, libarb), Nothing, + ccall((:arb_pow_fmpz, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ZZRingElem}, Int), z, x, y, parent(x).prec) return z @@ -820,14 +820,14 @@ end function ^(x::ArbFieldElem, y::UInt) z = parent(x)() - ccall((:arb_pow_ui, libarb), Nothing, + ccall((:arb_pow_ui, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, UInt, Int), z, x, y, parent(x).prec) return z end function ^(x::ArbFieldElem, y::QQFieldElem) z = parent(x)() - ccall((:arb_pow_fmpq, libarb), Nothing, + ccall((:arb_pow_fmpq, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{QQFieldElem}, Int), z, x, y, parent(x).prec) return z @@ -879,7 +879,7 @@ divexact(x::ArbFieldElem, y::ZZRingElem; check::Bool=true) = x // y function abs(x::ArbFieldElem) z = parent(x)() - ccall((:arb_abs, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, x) + ccall((:arb_abs, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, x) return z end @@ -891,7 +891,7 @@ end function inv(x::ArbFieldElem) z = parent(x)() - ccall((:arb_inv, libarb), Nothing, + ccall((:arb_inv, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return parent(x)(z) end @@ -904,14 +904,14 @@ end function ldexp(x::ArbFieldElem, y::Int) z = parent(x)() - ccall((:arb_mul_2exp_si, libarb), Nothing, + ccall((:arb_mul_2exp_si, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, y) return z end function ldexp(x::ArbFieldElem, y::ZZRingElem) z = parent(x)() - ccall((:arb_mul_2exp_fmpz, libarb), Nothing, + ccall((:arb_mul_2exp_fmpz, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ZZRingElem}), z, x, y) return z end @@ -930,7 +930,7 @@ by rounding off insignificant bits from the midpoint. """ function trim(x::ArbFieldElem) z = parent(x)() - ccall((:arb_trim, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, x) + ccall((:arb_trim, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}), z, x) return z end @@ -944,7 +944,7 @@ integer. """ function unique_integer(x::ArbFieldElem) z = ZZRingElem() - unique = ccall((:arb_get_unique_fmpz, libarb), Int, + unique = ccall((:arb_get_unique_fmpz, libflint), Int, (Ref{ZZRingElem}, Ref{ArbFieldElem}), z, x) return (unique != 0, z) end @@ -961,7 +961,7 @@ $y$. """ function setunion(x::ArbFieldElem, y::ArbFieldElem) z = parent(x)() - ccall((:arb_union, libarb), Nothing, + ccall((:arb_union, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, y, parent(x).prec) return z end @@ -974,7 +974,7 @@ $x$ and $y$. """ function setintersection(x::ArbFieldElem, y::ArbFieldElem) z = parent(x)() - ccall((:arb_intersection, libarb), Nothing, + ccall((:arb_intersection, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, y, parent(x).prec) return z end @@ -992,7 +992,7 @@ Return $\pi = 3.14159\ldots$ as an element of $r$. """ function const_pi(r::ArbField) z = r() - ccall((:arb_const_pi, libarb), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) + ccall((:arb_const_pi, libflint), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) return z end @@ -1003,7 +1003,7 @@ Return $e = 2.71828\ldots$ as an element of $r$. """ function const_e(r::ArbField) z = r() - ccall((:arb_const_e, libarb), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) + ccall((:arb_const_e, libflint), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) return z end @@ -1014,7 +1014,7 @@ Return $\log(2) = 0.69314\ldots$ as an element of $r$. """ function const_log2(r::ArbField) z = r() - ccall((:arb_const_log2, libarb), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) + ccall((:arb_const_log2, libflint), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) return z end @@ -1025,7 +1025,7 @@ Return $\log(10) = 2.302585\ldots$ as an element of $r$. """ function const_log10(r::ArbField) z = r() - ccall((:arb_const_log10, libarb), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) + ccall((:arb_const_log10, libflint), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) return z end @@ -1036,7 +1036,7 @@ Return Euler's constant $\gamma = 0.577215\ldots$ as an element of $r$. """ function const_euler(r::ArbField) z = r() - ccall((:arb_const_euler, libarb), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) + ccall((:arb_const_euler, libflint), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) return z end @@ -1047,7 +1047,7 @@ Return Catalan's constant $C = 0.915965\ldots$ as an element of $r$. """ function const_catalan(r::ArbField) z = r() - ccall((:arb_const_catalan, libarb), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) + ccall((:arb_const_catalan, libflint), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) return z end @@ -1058,7 +1058,7 @@ Return Khinchin's constant $K = 2.685452\ldots$ as an element of $r$. """ function const_khinchin(r::ArbField) z = r() - ccall((:arb_const_khinchin, libarb), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) + ccall((:arb_const_khinchin, libflint), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) return z end @@ -1069,7 +1069,7 @@ Return Glaisher's constant $A = 1.282427\ldots$ as an element of $r$. """ function const_glaisher(r::ArbField) z = r() - ccall((:arb_const_glaisher, libarb), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) + ccall((:arb_const_glaisher, libflint), Nothing, (Ref{ArbFieldElem}, Int), z, precision(r)) return z end @@ -1083,7 +1083,7 @@ end function floor(x::ArbFieldElem) z = parent(x)() - ccall((:arb_floor, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_floor, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1093,7 +1093,7 @@ floor(::Type{T}, x::ArbFieldElem) where {T <: Integer} = T(floor(x)) function ceil(x::ArbFieldElem) z = parent(x)() - ccall((:arb_ceil, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_ceil, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1103,7 +1103,7 @@ ceil(::Type{T}, x::ArbFieldElem) where {T <: Integer} = T(ceil(x)) function Base.sqrt(x::ArbFieldElem; check::Bool=true) z = parent(x)() - ccall((:arb_sqrt, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_sqrt, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1114,7 +1114,7 @@ Return the reciprocal of the square root of $x$, i.e. $1/\sqrt{x}$. """ function rsqrt(x::ArbFieldElem) z = parent(x)() - ccall((:arb_rsqrt, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_rsqrt, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1125,7 +1125,7 @@ Return $\sqrt{1+x}-1$, evaluated accurately for small $x$. """ function sqrt1pm1(x::ArbFieldElem) z = parent(x)() - ccall((:arb_sqrt1pm1, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_sqrt1pm1, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1137,139 +1137,139 @@ number. Thus any negative number in the input interval is discarded. """ function sqrtpos(x::ArbFieldElem) z = parent(x)() - ccall((:arb_sqrtpos, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_sqrtpos, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function log(x::ArbFieldElem) z = parent(x)() - ccall((:arb_log, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_log, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function log1p(x::ArbFieldElem) z = parent(x)() - ccall((:arb_log1p, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_log1p, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function Base.exp(x::ArbFieldElem) z = parent(x)() - ccall((:arb_exp, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_exp, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function expm1(x::ArbFieldElem) z = parent(x)() - ccall((:arb_expm1, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_expm1, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function sin(x::ArbFieldElem) z = parent(x)() - ccall((:arb_sin, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_sin, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function cos(x::ArbFieldElem) z = parent(x)() - ccall((:arb_cos, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_cos, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function sinpi(x::ArbFieldElem) z = parent(x)() - ccall((:arb_sin_pi, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_sin_pi, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function cospi(x::ArbFieldElem) z = parent(x)() - ccall((:arb_cos_pi, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_cos_pi, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function tan(x::ArbFieldElem) z = parent(x)() - ccall((:arb_tan, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_tan, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function cot(x::ArbFieldElem) z = parent(x)() - ccall((:arb_cot, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_cot, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function tanpi(x::ArbFieldElem) z = parent(x)() - ccall((:arb_tan_pi, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_tan_pi, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function cotpi(x::ArbFieldElem) z = parent(x)() - ccall((:arb_cot_pi, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_cot_pi, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function sinh(x::ArbFieldElem) z = parent(x)() - ccall((:arb_sinh, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_sinh, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function cosh(x::ArbFieldElem) z = parent(x)() - ccall((:arb_cosh, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_cosh, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function tanh(x::ArbFieldElem) z = parent(x)() - ccall((:arb_tanh, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_tanh, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function coth(x::ArbFieldElem) z = parent(x)() - ccall((:arb_coth, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_coth, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function atan(x::ArbFieldElem) z = parent(x)() - ccall((:arb_atan, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_atan, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function asin(x::ArbFieldElem) z = parent(x)() - ccall((:arb_asin, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_asin, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function acos(x::ArbFieldElem) z = parent(x)() - ccall((:arb_acos, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_acos, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function atanh(x::ArbFieldElem) z = parent(x)() - ccall((:arb_atanh, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_atanh, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function asinh(x::ArbFieldElem) z = parent(x)() - ccall((:arb_asinh, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_asinh, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function acosh(x::ArbFieldElem) z = parent(x)() - ccall((:arb_acosh, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_acosh, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1280,7 +1280,7 @@ Return the Gamma function evaluated at $x$. """ function gamma(x::ArbFieldElem) z = parent(x)() - ccall((:arb_gamma, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_gamma, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1291,7 +1291,7 @@ Return the logarithm of the Gamma function evaluated at $x$. """ function lgamma(x::ArbFieldElem) z = parent(x)() - ccall((:arb_lgamma, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_lgamma, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1302,7 +1302,7 @@ Return the reciprocal of the Gamma function evaluated at $x$. """ function rgamma(x::ArbFieldElem) z = parent(x)() - ccall((:arb_rgamma, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_rgamma, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1314,7 +1314,7 @@ i.e. $\psi(x)$. """ function digamma(x::ArbFieldElem) z = parent(x)() - ccall((:arb_digamma, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_digamma, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end @@ -1325,7 +1325,7 @@ Return the upper incomplete gamma function $\Gamma(s,x)$. """ function gamma(s::ArbFieldElem, x::ArbFieldElem) z = parent(s)() - ccall((:arb_hypgeom_gamma_upper, libarb), Nothing, + ccall((:arb_hypgeom_gamma_upper, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int, Int), z, s, x, 0, parent(s).prec) return z end @@ -1338,7 +1338,7 @@ $\Gamma(s,x) / \Gamma(s)$. """ function gamma_regularized(s::ArbFieldElem, x::ArbFieldElem) z = parent(s)() - ccall((:arb_hypgeom_gamma_upper, libarb), Nothing, + ccall((:arb_hypgeom_gamma_upper, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int, Int), z, s, x, 1, parent(s).prec) return z end @@ -1350,7 +1350,7 @@ Return the lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$. """ function gamma_lower(s::ArbFieldElem, x::ArbFieldElem) z = parent(s)() - ccall((:arb_hypgeom_gamma_lower, libarb), Nothing, + ccall((:arb_hypgeom_gamma_lower, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int, Int), z, s, x, 0, parent(s).prec) return z end @@ -1363,7 +1363,7 @@ $\gamma(s,x) / \Gamma(s)$. """ function gamma_lower_regularized(s::ArbFieldElem, x::ArbFieldElem) z = parent(s)() - ccall((:arb_hypgeom_gamma_lower, libarb), Nothing, + ccall((:arb_hypgeom_gamma_lower, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int, Int), z, s, x, 1, parent(s).prec) return z end @@ -1376,14 +1376,14 @@ Return the Riemann zeta function evaluated at $x$. """ function zeta(x::ArbFieldElem) z = parent(x)() - ccall((:arb_zeta, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) + ccall((:arb_zeta, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, parent(x).prec) return z end function sincos(x::ArbFieldElem) s = parent(x)() c = parent(x)() - ccall((:arb_sin_cos, libarb), Nothing, + ccall((:arb_sin_cos, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), s, c, x, parent(x).prec) return (s, c) end @@ -1391,21 +1391,21 @@ end function sincospi(x::ArbFieldElem) s = parent(x)() c = parent(x)() - ccall((:arb_sin_cos_pi, libarb), Nothing, + ccall((:arb_sin_cos_pi, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), s, c, x, parent(x).prec) return (s, c) end function sinpi(x::QQFieldElem, r::ArbField) z = r() - ccall((:arb_sin_pi_fmpq, libarb), Nothing, + ccall((:arb_sin_pi_fmpq, libflint), Nothing, (Ref{ArbFieldElem}, Ref{QQFieldElem}, Int), z, x, precision(r)) return z end function cospi(x::QQFieldElem, r::ArbField) z = r() - ccall((:arb_cos_pi_fmpq, libarb), Nothing, + ccall((:arb_cos_pi_fmpq, libflint), Nothing, (Ref{ArbFieldElem}, Ref{QQFieldElem}, Int), z, x, precision(r)) return z end @@ -1413,7 +1413,7 @@ end function sincospi(x::QQFieldElem, r::ArbField) s = r() c = r() - ccall((:arb_sin_cos_pi_fmpq, libarb), Nothing, + ccall((:arb_sin_cos_pi_fmpq, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{QQFieldElem}, Int), s, c, x, precision(r)) return (s, c) end @@ -1421,14 +1421,14 @@ end function sinhcosh(x::ArbFieldElem) s = parent(x)() c = parent(x)() - ccall((:arb_sinh_cosh, libarb), Nothing, + ccall((:arb_sinh_cosh, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), s, c, x, parent(x).prec) return (s, c) end function atan(y::ArbFieldElem, x::ArbFieldElem) z = parent(y)() - ccall((:arb_atan2, libarb), Nothing, + ccall((:arb_atan2, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, y, x, parent(y).prec) return z end @@ -1449,7 +1449,7 @@ Return the arithmetic-geometric mean of $x$ and $y$ """ function agm(x::ArbFieldElem, y::ArbFieldElem) z = parent(x)() - ccall((:arb_agm, libarb), Nothing, + ccall((:arb_agm, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, y, parent(x).prec) return z end @@ -1461,21 +1461,21 @@ Return the Hurwitz zeta function $\zeta(s,a)$. """ function zeta(s::ArbFieldElem, a::ArbFieldElem) z = parent(s)() - ccall((:arb_hurwitz_zeta, libarb), Nothing, + ccall((:arb_hurwitz_zeta, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, s, a, parent(s).prec) return z end function hypot(x::ArbFieldElem, y::ArbFieldElem) z = parent(x)() - ccall((:arb_hypot, libarb), Nothing, + ccall((:arb_hypot, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, y, parent(x).prec) return z end function root(x::ArbFieldElem, n::UInt) z = parent(x)() - ccall((:arb_root, libarb), Nothing, + ccall((:arb_root, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, UInt, Int), z, x, n, parent(x).prec) return z end @@ -1499,7 +1499,7 @@ factorial(x::ArbFieldElem) = gamma(x+1) function factorial(n::UInt, r::ArbField) z = r() - ccall((:arb_fac_ui, libarb), Nothing, (Ref{ArbFieldElem}, UInt, Int), z, n, r.prec) + ccall((:arb_fac_ui, libflint), Nothing, (Ref{ArbFieldElem}, UInt, Int), z, n, r.prec) return z end @@ -1517,7 +1517,7 @@ Return the binomial coefficient ${x \choose n}$. """ function binomial(x::ArbFieldElem, n::UInt) z = parent(x)() - ccall((:arb_bin_ui, libarb), Nothing, + ccall((:arb_bin_ui, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, UInt, Int), z, x, n, parent(x).prec) return z end @@ -1529,7 +1529,7 @@ Return the binomial coefficient ${n \choose k}$ in the given Arb field. """ function binomial(n::UInt, k::UInt, r::ArbField) z = r() - ccall((:arb_bin_uiui, libarb), Nothing, + ccall((:arb_bin_uiui, libflint), Nothing, (Ref{ArbFieldElem}, UInt, UInt, Int), z, n, k, r.prec) return z end @@ -1541,14 +1541,14 @@ Return the $n$-th Fibonacci number in the given Arb field. """ function fibonacci(n::ZZRingElem, r::ArbField) z = r() - ccall((:arb_fib_fmpz, libarb), Nothing, + ccall((:arb_fib_fmpz, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ZZRingElem}, Int), z, n, r.prec) return z end function fibonacci(n::UInt, r::ArbField) z = r() - ccall((:arb_fib_ui, libarb), Nothing, + ccall((:arb_fib_ui, libflint), Nothing, (Ref{ArbFieldElem}, UInt, Int), z, n, r.prec) return z end @@ -1567,7 +1567,7 @@ Return the Gamma function evaluated at $x$ in the given Arb field. """ function gamma(x::ZZRingElem, r::ArbField) z = r() - ccall((:arb_gamma_fmpz, libarb), Nothing, + ccall((:arb_gamma_fmpz, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ZZRingElem}, Int), z, x, r.prec) return z end @@ -1579,7 +1579,7 @@ Return the Gamma function evaluated at $x$ in the given Arb field. """ function gamma(x::QQFieldElem, r::ArbField) z = r() - ccall((:arb_gamma_fmpq, libarb), Nothing, + ccall((:arb_gamma_fmpq, libflint), Nothing, (Ref{ArbFieldElem}, Ref{QQFieldElem}, Int), z, x, r.prec) return z end @@ -1587,7 +1587,7 @@ end function zeta(n::UInt, r::ArbField) z = r() - ccall((:arb_zeta_ui, libarb), Nothing, + ccall((:arb_zeta_ui, libflint), Nothing, (Ref{ArbFieldElem}, UInt, Int), z, n, r.prec) return z end @@ -1602,7 +1602,7 @@ zeta(n::Int, r::ArbField) = n >= 0 ? zeta(UInt(n), r) : zeta(r(n)) function bernoulli(n::UInt, r::ArbField) z = r() - ccall((:arb_bernoulli_ui, libarb), Nothing, + ccall((:arb_bernoulli_ui, libflint), Nothing, (Ref{ArbFieldElem}, UInt, Int), z, n, r.prec) return z end @@ -1616,7 +1616,7 @@ bernoulli(n::Int, r::ArbField) = n >= 0 ? bernoulli(UInt(n), r) : throw(DomainEr function rising_factorial(x::ArbFieldElem, n::UInt) z = parent(x)() - ccall((:arb_rising_ui, libarb), Nothing, + ccall((:arb_rising_ui, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, UInt, Int), z, x, n, parent(x).prec) return z end @@ -1630,7 +1630,7 @@ rising_factorial(x::ArbFieldElem, n::Int) = n < 0 ? throw(DomainError(n, "Index function rising_factorial(x::QQFieldElem, n::UInt, r::ArbField) z = r() - ccall((:arb_rising_fmpq_ui, libarb), Nothing, + ccall((:arb_rising_fmpq_ui, libflint), Nothing, (Ref{ArbFieldElem}, Ref{QQFieldElem}, UInt, Int), z, x, n, r.prec) return z end @@ -1646,7 +1646,7 @@ rising_factorial(x::QQFieldElem, n::Int, r::ArbField) = n < 0 ? throw(DomainErro function rising_factorial2(x::ArbFieldElem, n::UInt) z = parent(x)() w = parent(x)() - ccall((:arb_rising2_ui, libarb), Nothing, + ccall((:arb_rising2_ui, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, UInt, Int), z, w, x, n, parent(x).prec) return (z, w) end @@ -1661,14 +1661,14 @@ rising_factorial2(x::ArbFieldElem, n::Int) = n < 0 ? throw(DomainError(n, "Index function polylog(s::ArbFieldElem, a::ArbFieldElem) z = parent(s)() - ccall((:arb_polylog, libarb), Nothing, + ccall((:arb_polylog, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, s, a, parent(s).prec) return z end function polylog(s::Int, a::ArbFieldElem) z = parent(a)() - ccall((:arb_polylog_si, libarb), Nothing, + ccall((:arb_polylog_si, libflint), Nothing, (Ref{ArbFieldElem}, Int, Ref{ArbFieldElem}, Int), z, s, a, parent(a).prec) return z end @@ -1681,14 +1681,14 @@ Return the polylogarithm Li$_s(a)$. function chebyshev_t(n::UInt, x::ArbFieldElem) z = parent(x)() - ccall((:arb_chebyshev_t_ui, libarb), Nothing, + ccall((:arb_chebyshev_t_ui, libflint), Nothing, (Ref{ArbFieldElem}, UInt, Ref{ArbFieldElem}, Int), z, n, x, parent(x).prec) return z end function chebyshev_u(n::UInt, x::ArbFieldElem) z = parent(x)() - ccall((:arb_chebyshev_u_ui, libarb), Nothing, + ccall((:arb_chebyshev_u_ui, libflint), Nothing, (Ref{ArbFieldElem}, UInt, Ref{ArbFieldElem}, Int), z, n, x, parent(x).prec) return z end @@ -1696,7 +1696,7 @@ end function chebyshev_t2(n::UInt, x::ArbFieldElem) z = parent(x)() w = parent(x)() - ccall((:arb_chebyshev_t2_ui, libarb), Nothing, + ccall((:arb_chebyshev_t2_ui, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, UInt, Ref{ArbFieldElem}, Int), z, w, n, x, parent(x).prec) return z, w end @@ -1704,7 +1704,7 @@ end function chebyshev_u2(n::UInt, x::ArbFieldElem) z = parent(x)() w = parent(x)() - ccall((:arb_chebyshev_u2_ui, libarb), Nothing, + ccall((:arb_chebyshev_u2_ui, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, UInt, Ref{ArbFieldElem}, Int), z, w, n, x, parent(x).prec) return z, w end @@ -1744,7 +1744,7 @@ Return the Bell number $B_n$ as an element of $r$. """ function bell(n::ZZRingElem, r::ArbField) z = r() - ccall((:arb_bell_fmpz, libarb), Nothing, + ccall((:arb_bell_fmpz, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ZZRingElem}, Int), z, n, r.prec) return z end @@ -1763,7 +1763,7 @@ Return the number of partitions $p(n)$ as an element of $r$. """ function numpart(n::ZZRingElem, r::ArbField) z = r() - ccall((:arb_partitions_fmpz, libarb), Nothing, + ccall((:arb_partitions_fmpz, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ZZRingElem}, Int), z, n, r.prec) return z end @@ -1788,7 +1788,7 @@ Return the Airy function $\operatorname{Ai}(x)$. """ function airy_ai(x::ArbFieldElem) ai = parent(x)() - ccall((:arb_hypgeom_airy, libarb), Nothing, + ccall((:arb_hypgeom_airy, libflint), Nothing, (Ref{ArbFieldElem}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ref{ArbFieldElem}, Int), ai, C_NULL, C_NULL, C_NULL, x, parent(x).prec) return ai @@ -1801,7 +1801,7 @@ Return the Airy function $\operatorname{Bi}(x)$. """ function airy_bi(x::ArbFieldElem) bi = parent(x)() - ccall((:arb_hypgeom_airy, libarb), Nothing, + ccall((:arb_hypgeom_airy, libflint), Nothing, (Ptr{Cvoid}, Ptr{Cvoid}, Ref{ArbFieldElem}, Ptr{Cvoid}, Ref{ArbFieldElem}, Int), C_NULL, C_NULL, bi, C_NULL, x, parent(x).prec) return bi @@ -1814,7 +1814,7 @@ Return the derivative of the Airy function $\operatorname{Ai}^\prime(x)$. """ function airy_ai_prime(x::ArbFieldElem) ai_prime = parent(x)() - ccall((:arb_hypgeom_airy, libarb), Nothing, + ccall((:arb_hypgeom_airy, libflint), Nothing, (Ptr{Cvoid}, Ref{ArbFieldElem}, Ptr{Cvoid}, Ptr{Cvoid}, Ref{ArbFieldElem}, Int), C_NULL, ai_prime, C_NULL, C_NULL, x, parent(x).prec) return ai_prime @@ -1827,7 +1827,7 @@ Return the derivative of the Airy function $\operatorname{Bi}^\prime(x)$. """ function airy_bi_prime(x::ArbFieldElem) bi_prime = parent(x)() - ccall((:arb_hypgeom_airy, libarb), Nothing, + ccall((:arb_hypgeom_airy, libflint), Nothing, (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), C_NULL, C_NULL, C_NULL, bi_prime, x, parent(x).prec) return bi_prime @@ -1918,7 +1918,7 @@ function simplest_rational_inside(x::ArbFieldElem) b = ZZRingElem() e = ZZRingElem() - ccall((:arb_get_interval_fmpz_2exp, libarb), Nothing, + ccall((:arb_get_interval_fmpz_2exp, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ArbFieldElem}), a, b, e, x) !fits(Int, e) && error("Result does not fit into an QQFieldElem") _e = Int(e) @@ -1937,7 +1937,7 @@ end ################################################################################ function zero!(z::ArbFieldElem) - ccall((:arb_zero, libarb), Nothing, (Ref{ArbFieldElem},), z) + ccall((:arb_zero, libflint), Nothing, (Ref{ArbFieldElem},), z) return z end @@ -1945,7 +1945,7 @@ for (s,f) in (("add!","arb_add"), ("mul!","arb_mul"), ("div!", "arb_div"), ("sub!","arb_sub")) @eval begin function ($(Symbol(s)))(z::ArbFieldElem, x::ArbFieldElem, y::ArbFieldElem) - ccall(($f, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), + ccall(($f, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, x, y, parent(x).prec) return z end @@ -1953,14 +1953,14 @@ for (s,f) in (("add!","arb_add"), ("mul!","arb_mul"), ("div!", "arb_div"), end function addeq!(z::ArbFieldElem, x::ArbFieldElem) - ccall((:arb_add, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), + ccall((:arb_add, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int), z, z, x, parent(x).prec) return z end function addmul!(z::ArbFieldElem, x::ArbFieldElem, y::ZZRingElem) q = max(bits(z), bits(x)) - ccall((:arb_addmul_fmpz, libarb), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ZZRingElem}, Int), z, x, y, q) + ccall((:arb_addmul_fmpz, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ZZRingElem}, Int), z, x, y, q) return z end @@ -1975,12 +1975,12 @@ for (typeofx, passtoc) in ((ArbFieldElem, Ref{ArbFieldElem}), (Ptr{ArbFieldElem} ("arb_set_d", Float64)) @eval begin function _arb_set(x::($typeofx), y::($t)) - ccall(($f, libarb), Nothing, (($passtoc), ($t)), x, y) + ccall(($f, libflint), Nothing, (($passtoc), ($t)), x, y) end function _arb_set(x::($typeofx), y::($t), p::Int) _arb_set(x, y) - ccall((:arb_set_round, libarb), Nothing, + ccall((:arb_set_round, libflint), Nothing, (($passtoc), ($passtoc), Int), x, x, p) end end @@ -1988,52 +1988,52 @@ for (typeofx, passtoc) in ((ArbFieldElem, Ref{ArbFieldElem}), (Ptr{ArbFieldElem} @eval begin function _arb_set(x::($typeofx), y::ZZRingElem) - ccall((:arb_set_fmpz, libarb), Nothing, (($passtoc), Ref{ZZRingElem}), x, y) + ccall((:arb_set_fmpz, libflint), Nothing, (($passtoc), Ref{ZZRingElem}), x, y) end function _arb_set(x::($typeofx), y::ZZRingElem, p::Int) - ccall((:arb_set_round_fmpz, libarb), Nothing, + ccall((:arb_set_round_fmpz, libflint), Nothing, (($passtoc), Ref{ZZRingElem}, Int), x, y, p) end function _arb_set(x::($typeofx), y::QQFieldElem, p::Int) - ccall((:arb_set_fmpq, libarb), Nothing, + ccall((:arb_set_fmpq, libflint), Nothing, (($passtoc), Ref{QQFieldElem}, Int), x, y, p) end function _arb_set(x::($typeofx), y::ArbFieldElem) - ccall((:arb_set, libarb), Nothing, (($passtoc), Ref{ArbFieldElem}), x, y) + ccall((:arb_set, libflint), Nothing, (($passtoc), Ref{ArbFieldElem}), x, y) end function _arb_set(x::($typeofx), y::ArbFieldElem, p::Int) - ccall((:arb_set_round, libarb), Nothing, + ccall((:arb_set_round, libflint), Nothing, (($passtoc), Ref{ArbFieldElem}, Int), x, y, p) end function _arb_set(x::($typeofx), y::AbstractString, p::Int) s = string(y) - err = ccall((:arb_set_str, libarb), Int32, + err = ccall((:arb_set_str, libflint), Int32, (($passtoc), Ptr{UInt8}, Int), x, s, p) err == 0 || error("Invalid real string: $(repr(s))") end function _arb_set(x::($typeofx), y::BigFloat) - m = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, + m = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (($passtoc), ), x) - r = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, + r = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (($passtoc), ), x) - ccall((:arf_set_mpfr, libarb), Nothing, + ccall((:arf_set_mpfr, libflint), Nothing, (Ptr{arf_struct}, Ref{BigFloat}), m, y) - ccall((:mag_zero, libarb), Nothing, (Ptr{mag_struct}, ), r) + ccall((:mag_zero, libflint), Nothing, (Ptr{mag_struct}, ), r) end function _arb_set(x::($typeofx), y::BigFloat, p::Int) - m = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (($passtoc), ), x) - r = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (($passtoc), ), x) - ccall((:arf_set_mpfr, libarb), Nothing, + m = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (($passtoc), ), x) + r = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (($passtoc), ), x) + ccall((:arf_set_mpfr, libflint), Nothing, (Ptr{arf_struct}, Ref{BigFloat}), m, y) - ccall((:mag_zero, libarb), Nothing, (Ptr{mag_struct}, ), r) - ccall((:arb_set_round, libarb), Nothing, + ccall((:mag_zero, libflint), Nothing, (Ptr{mag_struct}, ), r) + ccall((:arb_set_round, libflint), Nothing, (($passtoc), ($passtoc), Int), x, x, p) end @@ -2122,22 +2122,22 @@ function rand(r::ArbField; randtype::Symbol=:urandom) x = r() if randtype == :urandom - ccall((:arb_urandom, libarb), Nothing, + ccall((:arb_urandom, libflint), Nothing, (Ref{ArbFieldElem}, Ptr{Cvoid}, Int), x, state.ptr, r.prec) elseif randtype == :randtest - ccall((:arb_randtest, libarb), Nothing, + ccall((:arb_randtest, libflint), Nothing, (Ref{ArbFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, r.prec, 30) elseif randtype == :randtest_exact - ccall((:arb_randtest_exact, libarb), Nothing, + ccall((:arb_randtest_exact, libflint), Nothing, (Ref{ArbFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, r.prec, 30) elseif randtype == :randtest_precise - ccall((:arb_randtest_precise, libarb), Nothing, + ccall((:arb_randtest_precise, libflint), Nothing, (Ref{ArbFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, r.prec, 30) elseif randtype == :randtest_wide - ccall((:arb_randtest_wide, libarb), Nothing, + ccall((:arb_randtest_wide, libflint), Nothing, (Ref{ArbFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, r.prec, 30) elseif randtype == :randtest_special - ccall((:arb_randtest_special, libarb), Nothing, + ccall((:arb_randtest_special, libflint), Nothing, (Ref{ArbFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, r.prec, 30) else error("Arb random generation `" * String(randtype) * "` is not defined") diff --git a/src/arb/arb_mat.jl b/src/arb/arb_mat.jl index 50062c286..04413b259 100644 --- a/src/arb/arb_mat.jl +++ b/src/arb/arb_mat.jl @@ -46,9 +46,9 @@ end function getindex!(z::ArbFieldElem, x::ArbMatrix, r::Int, c::Int) GC.@preserve x begin - v = ccall((:arb_mat_entry_ptr, libarb), Ptr{ArbFieldElem}, + v = ccall((:arb_mat_entry_ptr, libflint), Ptr{ArbFieldElem}, (Ref{ArbMatrix}, Int, Int), x, r - 1, c - 1) - ccall((:arb_set, libarb), Nothing, (Ref{ArbFieldElem}, Ptr{ArbFieldElem}), z, v) + ccall((:arb_set, libflint), Nothing, (Ref{ArbFieldElem}, Ptr{ArbFieldElem}), z, v) end return z end @@ -58,9 +58,9 @@ end z = base_ring(x)() GC.@preserve x begin - v = ccall((:arb_mat_entry_ptr, libarb), Ptr{ArbFieldElem}, + v = ccall((:arb_mat_entry_ptr, libflint), Ptr{ArbFieldElem}, (Ref{ArbMatrix}, Int, Int), x, r - 1, c - 1) - ccall((:arb_set, libarb), Nothing, (Ref{ArbFieldElem}, Ptr{ArbFieldElem}), z, v) + ccall((:arb_set, libflint), Nothing, (Ref{ArbFieldElem}, Ptr{ArbFieldElem}), z, v) end return z end @@ -71,7 +71,7 @@ for T in [Int, UInt, ZZRingElem, QQFieldElem, Float64, BigFloat, ArbFieldElem, A @boundscheck Generic._checkbounds(x, r, c) GC.@preserve x begin - z = ccall((:arb_mat_entry_ptr, libarb), Ptr{ArbFieldElem}, + z = ccall((:arb_mat_entry_ptr, libflint), Ptr{ArbFieldElem}, (Ref{ArbMatrix}, Int, Int), x, r - 1, c - 1) Nemo._arb_set(z, y, precision(base_ring(x))) end @@ -91,7 +91,7 @@ zero(a::ArbMatSpace) = a() function one(x::ArbMatSpace) z = x() - ccall((:arb_mat_one, libarb), Nothing, (Ref{ArbMatrix}, ), z) + ccall((:arb_mat_one, libflint), Nothing, (Ref{ArbMatrix}, ), z) return z end @@ -105,7 +105,7 @@ number_of_columns(a::ArbMatSpace) = a.ncols function deepcopy_internal(x::ArbMatrix, dict::IdDict) z = ArbMatrix(nrows(x), ncols(x)) - ccall((:arb_mat_set, libarb), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}), z, x) + ccall((:arb_mat_set, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}), z, x) z.base_ring = x.base_ring return z end @@ -118,7 +118,7 @@ end function -(x::ArbMatrix) z = similar(x) - ccall((:arb_mat_neg, libarb), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}), z, x) + ccall((:arb_mat_neg, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}), z, x) return z end @@ -130,7 +130,7 @@ end function transpose(x::ArbMatrix) z = similar(x, ncols(x), nrows(x)) - ccall((:arb_mat_transpose, libarb), Nothing, + ccall((:arb_mat_transpose, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}), z, x) return z end @@ -144,7 +144,7 @@ end function +(x::ArbMatrix, y::ArbMatrix) check_parent(x, y) z = similar(x) - ccall((:arb_mat_add, libarb), Nothing, + ccall((:arb_mat_add, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Ref{ArbMatrix}, Int), z, x, y, precision(parent(x))) return z @@ -153,7 +153,7 @@ end function -(x::ArbMatrix, y::ArbMatrix) check_parent(x, y) z = similar(x) - ccall((:arb_mat_sub, libarb), Nothing, + ccall((:arb_mat_sub, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Ref{ArbMatrix}, Int), z, x, y, precision(parent(x))) return z @@ -162,7 +162,7 @@ end function *(x::ArbMatrix, y::ArbMatrix) ncols(x) != nrows(y) && error("Matrices have wrong dimensions") z = similar(x, nrows(x), ncols(y)) - ccall((:arb_mat_mul, libarb), Nothing, + ccall((:arb_mat_mul, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Ref{ArbMatrix}, Int), z, x, y, precision(base_ring(x))) return z @@ -177,7 +177,7 @@ end function ^(x::ArbMatrix, y::UInt) nrows(x) != ncols(x) && error("Matrix must be square") z = similar(x) - ccall((:arb_mat_pow_ui, libarb), Nothing, + ccall((:arb_mat_pow_ui, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, UInt, Int), z, x, y, precision(base_ring(x))) return z @@ -185,7 +185,7 @@ end function *(x::ArbMatrix, y::Int) z = similar(x) - ccall((:arb_mat_scalar_mul_si, libarb), Nothing, + ccall((:arb_mat_scalar_mul_si, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Int, Int), z, x, y, precision(base_ring(x))) return z @@ -199,7 +199,7 @@ end function *(x::ArbMatrix, y::ZZRingElem) z = similar(x) - ccall((:arb_mat_scalar_mul_fmpz, libarb), Nothing, + ccall((:arb_mat_scalar_mul_fmpz, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Ref{ZZRingElem}, Int), z, x, y, precision(base_ring(x))) return z @@ -209,7 +209,7 @@ end function *(x::ArbMatrix, y::ArbFieldElem) z = similar(x) - ccall((:arb_mat_scalar_mul_arb, libarb), Nothing, + ccall((:arb_mat_scalar_mul_arb, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Ref{ArbFieldElem}, Int), z, x, y, precision(base_ring(x))) return z @@ -281,7 +281,7 @@ end function ldexp(x::ArbMatrix, y::Int) z = similar(x) - ccall((:arb_mat_scalar_mul_2exp_si, libarb), Nothing, + ccall((:arb_mat_scalar_mul_2exp_si, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Int), z, x, y) return z end @@ -299,7 +299,7 @@ Return `true` if the matrices of balls $x$ and $y$ are precisely equal, i.e. if all matrix entries have the same midpoints and radii. """ function isequal(x::ArbMatrix, y::ArbMatrix) - r = ccall((:arb_mat_equal, libarb), Cint, + r = ccall((:arb_mat_equal, libflint), Cint, (Ref{ArbMatrix}, Ref{ArbMatrix}), x, y) return Bool(r) end @@ -307,12 +307,12 @@ end function ==(x::ArbMatrix, y::ArbMatrix) fl = check_parent(x, y, false) !fl && return false - r = ccall((:arb_mat_eq, libarb), Cint, (Ref{ArbMatrix}, Ref{ArbMatrix}), x, y) + r = ccall((:arb_mat_eq, libflint), Cint, (Ref{ArbMatrix}, Ref{ArbMatrix}), x, y) return Bool(r) end function !=(x::ArbMatrix, y::ArbMatrix) - r = ccall((:arb_mat_ne, libarb), Cint, (Ref{ArbMatrix}, Ref{ArbMatrix}), x, y) + r = ccall((:arb_mat_ne, libflint), Cint, (Ref{ArbMatrix}, Ref{ArbMatrix}), x, y) return Bool(r) end @@ -323,7 +323,7 @@ Returns `true` if all entries of $x$ overlap with the corresponding entry of $y$, otherwise return `false`. """ function overlaps(x::ArbMatrix, y::ArbMatrix) - r = ccall((:arb_mat_overlaps, libarb), Cint, + r = ccall((:arb_mat_overlaps, libflint), Cint, (Ref{ArbMatrix}, Ref{ArbMatrix}), x, y) return Bool(r) end @@ -335,7 +335,7 @@ Returns `true` if all entries of $x$ contain the corresponding entry of $y$, otherwise return `false`. """ function contains(x::ArbMatrix, y::ArbMatrix) - r = ccall((:arb_mat_contains, libarb), Cint, + r = ccall((:arb_mat_contains, libflint), Cint, (Ref{ArbMatrix}, Ref{ArbMatrix}), x, y) return Bool(r) end @@ -353,7 +353,7 @@ Returns `true` if all entries of $x$ contain the corresponding entry of $y$, otherwise return `false`. """ function contains(x::ArbMatrix, y::ZZMatrix) - r = ccall((:arb_mat_contains_fmpz_mat, libarb), Cint, + r = ccall((:arb_mat_contains_fmpz_mat, libflint), Cint, (Ref{ArbMatrix}, Ref{ZZMatrix}), x, y) return Bool(r) end @@ -366,7 +366,7 @@ Returns `true` if all entries of $x$ contain the corresponding entry of $y$, otherwise return `false`. """ function contains(x::ArbMatrix, y::QQMatrix) - r = ccall((:arb_mat_contains_fmpq_mat, libarb), Cint, + r = ccall((:arb_mat_contains_fmpq_mat, libflint), Cint, (Ref{ArbMatrix}, Ref{QQMatrix}), x, y) return Bool(r) end @@ -405,7 +405,7 @@ end function is_invertible_with_inverse(x::ArbMatrix) ncols(x) != nrows(x) && return false, x z = similar(x) - r = ccall((:arb_mat_inv, libarb), Cint, + r = ccall((:arb_mat_inv, libflint), Cint, (Ref{ArbMatrix}, Ref{ArbMatrix}, Int), z, x, precision(base_ring(x))) return Bool(r), z end @@ -430,7 +430,7 @@ end function divexact(x::ArbMatrix, y::Int; check::Bool=true) y == 0 && throw(DivideError()) z = similar(x) - ccall((:arb_mat_scalar_div_si, libarb), Nothing, + ccall((:arb_mat_scalar_div_si, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Int, Int), z, x, y, precision(base_ring(x))) return z @@ -438,7 +438,7 @@ end function divexact(x::ArbMatrix, y::ZZRingElem; check::Bool=true) z = similar(x) - ccall((:arb_mat_scalar_div_fmpz, libarb), Nothing, + ccall((:arb_mat_scalar_div_fmpz, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Ref{ZZRingElem}, Int), z, x, y, precision(base_ring(x))) return z @@ -446,7 +446,7 @@ end function divexact(x::ArbMatrix, y::ArbFieldElem; check::Bool=true) z = similar(x) - ccall((:arb_mat_scalar_div_arb, libarb), Nothing, + ccall((:arb_mat_scalar_div_arb, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Ref{ArbFieldElem}, Int), z, x, y, precision(base_ring(x))) return z @@ -461,7 +461,7 @@ end function charpoly(x::ArbPolyRing, y::ArbMatrix) base_ring(y) != base_ring(x) && error("Base rings must coincide") z = x() - ccall((:arb_mat_charpoly, libarb), Nothing, + ccall((:arb_mat_charpoly, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbMatrix}, Int), z, y, precision(base_ring(y))) return z end @@ -475,7 +475,7 @@ end function det(x::ArbMatrix) ncols(x) != nrows(x) && error("Matrix must be square") z = base_ring(x)() - ccall((:arb_mat_det, libarb), Nothing, + ccall((:arb_mat_det, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbMatrix}, Int), z, x, precision(base_ring(x))) return z end @@ -489,7 +489,7 @@ end function Base.exp(x::ArbMatrix) ncols(x) != nrows(x) && error("Matrix must be square") z = similar(x) - ccall((:arb_mat_exp, libarb), Nothing, + ccall((:arb_mat_exp, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Int), z, x, precision(base_ring(x))) return z end @@ -504,7 +504,7 @@ function cholesky(x::ArbMatrix) ncols(x) != nrows(x) && error("Matrix must be square") z = similar(x, nrows(x), ncols(x)) p = precision(base_ring(x)) - fl = ccall((:arb_mat_cho, libarb), Cint, (Ref{ArbMatrix}, Ref{ArbMatrix}, Int), z, x, p) + fl = ccall((:arb_mat_cho, libflint), Cint, (Ref{ArbMatrix}, Ref{ArbMatrix}, Int), z, x, p) fl == 0 && error("Matrix is not positive definite") return z end @@ -512,7 +512,7 @@ end function lu!(P::Generic.Perm, x::ArbMatrix) parent(P).n != nrows(x) && error("Permutation does not match matrix") P.d .-= 1 - r = ccall((:arb_mat_lu, libarb), Cint, + r = ccall((:arb_mat_lu, libflint), Cint, (Ptr{Int}, Ref{ArbMatrix}, Ref{ArbMatrix}, Int), P.d, x, x, precision(base_ring(x))) r == 0 && error("Could not find $(nrows(x)) invertible pivot elements") @@ -522,7 +522,7 @@ function lu!(P::Generic.Perm, x::ArbMatrix) end function _solve!(z::ArbMatrix, x::ArbMatrix, y::ArbMatrix) - r = ccall((:arb_mat_solve, libarb), Cint, + r = ccall((:arb_mat_solve, libflint), Cint, (Ref{ArbMatrix}, Ref{ArbMatrix}, Ref{ArbMatrix}, Int), z, x, y, precision(base_ring(x))) r == 0 && error("Matrix cannot be inverted numerically") @@ -531,7 +531,7 @@ end function _solve_lu_precomp!(z::ArbMatrix, P::Generic.Perm, LU::ArbMatrix, y::ArbMatrix) Q = inv(P) - ccall((:arb_mat_solve_lu_precomp, libarb), Nothing, + ccall((:arb_mat_solve_lu_precomp, libflint), Nothing, (Ref{ArbMatrix}, Ptr{Int}, Ref{ArbMatrix}, Ref{ArbMatrix}, Int), z, Q.d .- 1, LU, y, precision(base_ring(LU))) nothing @@ -545,7 +545,7 @@ function _solve_lu_precomp(P::Generic.Perm, LU::ArbMatrix, y::ArbMatrix) end function _solve_cholesky_precomp!(z::ArbMatrix, cho::ArbMatrix, y::ArbMatrix) - ccall((:arb_mat_solve_cho_precomp, libarb), Nothing, + ccall((:arb_mat_solve_cho_precomp, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Ref{ArbMatrix}, Int), z, cho, y, precision(base_ring(cho))) nothing @@ -566,7 +566,7 @@ function Solve._can_solve_internal_no_check(A::ArbMatrix, b::ArbMatrix, task::Sy end x = similar(A, ncols(A), ncols(b)) - fl = ccall((:arb_mat_solve, libarb), Cint, + fl = ccall((:arb_mat_solve, libflint), Cint, (Ref{ArbMatrix}, Ref{ArbMatrix}, Ref{ArbMatrix}, Int), x, A, b, precision(base_ring(A))) fl == 0 && error("Matrix cannot be inverted numerically") @@ -598,7 +598,7 @@ function Solve._init_reduce(C::Solve.SolveCtx{ArbFieldElem}) P = Generic.Perm(nrows(C)) x = similar(A, nrows(A), ncols(A)) P.d .-= 1 - fl = ccall((:arb_mat_lu, libarb), Cint, + fl = ccall((:arb_mat_lu, libflint), Cint, (Ptr{Int}, Ref{ArbMatrix}, Ref{ArbMatrix}, Int), P.d, x, A, precision(base_ring(A))) fl == 0 && error("Could not find $(nrows(x)) invertible pivot elements") @@ -621,7 +621,7 @@ function Solve._init_reduce_transpose(C::Solve.SolveCtx{ArbFieldElem}) P = Generic.Perm(nrows(C)) x = similar(A, nrows(A), ncols(A)) P.d .-= 1 - fl = ccall((:arb_mat_lu, libarb), Cint, + fl = ccall((:arb_mat_lu, libflint), Cint, (Ptr{Int}, Ref{ArbMatrix}, Ref{ArbMatrix}, Int), P.d, x, A, precision(base_ring(A))) fl == 0 && error("Could not find $(nrows(x)) invertible pivot elements") @@ -644,7 +644,7 @@ function Solve._can_solve_internal_no_check(C::Solve.SolveCtx{ArbFieldElem}, b:: end x = similar(b, ncols(C), ncols(b)) - ccall((:arb_mat_solve_lu_precomp, libarb), Nothing, + ccall((:arb_mat_solve_lu_precomp, libflint), Nothing, (Ref{ArbMatrix}, Ptr{Int}, Ref{ArbMatrix}, Ref{ArbMatrix}, Int), x, inv(p).d .- 1, LU, b, precision(base_ring(LU))) @@ -678,7 +678,7 @@ function swap_rows(x::ArbMatrix, i::Int, j::Int) end function swap_rows!(x::ArbMatrix, i::Int, j::Int) - ccall((:arb_mat_swap_rows, libarb), Nothing, + ccall((:arb_mat_swap_rows, libflint), Nothing, (Ref{ArbMatrix}, Ptr{Nothing}, Int, Int), x, C_NULL, i - 1, j - 1) end @@ -698,13 +698,13 @@ bound for the infinity norm for every matrix in $x$ function bound_inf_norm(x::ArbMatrix) z = ArbFieldElem() GC.@preserve x z begin - t = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (Ref{ArbFieldElem}, ), z) - ccall((:arb_mat_bound_inf_norm, libarb), Nothing, + t = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (Ref{ArbFieldElem}, ), z) + ccall((:arb_mat_bound_inf_norm, libflint), Nothing, (Ptr{mag_struct}, Ref{ArbMatrix}), t, x) - s = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (Ref{ArbFieldElem}, ), z) - ccall((:arf_set_mag, libarb), Nothing, + s = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ref{ArbFieldElem}, ), z) + ccall((:arf_set_mag, libflint), Nothing, (Ptr{arf_struct}, Ptr{mag_struct}), s, t) - ccall((:mag_zero, libarb), Nothing, + ccall((:mag_zero, libflint), Nothing, (Ptr{mag_struct},), t) end return base_ring(x)(z) @@ -720,7 +720,7 @@ for (s,f) in (("add!","arb_mat_add"), ("mul!","arb_mat_mul"), ("sub!","arb_mat_sub")) @eval begin function ($(Symbol(s)))(z::ArbMatrix, x::ArbMatrix, y::ArbMatrix) - ccall(($f, libarb), Nothing, + ccall(($f, libflint), Nothing, (Ref{ArbMatrix}, Ref{ArbMatrix}, Ref{ArbMatrix}, Int), z, x, y, precision(base_ring(x))) return z @@ -842,7 +842,7 @@ function identity_matrix(R::ArbField, n::Int) error("dimension must not be negative") end z = ArbMatrix(n, n) - ccall((:arb_mat_one, libarb), Nothing, (Ref{ArbMatrix}, ), z) + ccall((:arb_mat_one, libflint), Nothing, (Ref{ArbMatrix}, ), z) z.base_ring = R return z end diff --git a/src/arb/arb_poly.jl b/src/arb/arb_poly.jl index 4930cf913..a8bf060f2 100644 --- a/src/arb/arb_poly.jl +++ b/src/arb/arb_poly.jl @@ -16,11 +16,11 @@ elem_type(::Type{ArbPolyRing}) = ArbPolyRingElem dense_poly_type(::Type{ArbFieldElem}) = ArbPolyRingElem -length(x::ArbPolyRingElem) = ccall((:arb_poly_length, libarb), Int, +length(x::ArbPolyRingElem) = ccall((:arb_poly_length, libflint), Int, (Ref{ArbPolyRingElem},), x) function set_length!(x::ArbPolyRingElem, n::Int) - ccall((:_arb_poly_set_length, libarb), Nothing, + ccall((:_arb_poly_set_length, libflint), Nothing, (Ref{ArbPolyRingElem}, Int), x, n) return x end @@ -30,7 +30,7 @@ degree(x::ArbPolyRingElem) = length(x) - 1 function coeff(a::ArbPolyRingElem, n::Int) n < 0 && throw(DomainError(n, "Index must be non-negative")) t = parent(a).base_ring() - ccall((:arb_poly_get_coeff_arb, libarb), Nothing, + ccall((:arb_poly_get_coeff_arb, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbPolyRingElem}, Int), t, a, n) return t end @@ -41,7 +41,7 @@ one(a::ArbPolyRing) = a(1) function gen(a::ArbPolyRing) z = ArbPolyRingElem() - ccall((:arb_poly_set_coeff_si, libarb), Nothing, + ccall((:arb_poly_set_coeff_si, libflint), Nothing, (Ref{ArbPolyRingElem}, Int, Int), z, 1, 1) z.parent = a return z @@ -114,7 +114,7 @@ end ############################################################################### function isequal(x::ArbPolyRingElem, y::ArbPolyRingElem) - return ccall((:arb_poly_equal, libarb), Bool, + return ccall((:arb_poly_equal, libflint), Bool, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}), x, y) end @@ -125,7 +125,7 @@ Return `true` if the coefficient balls of $x$ overlap the coefficient balls of $y$, otherwise return `false`. """ function overlaps(x::ArbPolyRingElem, y::ArbPolyRingElem) - return ccall((:arb_poly_overlaps, libarb), Bool, + return ccall((:arb_poly_overlaps, libflint), Bool, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}), x, y) end @@ -136,7 +136,7 @@ Return `true` if the coefficient balls of $x$ contain the corresponding coefficient balls of $y$, otherwise return `false`. """ function contains(x::ArbPolyRingElem, y::ArbPolyRingElem) - return ccall((:arb_poly_contains, libarb), Bool, + return ccall((:arb_poly_contains, libflint), Bool, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}), x, y) end @@ -147,7 +147,7 @@ Return `true` if the coefficient balls of $x$ contain the corresponding exact coefficients of $y$, otherwise return `false`. """ function contains(x::ArbPolyRingElem, y::ZZPolyRingElem) - return ccall((:arb_poly_contains_fmpz_poly, libarb), Bool, + return ccall((:arb_poly_contains_fmpz_poly, libflint), Bool, (Ref{ArbPolyRingElem}, Ref{ZZPolyRingElem}), x, y) end @@ -158,7 +158,7 @@ Return `true` if the coefficient balls of $x$ contain the corresponding exact coefficients of $y$, otherwise return `false`. """ function contains(x::ArbPolyRingElem, y::QQPolyRingElem) - return ccall((:arb_poly_contains_fmpq_poly, libarb), Bool, + return ccall((:arb_poly_contains_fmpq_poly, libflint), Bool, (Ref{ArbPolyRingElem}, Ref{QQPolyRingElem}), x, y) end @@ -192,7 +192,7 @@ In the former case, $z$ is set to the integer polynomial. """ function unique_integer(x::ArbPolyRingElem) z = ZZPolyRing(ZZ, var(parent(x)))() - unique = ccall((:arb_poly_get_unique_fmpz_poly, libarb), Int, + unique = ccall((:arb_poly_get_unique_fmpz_poly, libflint), Int, (Ref{ZZPolyRingElem}, Ref{ArbPolyRingElem}), z, x) return (unique != 0, z) end @@ -206,7 +206,7 @@ end function shift_left(x::ArbPolyRingElem, len::Int) len < 0 && throw(DomainError(len, "Shift must be non-negative")) z = parent(x)() - ccall((:arb_poly_shift_left, libarb), Nothing, + ccall((:arb_poly_shift_left, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, len) return z end @@ -214,7 +214,7 @@ end function shift_right(x::ArbPolyRingElem, len::Int) len < 0 && throw(DomainError(len, "Shift must be non-negative")) z = parent(x)() - ccall((:arb_poly_shift_right, libarb), Nothing, + ccall((:arb_poly_shift_right, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, len) return z end @@ -227,7 +227,7 @@ end function -(x::ArbPolyRingElem) z = parent(x)() - ccall((:arb_poly_neg, libarb), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}), z, x) + ccall((:arb_poly_neg, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}), z, x) return z end @@ -239,7 +239,7 @@ end function +(x::ArbPolyRingElem, y::ArbPolyRingElem) z = parent(x)() - ccall((:arb_poly_add, libarb), Nothing, + ccall((:arb_poly_add, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, y, precision(parent(x))) return z @@ -247,7 +247,7 @@ end function *(x::ArbPolyRingElem, y::ArbPolyRingElem) z = parent(x)() - ccall((:arb_poly_mul, libarb), Nothing, + ccall((:arb_poly_mul, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, y, precision(parent(x))) return z @@ -255,7 +255,7 @@ end function -(x::ArbPolyRingElem, y::ArbPolyRingElem) z = parent(x)() - ccall((:arb_poly_sub, libarb), Nothing, + ccall((:arb_poly_sub, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, y, precision(parent(x))) return z @@ -264,7 +264,7 @@ end function ^(x::ArbPolyRingElem, y::Int) y < 0 && throw(DomainError(y, "Exponent must be non-negative")) z = parent(x)() - ccall((:arb_poly_pow_ui, libarb), Nothing, + ccall((:arb_poly_pow_ui, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, UInt, Int), z, x, y, precision(parent(x))) return z @@ -320,7 +320,7 @@ function Base.divrem(x::ArbPolyRingElem, y::ArbPolyRingElem) iszero(y) && throw(DivideError()) q = parent(x)() r = parent(x)() - if (ccall((:arb_poly_divrem, libarb), Int, + if (ccall((:arb_poly_divrem, libflint), Int, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), q, r, x, y, precision(parent(x))) == 1) return (q, r) @@ -350,7 +350,7 @@ function truncate(a::ArbPolyRingElem, n::Int) end # todo: implement set_trunc in ArbFieldElem z = deepcopy(a) - ccall((:arb_poly_truncate, libarb), Nothing, + ccall((:arb_poly_truncate, libflint), Nothing, (Ref{ArbPolyRingElem}, Int), z, n) return z end @@ -358,7 +358,7 @@ end function mullow(x::ArbPolyRingElem, y::ArbPolyRingElem, n::Int) n < 0 && throw(DomainError(n, "Index must be non-negative")) z = parent(x)() - ccall((:arb_poly_mullow, libarb), Nothing, + ccall((:arb_poly_mullow, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int, Int), z, x, y, n, precision(parent(x))) return z @@ -373,7 +373,7 @@ end #function reverse(x::ArbPolyRingElem, len::Int) # len < 0 && throw(DomainError()) # z = parent(x)() -# ccall((:arb_poly_reverse, libarb), Nothing, +# ccall((:arb_poly_reverse, libflint), Nothing, # (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, len) # return z #end @@ -386,7 +386,7 @@ end function evaluate(x::ArbPolyRingElem, y::ArbFieldElem) z = parent(y)() - ccall((:arb_poly_evaluate, libarb), Nothing, + ccall((:arb_poly_evaluate, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbPolyRingElem}, Ref{ArbFieldElem}, Int), z, x, y, precision(parent(y))) return z @@ -394,7 +394,7 @@ end function evaluate(x::ArbPolyRingElem, y::AcbFieldElem) z = parent(y)() - ccall((:arb_poly_evaluate_acb, libarb), Nothing, + ccall((:arb_poly_evaluate_acb, libflint), Nothing, (Ref{AcbFieldElem}, Ref{ArbPolyRingElem}, Ref{AcbFieldElem}, Int), z, x, y, precision(parent(y))) return z @@ -415,7 +415,7 @@ its derivative evaluated at $y$. function evaluate2(x::ArbPolyRingElem, y::ArbFieldElem) z = parent(y)() w = parent(y)() - ccall((:arb_poly_evaluate2, libarb), Nothing, + ccall((:arb_poly_evaluate2, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbPolyRingElem}, Ref{ArbFieldElem}, Int), z, w, x, y, precision(parent(y))) return z, w @@ -424,7 +424,7 @@ end function evaluate2(x::ArbPolyRingElem, y::AcbFieldElem) z = parent(y)() w = parent(y)() - ccall((:arb_poly_evaluate2_acb, libarb), Nothing, + ccall((:arb_poly_evaluate2_acb, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{ArbPolyRingElem}, Ref{AcbFieldElem}, Int), z, w, x, y, precision(parent(y))) return z, w @@ -440,7 +440,7 @@ evaluate2(x::ArbPolyRingElem, y::Any) = evaluate2(x, base_ring(parent(x))(y)) function AbstractAlgebra._compose_right(x::ArbPolyRingElem, y::ArbPolyRingElem) z = parent(x)() - ccall((:arb_poly_compose, libarb), Nothing, + ccall((:arb_poly_compose, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, y, precision(parent(x))) return z @@ -454,14 +454,14 @@ end function derivative(x::ArbPolyRingElem) z = parent(x)() - ccall((:arb_poly_derivative, libarb), Nothing, + ccall((:arb_poly_derivative, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, precision(parent(x))) return z end function integral(x::ArbPolyRingElem) z = parent(x)() - ccall((:arb_poly_integral, libarb), Nothing, + ccall((:arb_poly_integral, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, precision(parent(x))) return z end @@ -473,9 +473,9 @@ end ############################################################################### function arb_vec(b::Vector{ArbFieldElem}) - v = ccall((:_arb_vec_init, libarb), Ptr{arb_struct}, (Int,), length(b)) + v = ccall((:_arb_vec_init, libflint), Ptr{arb_struct}, (Int,), length(b)) for i=1:length(b) - ccall((:arb_set, libarb), Nothing, (Ptr{arb_struct}, Ref{ArbFieldElem}), + ccall((:arb_set, libflint), Nothing, (Ptr{arb_struct}, Ref{ArbFieldElem}), v + (i-1)*sizeof(arb_struct), b[i]) end return v @@ -485,7 +485,7 @@ function array(R::ArbField, v::Ptr{arb_struct}, n::Int) r = Vector{ArbFieldElem}(undef, n) for i=1:n r[i] = R() - ccall((:arb_set, libarb), Nothing, (Ref{ArbFieldElem}, Ptr{arb_struct}), + ccall((:arb_set, libflint), Nothing, (Ref{ArbFieldElem}, Ptr{arb_struct}), r[i], v + (i-1)*sizeof(arb_struct)) end return r @@ -499,7 +499,7 @@ Construct a polynomial in the given polynomial ring from a list of its roots. function from_roots(R::ArbPolyRing, b::Vector{ArbFieldElem}) z = R() tmp = arb_vec(b) - ccall((:arb_poly_product_roots, libarb), Nothing, + ccall((:arb_poly_product_roots, libflint), Nothing, (Ref{ArbPolyRingElem}, Ptr{arb_struct}, Int, Int), z, tmp, length(b), precision(R)) arb_vec_clear(tmp, length(b)) return z @@ -511,7 +511,7 @@ end function evaluate_fast(x::ArbPolyRingElem, b::Vector{ArbFieldElem}) tmp = arb_vec(b) - ccall((:arb_poly_evaluate_vec_fast, libarb), Nothing, + ccall((:arb_poly_evaluate_vec_fast, libflint), Nothing, (Ptr{arb_struct}, Ref{ArbPolyRingElem}, Ptr{arb_struct}, Int, Int), tmp, x, tmp, length(b), precision(parent(x))) res = array(base_ring(parent(x)), tmp, length(b)) @@ -524,7 +524,7 @@ function interpolate_newton(R::ArbPolyRing, xs::Vector{ArbFieldElem}, ys::Vector z = R() xsv = arb_vec(xs) ysv = arb_vec(ys) - ccall((:arb_poly_interpolate_newton, libarb), Nothing, + ccall((:arb_poly_interpolate_newton, libflint), Nothing, (Ref{ArbPolyRingElem}, Ptr{arb_struct}, Ptr{arb_struct}, Int, Int), z, xsv, ysv, length(xs), precision(R)) arb_vec_clear(xsv, length(xs)) @@ -537,7 +537,7 @@ function interpolate_barycentric(R::ArbPolyRing, xs::Vector{ArbFieldElem}, ys::V z = R() xsv = arb_vec(xs) ysv = arb_vec(ys) - ccall((:arb_poly_interpolate_barycentric, libarb), Nothing, + ccall((:arb_poly_interpolate_barycentric, libflint), Nothing, (Ref{ArbPolyRingElem}, Ptr{arb_struct}, Ptr{arb_struct}, Int, Int), z, xsv, ysv, length(xs), precision(R)) arb_vec_clear(xsv, length(xs)) @@ -550,7 +550,7 @@ function interpolate_fast(R::ArbPolyRing, xs::Vector{ArbFieldElem}, ys::Vector{A z = R() xsv = arb_vec(xs) ysv = arb_vec(ys) - ccall((:arb_poly_interpolate_fast, libarb), Nothing, + ccall((:arb_poly_interpolate_fast, libflint), Nothing, (Ref{ArbPolyRingElem}, Ptr{arb_struct}, Ptr{arb_struct}, Int, Int), z, xsv, ysv, length(xs), precision(R)) arb_vec_clear(xsv, length(xs)) @@ -583,14 +583,14 @@ function roots_upper_bound(x::ArbPolyRingElem) z = base_ring(x)() p = precision(base_ring(x)) GC.@preserve x z begin - t = ccall((:arb_rad_ptr, libarb), Ptr{mag_struct}, (Ref{ArbFieldElem}, ), z) - ccall((:arb_poly_root_bound_fujiwara, libarb), Nothing, + t = ccall((:arb_rad_ptr, libflint), Ptr{mag_struct}, (Ref{ArbFieldElem}, ), z) + ccall((:arb_poly_root_bound_fujiwara, libflint), Nothing, (Ptr{mag_struct}, Ref{ArbPolyRingElem}), t, x) - s = ccall((:arb_mid_ptr, libarb), Ptr{arf_struct}, (Ref{ArbFieldElem}, ), z) - ccall((:arf_set_mag, libarb), Nothing, (Ptr{arf_struct}, Ptr{mag_struct}), s, t) - ccall((:arf_set_round, libarb), Nothing, + s = ccall((:arb_mid_ptr, libflint), Ptr{arf_struct}, (Ref{ArbFieldElem}, ), z) + ccall((:arf_set_mag, libflint), Nothing, (Ptr{arf_struct}, Ptr{mag_struct}), s, t) + ccall((:arf_set_round, libflint), Nothing, (Ptr{arf_struct}, Ptr{arf_struct}, Int, Cint), s, s, p, ARB_RND_CEIL) - ccall((:mag_zero, libarb), Nothing, (Ptr{mag_struct},), t) + ccall((:mag_zero, libflint), Nothing, (Ptr{mag_struct},), t) end return z end @@ -602,45 +602,45 @@ end ############################################################################### function zero!(z::ArbPolyRingElem) - ccall((:arb_poly_zero, libarb), Nothing, + ccall((:arb_poly_zero, libflint), Nothing, (Ref{ArbPolyRingElem}, ), z) return z end function fit!(z::ArbPolyRingElem, n::Int) - ccall((:arb_poly_fit_length, libarb), Nothing, + ccall((:arb_poly_fit_length, libflint), Nothing, (Ref{ArbPolyRingElem}, Int), z, n) return nothing end function setcoeff!(z::ArbPolyRingElem, n::Int, x::ZZRingElem) - ccall((:arb_poly_set_coeff_fmpz, libarb), Nothing, + ccall((:arb_poly_set_coeff_fmpz, libflint), Nothing, (Ref{ArbPolyRingElem}, Int, Ref{ZZRingElem}), z, n, x) return z end function setcoeff!(z::ArbPolyRingElem, n::Int, x::ArbFieldElem) - ccall((:arb_poly_set_coeff_arb, libarb), Nothing, + ccall((:arb_poly_set_coeff_arb, libflint), Nothing, (Ref{ArbPolyRingElem}, Int, Ref{ArbFieldElem}), z, n, x) return z end function mul!(z::ArbPolyRingElem, x::ArbPolyRingElem, y::ArbPolyRingElem) - ccall((:arb_poly_mul, libarb), Nothing, + ccall((:arb_poly_mul, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, y, precision(parent(z))) return z end function addeq!(z::ArbPolyRingElem, x::ArbPolyRingElem) - ccall((:arb_poly_add, libarb), Nothing, + ccall((:arb_poly_add, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, z, x, precision(parent(z))) return z end function add!(z::ArbPolyRingElem, x::ArbPolyRingElem, y::ArbPolyRingElem) - ccall((:arb_poly_add, libarb), Nothing, + ccall((:arb_poly_add, libflint), Nothing, (Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int), z, x, y, precision(parent(z))) return z diff --git a/src/calcium/CalciumTypes.jl b/src/calcium/CalciumTypes.jl index 0a337c885..9372182a6 100644 --- a/src/calcium/CalciumTypes.jl +++ b/src/calcium/CalciumTypes.jl @@ -108,7 +108,7 @@ mutable struct QQBarFieldElem <: FieldElem function QQBarFieldElem() z = new() - ccall((:qqbar_init, libcalcium), Nothing, (Ref{QQBarFieldElem}, ), z) + ccall((:qqbar_init, libflint), Nothing, (Ref{QQBarFieldElem}, ), z) finalizer(_qqbar_clear_fn, z) return z end @@ -116,7 +116,7 @@ mutable struct QQBarFieldElem <: FieldElem end function _qqbar_clear_fn(a::QQBarFieldElem) - ccall((:qqbar_clear, libcalcium), Nothing, (Ref{QQBarFieldElem},), a) + ccall((:qqbar_clear, libflint), Nothing, (Ref{QQBarFieldElem},), a) end ################################################################################ @@ -166,14 +166,14 @@ ca_ctx_options = [ function CalciumField(; extended::Bool=false, options::Dict{Symbol,Int}=Dict{Symbol,Int}()) C = new() - ccall((:ca_ctx_init, libcalcium), Nothing, (Ref{CalciumField}, ), C) + ccall((:ca_ctx_init, libflint), Nothing, (Ref{CalciumField}, ), C) finalizer(_CalciumField_clear_fn, C) C.extended = extended for (opt, value) in options i = findfirst(isequal(opt), ca_ctx_options) (i === nothing) && error("unknown option ", opt) - ccall((:ca_ctx_set_option, libcalcium), Nothing, (Ref{CalciumField}, Int, Int), C, i - 1, value) + ccall((:ca_ctx_set_option, libflint), Nothing, (Ref{CalciumField}, Int, Int), C, i - 1, value) end C.refcount = 1 @@ -184,7 +184,7 @@ end function options(C::CalciumField) d = Dict{Symbol,Int}() for i=1:length(ca_ctx_options) - d[ca_ctx_options[i]] = ccall((:ca_ctx_get_option, libcalcium), Int, (Ref{CalciumField}, Int), C, i - 1) + d[ca_ctx_options[i]] = ccall((:ca_ctx_get_option, libflint), Int, (Ref{CalciumField}, Int), C, i - 1) end return d end @@ -192,7 +192,7 @@ end function decrement_refcount(C::CalciumField) C.refcount -= 1 if C.refcount == 0 - ccall((:ca_ctx_clear, libcalcium), Nothing, (Ref{CalciumField},), C) + ccall((:ca_ctx_clear, libflint), Nothing, (Ref{CalciumField},), C) end end @@ -212,7 +212,7 @@ mutable struct CalciumFieldElem <: FieldElem function CalciumFieldElem(ctx::CalciumField) z = new() - ccall((:ca_init, libcalcium), Nothing, + ccall((:ca_init, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), z, ctx) z.parent = ctx z.parent.refcount += 1 @@ -223,7 +223,7 @@ mutable struct CalciumFieldElem <: FieldElem end function _ca_clear_fn(a::CalciumFieldElem) - ccall((:ca_clear, libcalcium), + ccall((:ca_clear, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, a.parent) decrement_refcount(a.parent) end diff --git a/src/calcium/ca.jl b/src/calcium/ca.jl index 48bd3dd41..1f7d4ea15 100644 --- a/src/calcium/ca.jl +++ b/src/calcium/ca.jl @@ -25,7 +25,7 @@ is_domain_type(::Type{CalciumFieldElem}) = true function deepcopy_internal(a::CalciumFieldElem, dict::IdDict) C = a.parent r = C() - ccall((:ca_set, libcalcium), Nothing, + ccall((:ca_set, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) return r end @@ -53,7 +53,7 @@ function same_parent(a::CalciumFieldElem, b::CalciumFieldElem) else C = a.parent r = C() - ccall((:ca_transfer, libcalcium), Nothing, + ccall((:ca_transfer, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a.parent, b, b.parent) check_special(r) @@ -97,7 +97,7 @@ function show(io::IO, C::CalciumField) end function native_string(x::CalciumFieldElem) - cstr = ccall((:ca_get_str, libcalcium), + cstr = ccall((:ca_get_str, libflint), Ptr{UInt8}, (Ref{CalciumFieldElem}, Ref{CalciumField}), x, x.parent) res = unsafe_string(cstr) ccall((:flint_free, libflint), Nothing, (Ptr{UInt8},), cstr) @@ -119,7 +119,7 @@ zero(C::CalciumField) = C() function one(C::CalciumField) z = CalciumFieldElem(C) - ccall((:ca_one, libcalcium), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), z, C) + ccall((:ca_one, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), z, C) return z end @@ -138,15 +138,15 @@ function rand(C::CalciumField; depth::Int, bits::Int, bits = max(bits, 1) if randtype == :null - ccall((:ca_randtest, libcalcium), Nothing, + ccall((:ca_randtest, libflint), Nothing, (Ref{CalciumFieldElem}, Ptr{Cvoid}, Int, Int, Ref{CalciumField}), x, state.ptr, depth, bits, C) elseif randtype == :rational - ccall((:ca_randtest_rational, libcalcium), Nothing, + ccall((:ca_randtest_rational, libflint), Nothing, (Ref{CalciumFieldElem}, Ptr{Cvoid}, Int, Ref{CalciumField}), x, state.ptr, bits, C) elseif randtype == :special - ccall((:ca_randtest_special, libcalcium), Nothing, + ccall((:ca_randtest_special, libflint), Nothing, (Ref{CalciumFieldElem}, Ptr{Cvoid}, Int, Int, Ref{CalciumField}), x, state.ptr, depth, bits, C) else @@ -166,7 +166,7 @@ end function ==(a::CalciumFieldElem, b::CalciumFieldElem) a, b = same_parent(a, b) C = a.parent - t = ccall((:ca_check_equal, libcalcium), Cint, + t = ccall((:ca_check_equal, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), a, b, C) return truth_as_bool(t, :isequal) end @@ -174,7 +174,7 @@ end function isless(a::CalciumFieldElem, b::CalciumFieldElem) a, b = same_parent(a, b) C = a.parent - t = ccall((:ca_check_lt, libcalcium), Cint, + t = ccall((:ca_check_lt, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), a, b, C) return truth_as_bool(t, :isless) end @@ -195,7 +195,7 @@ Return whether `a` is a number, i.e. not an infinity or undefined. """ function is_number(a::CalciumFieldElem) C = a.parent - t = ccall((:ca_check_is_number, libcalcium), Cint, + t = ccall((:ca_check_is_number, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C) return truth_as_bool(t, :is_number) end @@ -207,7 +207,7 @@ Return whether `a` is the number 0. """ function iszero(a::CalciumFieldElem) C = a.parent - t = ccall((:ca_check_is_zero, libcalcium), Cint, + t = ccall((:ca_check_is_zero, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C) return truth_as_bool(t, :iszero) end @@ -219,7 +219,7 @@ Return whether `a` is the number 1. """ function isone(a::CalciumFieldElem) C = a.parent - t = ccall((:ca_check_is_one, libcalcium), Cint, + t = ccall((:ca_check_is_one, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C) return truth_as_bool(t, :isone) end @@ -231,7 +231,7 @@ Return whether `a` is an algebraic number. """ function is_algebraic(a::CalciumFieldElem) C = a.parent - t = ccall((:ca_check_is_algebraic, libcalcium), Cint, + t = ccall((:ca_check_is_algebraic, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C) return truth_as_bool(t, :is_algebraic) end @@ -243,7 +243,7 @@ Return whether `a` is a rational number. """ function is_rational(a::CalciumFieldElem) C = a.parent - t = ccall((:ca_check_is_rational, libcalcium), Cint, + t = ccall((:ca_check_is_rational, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C) return truth_as_bool(t, :is_rational) end @@ -255,7 +255,7 @@ Return whether `a` is an integer. """ function isinteger(a::CalciumFieldElem) C = a.parent - t = ccall((:ca_check_is_integer, libcalcium), Cint, + t = ccall((:ca_check_is_integer, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C) return truth_as_bool(t, :isinteger) end @@ -268,7 +268,7 @@ if `a` is a pure real infinity. """ function isreal(a::CalciumFieldElem) C = a.parent - t = ccall((:ca_check_is_real, libcalcium), Cint, + t = ccall((:ca_check_is_real, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C) return truth_as_bool(t, :isreal) end @@ -281,7 +281,7 @@ if `a` is a pure imaginary infinity. """ function is_imaginary(a::CalciumFieldElem) C = a.parent - t = ccall((:ca_check_is_imaginary, libcalcium), Cint, + t = ccall((:ca_check_is_imaginary, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C) return truth_as_bool(t, :is_imaginary) end @@ -293,7 +293,7 @@ Return whether `a` is the special value *Undefined*. """ function is_undefined(a::CalciumFieldElem) C = a.parent - t = ccall((:ca_check_is_undefined, libcalcium), Cint, + t = ccall((:ca_check_is_undefined, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C) return truth_as_bool(t, :is_undefined) end @@ -305,7 +305,7 @@ Return whether `a` is any infinity (signed or unsigned). """ function isinf(a::CalciumFieldElem) C = a.parent - t = ccall((:ca_check_is_infinity, libcalcium), Cint, + t = ccall((:ca_check_is_infinity, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C) return truth_as_bool(t, :isinf) end @@ -317,7 +317,7 @@ Return whether `a` is unsigned infinity. """ function is_uinf(a::CalciumFieldElem) C = a.parent - t = ccall((:ca_check_is_uinf, libcalcium), Cint, + t = ccall((:ca_check_is_uinf, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C) return truth_as_bool(t, :is_uinf) end @@ -329,7 +329,7 @@ Return whether `a` is any signed infinity. """ function is_signed_inf(a::CalciumFieldElem) C = a.parent - t = ccall((:ca_check_is_signed_inf, libcalcium), Cint, + t = ccall((:ca_check_is_signed_inf, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C) return truth_as_bool(t, :is_signed_inf) end @@ -342,7 +342,7 @@ property and not a mathematical predicate. """ function is_unknown(a::CalciumFieldElem) C = a.parent - t = Bool(ccall((:ca_is_unknown, libcalcium), Cint, + t = Bool(ccall((:ca_is_unknown, libflint), Cint, (Ref{CalciumFieldElem}, Ref{CalciumField}), a, C)) return t end @@ -356,7 +356,7 @@ end function -(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_neg, libcalcium), Nothing, + ccall((:ca_neg, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -372,7 +372,7 @@ function +(a::CalciumFieldElem, b::CalciumFieldElem) a, b = same_parent(a, b) C = a.parent r = C() - ccall((:ca_add, libcalcium), Nothing, + ccall((:ca_add, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -381,7 +381,7 @@ end function -(a::Int, b::CalciumFieldElem) C = b.parent r = C() - ccall((:ca_si_sub, libcalcium), Nothing, + ccall((:ca_si_sub, libflint), Nothing, (Ref{CalciumFieldElem}, Int, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -391,7 +391,7 @@ function *(a::CalciumFieldElem, b::CalciumFieldElem) a, b = same_parent(a, b) C = a.parent r = C() - ccall((:ca_mul, libcalcium), Nothing, + ccall((:ca_mul, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -406,7 +406,7 @@ end function +(a::CalciumFieldElem, b::Int) C = a.parent r = C() - ccall((:ca_add_si, libcalcium), Nothing, + ccall((:ca_add_si, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Int, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -415,7 +415,7 @@ end function +(a::CalciumFieldElem, b::ZZRingElem) C = a.parent r = C() - ccall((:ca_add_fmpz, libcalcium), Nothing, + ccall((:ca_add_fmpz, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{ZZRingElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -424,7 +424,7 @@ end function +(a::CalciumFieldElem, b::QQFieldElem) C = a.parent r = C() - ccall((:ca_add_fmpq, libcalcium), Nothing, + ccall((:ca_add_fmpq, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{QQFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -441,7 +441,7 @@ function -(a::CalciumFieldElem, b::CalciumFieldElem) a, b = same_parent(a, b) C = a.parent r = C() - ccall((:ca_sub, libcalcium), Nothing, + ccall((:ca_sub, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -450,7 +450,7 @@ end function -(a::CalciumFieldElem, b::Int) C = a.parent r = C() - ccall((:ca_sub_si, libcalcium), Nothing, + ccall((:ca_sub_si, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Int, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -459,7 +459,7 @@ end function -(a::CalciumFieldElem, b::ZZRingElem) C = a.parent r = C() - ccall((:ca_sub_fmpz, libcalcium), Nothing, + ccall((:ca_sub_fmpz, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{ZZRingElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -468,7 +468,7 @@ end function -(a::CalciumFieldElem, b::QQFieldElem) C = a.parent r = C() - ccall((:ca_sub_fmpq, libcalcium), Nothing, + ccall((:ca_sub_fmpq, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{QQFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -479,7 +479,7 @@ end function -(a::ZZRingElem, b::CalciumFieldElem) C = b.parent r = C() - ccall((:ca_fmpz_sub, libcalcium), Nothing, + ccall((:ca_fmpz_sub, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{ZZRingElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -488,7 +488,7 @@ end function -(a::QQFieldElem, b::CalciumFieldElem) C = b.parent r = C() - ccall((:ca_fmpq_sub, libcalcium), Nothing, + ccall((:ca_fmpq_sub, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{QQFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -500,7 +500,7 @@ end function *(a::CalciumFieldElem, b::Int) C = a.parent r = C() - ccall((:ca_mul_si, libcalcium), Nothing, + ccall((:ca_mul_si, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Int, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -509,7 +509,7 @@ end function *(a::CalciumFieldElem, b::ZZRingElem) C = a.parent r = C() - ccall((:ca_mul_fmpz, libcalcium), Nothing, + ccall((:ca_mul_fmpz, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{ZZRingElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -518,7 +518,7 @@ end function *(a::CalciumFieldElem, b::QQFieldElem) C = a.parent r = C() - ccall((:ca_mul_fmpq, libcalcium), Nothing, + ccall((:ca_mul_fmpq, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{QQFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -541,7 +541,7 @@ function //(a::CalciumFieldElem, b::CalciumFieldElem) a, b = same_parent(a, b) C = a.parent r = C() - ccall((:ca_div, libcalcium), Nothing, + ccall((:ca_div, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -552,7 +552,7 @@ divexact(a::CalciumFieldElem, b::CalciumFieldElem; check::Bool=true) = a // b function inv(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_inv, libcalcium), Nothing, + ccall((:ca_inv, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -567,7 +567,7 @@ end function //(a::CalciumFieldElem, b::Int) C = a.parent r = C() - ccall((:ca_div_si, libcalcium), Nothing, + ccall((:ca_div_si, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Int, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -576,7 +576,7 @@ end function //(a::CalciumFieldElem, b::ZZRingElem) C = a.parent r = C() - ccall((:ca_div_fmpz, libcalcium), Nothing, + ccall((:ca_div_fmpz, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{ZZRingElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -585,7 +585,7 @@ end function //(a::CalciumFieldElem, b::QQFieldElem) C = a.parent r = C() - ccall((:ca_div_fmpq, libcalcium), Nothing, + ccall((:ca_div_fmpq, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{QQFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -596,7 +596,7 @@ end function //(a::Int, b::CalciumFieldElem) C = b.parent r = C() - ccall((:ca_si_div, libcalcium), Nothing, + ccall((:ca_si_div, libflint), Nothing, (Ref{CalciumFieldElem}, Int, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -605,7 +605,7 @@ end function //(a::ZZRingElem, b::CalciumFieldElem) C = b.parent r = C() - ccall((:ca_fmpz_div, libcalcium), Nothing, + ccall((:ca_fmpz_div, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{ZZRingElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -614,7 +614,7 @@ end function //(a::QQFieldElem, b::CalciumFieldElem) C = b.parent r = C() - ccall((:ca_fmpq_div, libcalcium), Nothing, + ccall((:ca_fmpq_div, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{QQFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -641,7 +641,7 @@ function ^(a::CalciumFieldElem, b::CalciumFieldElem) a, b = same_parent(a, b) C = a.parent r = C() - ccall((:ca_pow, libcalcium), Nothing, + ccall((:ca_pow, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -650,7 +650,7 @@ end function ^(a::CalciumFieldElem, b::Int) C = a.parent r = C() - ccall((:ca_pow_si, libcalcium), Nothing, + ccall((:ca_pow_si, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Int, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -659,7 +659,7 @@ end function ^(a::CalciumFieldElem, b::ZZRingElem) C = a.parent r = C() - ccall((:ca_pow_fmpz, libcalcium), Nothing, + ccall((:ca_pow_fmpz, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{ZZRingElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -668,7 +668,7 @@ end function ^(a::CalciumFieldElem, b::QQFieldElem) C = a.parent r = C() - ccall((:ca_pow_fmpq, libcalcium), Nothing, + ccall((:ca_pow_fmpq, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{QQFieldElem}, Ref{CalciumField}), r, a, b, C) check_special(r) return r @@ -695,7 +695,7 @@ Return the constant $\pi$ as an element of `C`. """ function const_pi(C::CalciumField) r = C() - ccall((:ca_pi, libcalcium), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), r, C) + ccall((:ca_pi, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), r, C) return r end @@ -706,7 +706,7 @@ Return Euler's constant $\gamma$ as an element of `C`. """ function const_euler(C::CalciumField) r = C() - ccall((:ca_euler, libcalcium), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), r, C) + ccall((:ca_euler, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), r, C) return r end @@ -717,7 +717,7 @@ Return the imaginary unit $i$ as an element of `C`. """ function onei(C::CalciumField) r = C() - ccall((:ca_i, libcalcium), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), r, C) + ccall((:ca_i, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), r, C) return r end @@ -729,7 +729,7 @@ This throws an exception if `C` does not allow special values. """ function unsigned_infinity(C::CalciumField) r = C() - ccall((:ca_uinf, libcalcium), Nothing, + ccall((:ca_uinf, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), r, C) check_special(r) return r @@ -743,7 +743,7 @@ This throws an exception if `C` does not allow special values. """ function infinity(C::CalciumField) r = C() - ccall((:ca_pos_inf, libcalcium), Nothing, + ccall((:ca_pos_inf, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), r, C) check_special(r) return r @@ -759,7 +759,7 @@ does not allow special values. function infinity(a::CalciumFieldElem) C = parent(a) r = C() - ccall((:ca_pos_inf, libcalcium), Nothing, + ccall((:ca_pos_inf, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), r, C) r *= a check_special(r) @@ -774,7 +774,7 @@ This throws an exception if `C` does not allow special values. """ function undefined(C::CalciumField) r = C() - ccall((:ca_undefined, libcalcium), Nothing, + ccall((:ca_undefined, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), r, C) check_special(r) return r @@ -788,7 +788,7 @@ This throws an exception if `C` does not allow special values. """ function unknown(C::CalciumField) r = C() - ccall((:ca_unknown, libcalcium), Nothing, + ccall((:ca_unknown, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), r, C) check_special(r) return r @@ -808,7 +808,7 @@ Return the real part of `a`. function real(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_re, libcalcium), Nothing, + ccall((:ca_re, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -822,7 +822,7 @@ Return the imaginary part of `a`. function imag(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_im, libcalcium), Nothing, + ccall((:ca_im, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -836,7 +836,7 @@ Return the complex argument of `a`. function angle(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_arg, libcalcium), Nothing, + ccall((:ca_arg, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -854,7 +854,7 @@ at zero. function csgn(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_csgn, libcalcium), Nothing, + ccall((:ca_csgn, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -870,7 +870,7 @@ extracts the sign when `a` is a signed infinity. function sign(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_sgn, libcalcium), Nothing, + ccall((:ca_sgn, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -884,7 +884,7 @@ Return the absolute value of `a`. function abs(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_abs, libcalcium), Nothing, + ccall((:ca_abs, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -903,13 +903,13 @@ function conj(a::CalciumFieldElem; form::Symbol=:default) C = a.parent r = C() if form == :default - ccall((:ca_conj, libcalcium), Nothing, + ccall((:ca_conj, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :deep - ccall((:ca_conj_deep, libcalcium), Nothing, + ccall((:ca_conj_deep, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :shallow - ccall((:ca_conj_shallow, libcalcium), Nothing, + ccall((:ca_conj_shallow, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) else error("unknown form: ", form) @@ -926,7 +926,7 @@ Return the floor function of `a`. function floor(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_floor, libcalcium), Nothing, + ccall((:ca_floor, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -940,7 +940,7 @@ Return the ceiling function of `a`. function ceil(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_ceil, libcalcium), Nothing, + ccall((:ca_ceil, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -960,7 +960,7 @@ Return the principal square root of `a`. function Base.sqrt(a::CalciumFieldElem; check::Bool=true) C = a.parent r = C() - ccall((:ca_sqrt, libcalcium), Nothing, + ccall((:ca_sqrt, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -974,7 +974,7 @@ Return the exponential function of `a`. function exp(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_exp, libcalcium), Nothing, + ccall((:ca_exp, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -988,7 +988,7 @@ Return the natural logarithm of `a`. function log(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_log, libcalcium), Nothing, + ccall((:ca_log, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -1009,10 +1009,10 @@ function pow(a::CalciumFieldElem, b::Int; form::Symbol=:default) C = a.parent r = C() if form == :default - ccall((:ca_pow_si, libcalcium), Nothing, + ccall((:ca_pow_si, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Int, Ref{CalciumField}), r, a, b, C) elseif form == :arithmetic - ccall((:ca_pow_si_arithmetic, libcalcium), Nothing, + ccall((:ca_pow_si_arithmetic, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Int, Ref{CalciumField}), r, a, b, C) else error("unknown form: ", form) @@ -1036,16 +1036,16 @@ function sin(a::CalciumFieldElem; form::Symbol=:default) C = a.parent r = C() if form == :default - ccall((:ca_sin, libcalcium), Nothing, + ccall((:ca_sin, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :exponential - ccall((:ca_sin_cos_exponential, libcalcium), Nothing, + ccall((:ca_sin_cos_exponential, libflint), Nothing, (Ref{CalciumFieldElem}, Ptr{Nothing}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, C_NULL, a, C) elseif form == :tangent - ccall((:ca_sin_cos_tangent, libcalcium), Nothing, + ccall((:ca_sin_cos_tangent, libflint), Nothing, (Ref{CalciumFieldElem}, Ptr{Nothing}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, C_NULL, a, C) elseif form == :direct - ccall((:ca_sin_cos_direct, libcalcium), Nothing, + ccall((:ca_sin_cos_direct, libflint), Nothing, (Ref{CalciumFieldElem}, Ptr{Nothing}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, C_NULL, a, C) else error("unknown form: ", form) @@ -1069,16 +1069,16 @@ function cos(a::CalciumFieldElem; form::Symbol=:default) C = a.parent r = C() if form == :default - ccall((:ca_cos, libcalcium), Nothing, + ccall((:ca_cos, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :exponential - ccall((:ca_sin_cos_exponential, libcalcium), Nothing, + ccall((:ca_sin_cos_exponential, libflint), Nothing, (Ptr{Nothing}, Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), C_NULL, r, a, C) elseif form == :tangent - ccall((:ca_sin_cos_tangent, libcalcium), Nothing, + ccall((:ca_sin_cos_tangent, libflint), Nothing, (Ptr{Nothing}, Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), C_NULL, r, a, C) elseif form == :direct || form == :sine_cosine - ccall((:ca_sin_cos_direct, libcalcium), Nothing, + ccall((:ca_sin_cos_direct, libflint), Nothing, (Ptr{Nothing}, Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), C_NULL, r, a, C) else error("unknown form: ", form) @@ -1102,16 +1102,16 @@ function tan(a::CalciumFieldElem; form::Symbol=:default) C = a.parent r = C() if form == :default - ccall((:ca_tan, libcalcium), Nothing, + ccall((:ca_tan, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :exponential - ccall((:ca_tan_exponential, libcalcium), Nothing, + ccall((:ca_tan_exponential, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :direct || form == :tangent - ccall((:ca_tan_direct, libcalcium), Nothing, + ccall((:ca_tan_direct, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :sine_cosine - ccall((:ca_tan_sine_cosine, libcalcium), Nothing, + ccall((:ca_tan_sine_cosine, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) else error("unknown form: ", form) @@ -1134,13 +1134,13 @@ function atan(a::CalciumFieldElem; form::Symbol=:default) C = a.parent r = C() if form == :default - ccall((:ca_atan, libcalcium), Nothing, + ccall((:ca_atan, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :logarithm - ccall((:ca_atan_logarithm, libcalcium), Nothing, + ccall((:ca_atan_logarithm, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :direct || form == :arctangent - ccall((:ca_atan_direct, libcalcium), Nothing, + ccall((:ca_atan_direct, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) else error("unknown form: ", form) @@ -1163,13 +1163,13 @@ function asin(a::CalciumFieldElem; form::Symbol=:default) C = a.parent r = C() if form == :default - ccall((:ca_asin, libcalcium), Nothing, + ccall((:ca_asin, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :logarithm - ccall((:ca_asin_logarithm, libcalcium), Nothing, + ccall((:ca_asin_logarithm, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :direct - ccall((:ca_asin_direct, libcalcium), Nothing, + ccall((:ca_asin_direct, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) else error("unknown form: ", form) @@ -1192,13 +1192,13 @@ function acos(a::CalciumFieldElem; form::Symbol=:default) C = a.parent r = C() if form == :default - ccall((:ca_acos, libcalcium), Nothing, + ccall((:ca_acos, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :logarithm - ccall((:ca_acos_logarithm, libcalcium), Nothing, + ccall((:ca_acos_logarithm, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) elseif form == :direct - ccall((:ca_acos_direct, libcalcium), Nothing, + ccall((:ca_acos_direct, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) else error("unknown form: ", form) @@ -1215,7 +1215,7 @@ Return the gamma function of `a`. function gamma(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_gamma, libcalcium), Nothing, + ccall((:ca_gamma, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -1229,7 +1229,7 @@ Return the error function of `a`. function erf(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_erf, libcalcium), Nothing, + ccall((:ca_erf, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -1243,7 +1243,7 @@ Return the imaginary error function of `a`. function erfi(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_erfi, libcalcium), Nothing, + ccall((:ca_erfi, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -1257,7 +1257,7 @@ Return the complementary error function of `a`. function erfc(a::CalciumFieldElem) C = a.parent r = C() - ccall((:ca_erfc, libcalcium), Nothing, + ccall((:ca_erfc, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, a, C) check_special(r) return r @@ -1296,7 +1296,7 @@ heuristic for simplification. function complex_normal_form(a::CalciumFieldElem; deep::Bool=true) C = a.parent r = C() - ccall((:ca_rewrite_complex_normal_form, libcalcium), Nothing, + ccall((:ca_rewrite_complex_normal_form, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Cint, Ref{CalciumField}), r, a, deep, C) check_special(r) return r @@ -1311,7 +1311,7 @@ end function QQFieldElem(a::CalciumFieldElem) C = a.parent res = QQFieldElem() - ok = Bool(ccall((:ca_get_fmpq, libcalcium), Cint, + ok = Bool(ccall((:ca_get_fmpq, libflint), Cint, (Ref{QQFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), res, a, C)) !ok && error("unable to convert to a rational number") return res @@ -1320,7 +1320,7 @@ end function ZZRingElem(a::CalciumFieldElem) C = a.parent res = ZZRingElem() - ok = Bool(ccall((:ca_get_fmpz, libcalcium), Cint, + ok = Bool(ccall((:ca_get_fmpz, libflint), Cint, (Ref{ZZRingElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), res, a, C)) !ok && error("unable to convert to an integer") return res @@ -1329,7 +1329,7 @@ end function QQBarFieldElem(a::CalciumFieldElem) C = a.parent res = QQBarFieldElem() - ok = Bool(ccall((:ca_get_qqbar, libcalcium), Cint, + ok = Bool(ccall((:ca_get_qqbar, libflint), Cint, (Ref{QQBarFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), res, a, C)) !ok && error("unable to convert to an algebraic number") return res @@ -1344,10 +1344,10 @@ function (R::AcbField)(a::CalciumFieldElem; parts::Bool=false) prec = precision(R) z = R() if parts - ccall((:ca_get_acb_accurate_parts, libcalcium), + ccall((:ca_get_acb_accurate_parts, libflint), Nothing, (Ref{AcbFieldElem}, Ref{CalciumFieldElem}, Int, Ref{CalciumField}), z, a, prec, C) else - ccall((:ca_get_acb, libcalcium), + ccall((:ca_get_acb, libflint), Nothing, (Ref{AcbFieldElem}, Ref{CalciumFieldElem}, Int, Ref{CalciumField}), z, a, prec, C) end return z @@ -1375,10 +1375,10 @@ end function (::Type{ComplexF64})(x::CalciumFieldElem) z = AcbField(53, cached = false)(x) x = ArbFieldElem() - ccall((:acb_get_real, libarb), Nothing, (Ref{ArbFieldElem}, Ref{AcbFieldElem}), x, z) + ccall((:acb_get_real, libflint), Nothing, (Ref{ArbFieldElem}, Ref{AcbFieldElem}), x, z) xx = Float64(x) y = ArbFieldElem() - ccall((:acb_get_imag, libarb), Nothing, (Ref{ArbFieldElem}, Ref{AcbFieldElem}), y, z) + ccall((:acb_get_imag, libflint), Nothing, (Ref{ArbFieldElem}, Ref{AcbFieldElem}), y, z) yy = Float64(y) return ComplexF64(xx, yy) end @@ -1391,7 +1391,7 @@ end function zero!(z::CalciumFieldElem) C = z.parent - ccall((:ca_zero, libcalcium), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), z, C) + ccall((:ca_zero, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}), z, C) return z end @@ -1400,7 +1400,7 @@ function mul!(z::CalciumFieldElem, x::CalciumFieldElem, y::CalciumFieldElem) error("different parents in in-place operation") end C = z.parent - ccall((:ca_mul, libcalcium), Nothing, + ccall((:ca_mul, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), z, x, y, C) check_special(z) return z @@ -1411,7 +1411,7 @@ function addeq!(z::CalciumFieldElem, x::CalciumFieldElem) error("different parents in in-place operation") end C = z.parent - ccall((:ca_add, libcalcium), Nothing, + ccall((:ca_add, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), z, z, x, C) check_special(z) return z @@ -1422,7 +1422,7 @@ function add!(z::CalciumFieldElem, x::CalciumFieldElem, y::CalciumFieldElem) error("different parents in in-place operation") end C = z.parent - ccall((:ca_add, libcalcium), Nothing, + ccall((:ca_add, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), z, x, y, C) check_special(z) return z @@ -1445,7 +1445,7 @@ function (C::CalciumField)(v::CalciumFieldElem) return v end r = C() - ccall((:ca_transfer, libcalcium), Nothing, + ccall((:ca_transfer, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{CalciumField}, Ref{CalciumFieldElem}, Ref{CalciumField}), r, C, v, D) check_special(r) @@ -1454,28 +1454,28 @@ end function (C::CalciumField)(v::Int) z = CalciumFieldElem(C) - ccall((:ca_set_si, libcalcium), Nothing, + ccall((:ca_set_si, libflint), Nothing, (Ref{CalciumFieldElem}, Int, Ref{CalciumField}), z, v, C) return z end function (C::CalciumField)(v::ZZRingElem) z = CalciumFieldElem(C) - ccall((:ca_set_fmpz, libcalcium), Nothing, + ccall((:ca_set_fmpz, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{ZZRingElem}, Ref{CalciumField}), z, v, C) return z end function (C::CalciumField)(v::QQFieldElem) z = CalciumFieldElem(C) - ccall((:ca_set_fmpq, libcalcium), Nothing, + ccall((:ca_set_fmpq, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{QQFieldElem}, Ref{CalciumField}), z, v, C) return z end function (C::CalciumField)(v::QQBarFieldElem) z = CalciumFieldElem(C) - ccall((:ca_set_qqbar, libcalcium), Nothing, + ccall((:ca_set_qqbar, libflint), Nothing, (Ref{CalciumFieldElem}, Ref{QQBarFieldElem}, Ref{CalciumField}), z, v, C) return z end diff --git a/src/calcium/qqbar.jl b/src/calcium/qqbar.jl index ca8391fd6..0125e46f1 100644 --- a/src/calcium/qqbar.jl +++ b/src/calcium/qqbar.jl @@ -46,7 +46,7 @@ end function QQBarFieldElem(a::Int) z = QQBarFieldElem() - ccall((:qqbar_set_si, libcalcium), Nothing, (Ref{QQBarFieldElem}, Int, ), z, a) + ccall((:qqbar_set_si, libflint), Nothing, (Ref{QQBarFieldElem}, Int, ), z, a) return z end @@ -54,21 +54,21 @@ function QQBarFieldElem(a::Complex) r = QQBarFieldElem(real(a)) s = QQBarFieldElem(imag(a)) z = QQBarFieldElem() - ccall((:qqbar_set_re_im, libcalcium), + ccall((:qqbar_set_re_im, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, r, s) return z end function QQBarFieldElem(a::ZZRingElem) z = QQBarFieldElem() - ccall((:qqbar_set_fmpz, libcalcium), + ccall((:qqbar_set_fmpz, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{ZZRingElem}, ), z, a) return z end function QQBarFieldElem(a::QQFieldElem) z = QQBarFieldElem() - ccall((:qqbar_set_fmpq, libcalcium), + ccall((:qqbar_set_fmpq, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQFieldElem}, ), z, a) return z end @@ -79,7 +79,7 @@ QQBarFieldElem(a::Integer) = QQBarFieldElem(ZZRingElem(a)) function deepcopy_internal(a::QQBarFieldElem, dict::IdDict) z = QQBarFieldElem() - ccall((:qqbar_set, libcalcium), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) + ccall((:qqbar_set, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) return z end @@ -103,21 +103,21 @@ canonical_unit(a::QQBarFieldElem) = a #= function qqbar_vec(n::Int) - return ccall((:_qqbar_vec_init, libcalcium), Ptr{qqbar_struct}, (Int,), n) + return ccall((:_qqbar_vec_init, libflint), Ptr{qqbar_struct}, (Int,), n) end function array(R::QQBarField, v::Ptr{qqbar_struct}, n::Int) r = Vector{QQBarFieldElem}(undef, n) for i=1:n r[i] = R() - ccall((:qqbar_set, libcalcium), Nothing, (Ref{QQBarFieldElem}, Ptr{qqbar_struct}), + ccall((:qqbar_set, libflint), Nothing, (Ref{QQBarFieldElem}, Ptr{qqbar_struct}), r[i], v + (i-1)*sizeof(qqbar_struct)) end return r end function qqbar_vec_clear(v::Ptr{qqbar_struct}, n::Int) - ccall((:_qqbar_vec_clear, libcalcium), + ccall((:_qqbar_vec_clear, libflint), Nothing, (Ptr{qqbar_struct}, Int), v, n) end @@ -127,7 +127,7 @@ function roots(R::QQBarField, f::ZZPolyRingElem) return Array{QQBarFieldElem}(undef, 0) end roots = qqbar_vec(deg) - ccall((:qqbar_roots_fmpz_poly, libcalcium), + ccall((:qqbar_roots_fmpz_poly, libflint), Nothing, (Ptr{qqbar_struct}, Ref{ZZPolyRingElem}, Int), roots, f, 0) res = array(R, roots, deg) qqbar_vec_clear(roots, deg) @@ -136,7 +136,7 @@ end =# function native_string(x::QQBarFieldElem) - cstr = ccall((:qqbar_get_str_nd, libcalcium), + cstr = ccall((:qqbar_get_str_nd, libflint), Ptr{UInt8}, (Ref{QQBarFieldElem}, Int), x, Int(6)) number = unsafe_string(cstr) ccall((:flint_free, libflint), Nothing, (Ptr{UInt8},), cstr) @@ -188,7 +188,7 @@ one(::Type{QQBarFieldElem}) = CalciumQQBar(1) Return the degree of the minimal polynomial of `x`. """ function degree(x::QQBarFieldElem) - return ccall((:qqbar_degree, libcalcium), Int, (Ref{QQBarFieldElem}, ), x) + return ccall((:qqbar_degree, libflint), Int, (Ref{QQBarFieldElem}, ), x) end @doc raw""" @@ -197,7 +197,7 @@ end Return whether `x` is the number 0. """ function iszero(x::QQBarFieldElem) - return Bool(ccall((:qqbar_is_zero, libcalcium), Cint, (Ref{QQBarFieldElem},), x)) + return Bool(ccall((:qqbar_is_zero, libflint), Cint, (Ref{QQBarFieldElem},), x)) end @doc raw""" @@ -206,7 +206,7 @@ end Return whether `x` is the number 1. """ function isone(x::QQBarFieldElem) - return Bool(ccall((:qqbar_is_one, libcalcium), Cint, (Ref{QQBarFieldElem},), x)) + return Bool(ccall((:qqbar_is_one, libflint), Cint, (Ref{QQBarFieldElem},), x)) end @doc raw""" @@ -215,7 +215,7 @@ end Return whether `x` is an integer. """ function isinteger(x::QQBarFieldElem) - return Bool(ccall((:qqbar_is_integer, libcalcium), Cint, (Ref{QQBarFieldElem},), x)) + return Bool(ccall((:qqbar_is_integer, libflint), Cint, (Ref{QQBarFieldElem},), x)) end @doc raw""" @@ -224,7 +224,7 @@ end Return whether `x` is a rational number. """ function is_rational(x::QQBarFieldElem) - return Bool(ccall((:qqbar_is_rational, libcalcium), Cint, (Ref{QQBarFieldElem},), x)) + return Bool(ccall((:qqbar_is_rational, libflint), Cint, (Ref{QQBarFieldElem},), x)) end @doc raw""" @@ -233,7 +233,7 @@ end Return whether `x` is a real number. """ function isreal(x::QQBarFieldElem) - return Bool(ccall((:qqbar_is_real, libcalcium), Cint, (Ref{QQBarFieldElem},), x)) + return Bool(ccall((:qqbar_is_real, libflint), Cint, (Ref{QQBarFieldElem},), x)) end @doc raw""" @@ -242,7 +242,7 @@ end Return whether `x` is an algebraic integer. """ function is_algebraic_integer(x::QQBarFieldElem) - return Bool(ccall((:qqbar_is_algebraic_integer, libcalcium), + return Bool(ccall((:qqbar_is_algebraic_integer, libflint), Cint, (Ref{QQBarFieldElem},), x)) end @@ -301,7 +301,7 @@ Return the height of the algebraic number `x`. The result is an `ZZRingElem` int """ function height(x::QQBarFieldElem) z = ZZRingElem() - ccall((:qqbar_height, libcalcium), Nothing, (Ref{ZZRingElem}, Ref{QQBarFieldElem}, ), z, x) + ccall((:qqbar_height, libflint), Nothing, (Ref{ZZRingElem}, Ref{QQBarFieldElem}, ), z, x) return z end @@ -312,7 +312,7 @@ Return the height of the algebraic number `x` measured in bits. The result is a Julia integer. """ function height_bits(x::QQBarFieldElem) - return ccall((:qqbar_height_bits, libcalcium), Int, (Ref{QQBarFieldElem}, ), x) + return ccall((:qqbar_height_bits, libflint), Int, (Ref{QQBarFieldElem}, ), x) end @@ -340,14 +340,14 @@ function rand(R::QQBarField; degree::Int, bits::Int, bits <= 0 && error("bits must be positive") if randtype == :null - ccall((:qqbar_randtest, libcalcium), Nothing, + ccall((:qqbar_randtest, libflint), Nothing, (Ref{QQBarFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, degree, bits) elseif randtype == :real - ccall((:qqbar_randtest_real, libcalcium), Nothing, + ccall((:qqbar_randtest_real, libflint), Nothing, (Ref{QQBarFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, degree, bits) elseif randtype == :nonreal degree < 2 && error("nonreal requires degree >= 2") - ccall((:qqbar_randtest_nonreal, libcalcium), Nothing, + ccall((:qqbar_randtest_nonreal, libflint), Nothing, (Ref{QQBarFieldElem}, Ptr{Cvoid}, Int, Int), x, state.ptr, degree, bits) else error("randtype not defined") @@ -364,7 +364,7 @@ end function -(a::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_neg, libcalcium), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) + ccall((:qqbar_neg, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) return z end @@ -376,28 +376,28 @@ end function +(a::QQBarFieldElem, b::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_add, libcalcium), Nothing, + ccall((:qqbar_add, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a, b) return z end function +(a::QQBarFieldElem, b::QQFieldElem) z = QQBarFieldElem() - ccall((:qqbar_add_fmpq, libcalcium), Nothing, + ccall((:qqbar_add_fmpq, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQFieldElem}), z, a, b) return z end function +(a::QQBarFieldElem, b::ZZRingElem) z = QQBarFieldElem() - ccall((:qqbar_add_fmpz, libcalcium), Nothing, + ccall((:qqbar_add_fmpz, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{ZZRingElem}), z, a, b) return z end function +(a::QQBarFieldElem, b::Int) z = QQBarFieldElem() - ccall((:qqbar_add_si, libcalcium), Nothing, + ccall((:qqbar_add_si, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Int), z, a, b) return z end @@ -408,77 +408,77 @@ end function -(a::QQBarFieldElem, b::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_sub, libcalcium), Nothing, + ccall((:qqbar_sub, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a, b) return z end function -(a::QQBarFieldElem, b::QQFieldElem) z = QQBarFieldElem() - ccall((:qqbar_sub_fmpq, libcalcium), Nothing, + ccall((:qqbar_sub_fmpq, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQFieldElem}), z, a, b) return z end function -(a::QQBarFieldElem, b::ZZRingElem) z = QQBarFieldElem() - ccall((:qqbar_sub_fmpz, libcalcium), Nothing, + ccall((:qqbar_sub_fmpz, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{ZZRingElem}), z, a, b) return z end function -(a::QQBarFieldElem, b::Int) z = QQBarFieldElem() - ccall((:qqbar_sub_si, libcalcium), Nothing, + ccall((:qqbar_sub_si, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Int), z, a, b) return z end function -(a::QQFieldElem, b::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_fmpq_sub, libcalcium), Nothing, + ccall((:qqbar_fmpq_sub, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQFieldElem}, Ref{QQBarFieldElem}), z, a, b) return z end function -(a::ZZRingElem, b::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_fmpz_sub, libcalcium), Nothing, + ccall((:qqbar_fmpz_sub, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{ZZRingElem}, Ref{QQBarFieldElem}), z, a, b) return z end function -(a::Int, b::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_si_sub, libcalcium), Nothing, + ccall((:qqbar_si_sub, libflint), Nothing, (Ref{QQBarFieldElem}, Int, Ref{QQBarFieldElem}), z, a, b) return z end function *(a::QQBarFieldElem, b::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_mul, libcalcium), Nothing, + ccall((:qqbar_mul, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a, b) return z end function *(a::QQBarFieldElem, b::QQFieldElem) z = QQBarFieldElem() - ccall((:qqbar_mul_fmpq, libcalcium), Nothing, + ccall((:qqbar_mul_fmpq, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQFieldElem}), z, a, b) return z end function *(a::QQBarFieldElem, b::ZZRingElem) z = QQBarFieldElem() - ccall((:qqbar_mul_fmpz, libcalcium), Nothing, + ccall((:qqbar_mul_fmpz, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{ZZRingElem}), z, a, b) return z end function *(a::QQBarFieldElem, b::Int) z = QQBarFieldElem() - ccall((:qqbar_mul_si, libcalcium), Nothing, + ccall((:qqbar_mul_si, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Int), z, a, b) return z end @@ -489,7 +489,7 @@ end function ^(a::QQBarFieldElem, b::QQBarFieldElem) z = QQBarFieldElem() - ok = Bool(ccall((:qqbar_pow, libcalcium), Cint, + ok = Bool(ccall((:qqbar_pow, libflint), Cint, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a, b)) !ok && throw(DomainError((a, b))) return z @@ -512,14 +512,14 @@ end function inv(a::QQBarFieldElem) iszero(a) && throw(DivideError()) z = QQBarFieldElem() - ccall((:qqbar_inv, libcalcium), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) + ccall((:qqbar_inv, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) return z end function divexact(a::QQBarFieldElem, b::QQBarFieldElem; check::Bool=true) iszero(b) && throw(DivideError()) z = QQBarFieldElem() - ccall((:qqbar_div, libcalcium), Nothing, + ccall((:qqbar_div, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a, b) return z end @@ -527,7 +527,7 @@ end function divexact(a::QQBarFieldElem, b::QQFieldElem; check::Bool=true) iszero(b) && throw(DivideError()) z = QQBarFieldElem() - ccall((:qqbar_div_fmpq, libcalcium), Nothing, + ccall((:qqbar_div_fmpq, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQFieldElem}), z, a, b) return z end @@ -535,7 +535,7 @@ end function divexact(a::QQBarFieldElem, b::ZZRingElem; check::Bool=true) iszero(b) && throw(DivideError()) z = QQBarFieldElem() - ccall((:qqbar_div_fmpz, libcalcium), Nothing, + ccall((:qqbar_div_fmpz, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{ZZRingElem}), z, a, b) return z end @@ -543,7 +543,7 @@ end function divexact(a::QQBarFieldElem, b::Int; check::Bool=true) iszero(b) && throw(DivideError()) z = QQBarFieldElem() - ccall((:qqbar_div_si, libcalcium), Nothing, + ccall((:qqbar_div_si, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Int), z, a, b) return z end @@ -551,7 +551,7 @@ end function divexact(a::QQFieldElem, b::QQBarFieldElem; check::Bool=true) iszero(b) && throw(DivideError()) z = QQBarFieldElem() - ccall((:qqbar_fmpq_div, libcalcium), Nothing, + ccall((:qqbar_fmpq_div, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQFieldElem}, Ref{QQBarFieldElem}), z, a, b) return z end @@ -559,7 +559,7 @@ end function divexact(a::ZZRingElem, b::QQBarFieldElem; check::Bool=true) iszero(b) && throw(DivideError()) z = QQBarFieldElem() - ccall((:qqbar_fmpz_div, libcalcium), Nothing, + ccall((:qqbar_fmpz_div, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{ZZRingElem}, Ref{QQBarFieldElem}), z, a, b) return z end @@ -567,7 +567,7 @@ end function divexact(a::Int, b::QQBarFieldElem; check::Bool=true) iszero(b) && throw(DivideError()) z = QQBarFieldElem() - ccall((:qqbar_si_div, libcalcium), Nothing, + ccall((:qqbar_si_div, libflint), Nothing, (Ref{QQBarFieldElem}, Int, Ref{QQBarFieldElem}), z, a, b) return z end @@ -583,14 +583,14 @@ end function <<(a::QQBarFieldElem, b::Int) z = QQBarFieldElem() - ccall((:qqbar_mul_2exp_si, libcalcium), Nothing, + ccall((:qqbar_mul_2exp_si, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Int), z, a, b) return z end function >>(a::QQBarFieldElem, b::Int) z = QQBarFieldElem() - ccall((:qqbar_mul_2exp_si, libcalcium), Nothing, + ccall((:qqbar_mul_2exp_si, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Int), z, a, -b) return z end @@ -603,14 +603,14 @@ end function evaluate(x::QQPolyRingElem, y::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_evaluate_fmpq_poly, libcalcium), Nothing, + ccall((:qqbar_evaluate_fmpq_poly, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQPolyRingElem}, Ref{QQBarFieldElem}), z, x, y) return z end function evaluate(x::ZZPolyRingElem, y::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_evaluate_fmpz_poly, libcalcium), Nothing, + ccall((:qqbar_evaluate_fmpz_poly, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{ZZPolyRingElem}, Ref{QQBarFieldElem}), z, x, y) return z end @@ -622,14 +622,14 @@ end ############################################################################### function ==(a::QQBarFieldElem, b::QQBarFieldElem) - return Bool(ccall((:qqbar_equal, libcalcium), Cint, + return Bool(ccall((:qqbar_equal, libflint), Cint, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), a, b)) end function cmp(a::QQBarFieldElem, b::QQBarFieldElem) !isreal(a) && throw(DomainError(a, "comparing nonreal numbers")) !isreal(b) && throw(DomainError(b, "comparing nonreal numbers")) - return ccall((:qqbar_cmp_re, libcalcium), Cint, + return ccall((:qqbar_cmp_re, libflint), Cint, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), a, b) end @@ -645,17 +645,17 @@ is_positive(a::QQBarFieldElem) = a > 0 is_negative(a::QQBarFieldElem) = a < 0 # todo: export the cmp functions? -cmp_real(a::QQBarFieldElem, b::QQBarFieldElem) = ccall((:qqbar_cmp_re, libcalcium), +cmp_real(a::QQBarFieldElem, b::QQBarFieldElem) = ccall((:qqbar_cmp_re, libflint), Cint, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), a, b) -cmp_imag(a::QQBarFieldElem, b::QQBarFieldElem) = ccall((:qqbar_cmp_im, libcalcium), +cmp_imag(a::QQBarFieldElem, b::QQBarFieldElem) = ccall((:qqbar_cmp_im, libflint), Cint, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), a, b) -cmpabs(a::QQBarFieldElem, b::QQBarFieldElem) = ccall((:qqbar_cmpabs, libcalcium), +cmpabs(a::QQBarFieldElem, b::QQBarFieldElem) = ccall((:qqbar_cmpabs, libflint), Cint, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), a, b) -cmpabs_real(a::QQBarFieldElem, b::QQBarFieldElem) = ccall((:qqbar_cmpabs_re, libcalcium), +cmpabs_real(a::QQBarFieldElem, b::QQBarFieldElem) = ccall((:qqbar_cmpabs_re, libflint), Cint, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), a, b) -cmpabs_imag(a::QQBarFieldElem, b::QQBarFieldElem) = ccall((:qqbar_cmpabs_im, libcalcium), +cmpabs_imag(a::QQBarFieldElem, b::QQBarFieldElem) = ccall((:qqbar_cmpabs_im, libflint), Cint, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), a, b) -cmp_root_order(a::QQBarFieldElem, b::QQBarFieldElem) = ccall((:qqbar_cmp_root_order, libcalcium), +cmp_root_order(a::QQBarFieldElem, b::QQBarFieldElem) = ccall((:qqbar_cmp_root_order, libflint), Cint, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), a, b) @doc raw""" @@ -752,7 +752,7 @@ Return the real part of `a`. """ function real(a::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_re, libcalcium), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) + ccall((:qqbar_re, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) return z end @@ -763,7 +763,7 @@ Return the imaginary part of `a`. """ function imag(a::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_im, libcalcium), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) + ccall((:qqbar_im, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) return z end @@ -774,7 +774,7 @@ Return the absolute value of `a`. """ function abs(a::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_abs, libcalcium), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) + ccall((:qqbar_abs, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) return z end @@ -785,7 +785,7 @@ Return the complex conjugate of `a`. """ function conj(a::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_conj, libcalcium), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) + ccall((:qqbar_conj, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) return z end @@ -796,7 +796,7 @@ Return the squared absolute value of `a`. """ function abs2(a::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_abs2, libcalcium), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) + ccall((:qqbar_abs2, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) return z end @@ -808,7 +808,7 @@ and as $a / |a|$ otherwise. """ function sign(a::QQBarFieldElem) z = QQBarFieldElem() - ccall((:qqbar_sgn, libcalcium), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) + ccall((:qqbar_sgn, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) return z end @@ -822,7 +822,7 @@ Equivalently, $\operatorname{csgn}(x) = x / \sqrt{x^2}$ except that the value is at zero. The value is returned as a Julia integer. """ function csgn(a::QQBarFieldElem) - return QQBarFieldElem(Int(ccall((:qqbar_csgn, libcalcium), Cint, (Ref{QQBarFieldElem}, ), a))) + return QQBarFieldElem(Int(ccall((:qqbar_csgn, libflint), Cint, (Ref{QQBarFieldElem}, ), a))) end @doc raw""" @@ -831,7 +831,7 @@ end Return the sign of the real part of `a` as a Julia integer. """ function sign_real(a::QQBarFieldElem) - return QQBarFieldElem(Int(ccall((:qqbar_sgn_re, libcalcium), + return QQBarFieldElem(Int(ccall((:qqbar_sgn_re, libflint), Cint, (Ref{QQBarFieldElem}, ), a))) end @@ -841,7 +841,7 @@ end Return the sign of the imaginary part of `a` as a Julia integer. """ function sign_imag(a::QQBarFieldElem) - return QQBarFieldElem(Int(ccall((:qqbar_sgn_im, libcalcium), + return QQBarFieldElem(Int(ccall((:qqbar_sgn_im, libflint), Cint, (Ref{QQBarFieldElem}, ), a))) end @@ -851,7 +851,7 @@ end function floor(::Type{ZZRingElem}, a::QQBarFieldElem) z = ZZRingElem() - ccall((:qqbar_floor, libcalcium), Nothing, (Ref{ZZRingElem}, Ref{QQBarFieldElem}, ), z, a) + ccall((:qqbar_floor, libflint), Nothing, (Ref{ZZRingElem}, Ref{QQBarFieldElem}, ), z, a) return z end @@ -861,7 +861,7 @@ end function ceil(::Type{ZZRingElem}, a::QQBarFieldElem) z = ZZRingElem() - ccall((:qqbar_ceil, libcalcium), Nothing, (Ref{ZZRingElem}, Ref{QQBarFieldElem}, ), z, a) + ccall((:qqbar_ceil, libflint), Nothing, (Ref{ZZRingElem}, Ref{QQBarFieldElem}, ), z, a) return z end @@ -920,7 +920,7 @@ Return the principal square root of `a`. """ function sqrt(a::QQBarFieldElem; check::Bool=true) z = QQBarFieldElem() - ccall((:qqbar_sqrt, libcalcium), + ccall((:qqbar_sqrt, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) return z end @@ -933,27 +933,27 @@ Return the principal `n`-th root of `a`. Requires positive `n`. function root(a::QQBarFieldElem, n::Int) n <= 0 && throw(DomainError(n)) z = QQBarFieldElem() - ccall((:qqbar_root_ui, libcalcium), + ccall((:qqbar_root_ui, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, UInt), z, a, n) return z end function qqbar_vec(n::Int) - return ccall((:_qqbar_vec_init, libcalcium), Ptr{qqbar_struct}, (Int,), n) + return ccall((:_qqbar_vec_init, libflint), Ptr{qqbar_struct}, (Int,), n) end function array(R::QQBarField, v::Ptr{qqbar_struct}, n::Int) r = Vector{QQBarFieldElem}(undef, n) for i=1:n r[i] = R() - ccall((:qqbar_set, libcalcium), Nothing, (Ref{QQBarFieldElem}, Ptr{qqbar_struct}), + ccall((:qqbar_set, libflint), Nothing, (Ref{QQBarFieldElem}, Ptr{qqbar_struct}), r[i], v + (i-1)*sizeof(qqbar_struct)) end return r end function qqbar_vec_clear(v::Ptr{qqbar_struct}, n::Int) - ccall((:_qqbar_vec_clear, libcalcium), + ccall((:_qqbar_vec_clear, libflint), Nothing, (Ptr{qqbar_struct}, Int), v, n) end @@ -971,7 +971,7 @@ function roots(R::QQBarField, f::ZZPolyRingElem) return Array{QQBarFieldElem}(undef, 0) end roots = qqbar_vec(deg) - ccall((:qqbar_roots_fmpz_poly, libcalcium), + ccall((:qqbar_roots_fmpz_poly, libflint), Nothing, (Ptr{qqbar_struct}, Ref{ZZPolyRingElem}, Int), roots, f, 0) res = array(R, roots, deg) qqbar_vec_clear(roots, deg) @@ -992,7 +992,7 @@ function roots(R::QQBarField, f::QQPolyRingElem) return Array{QQBarFieldElem}(undef, 0) end roots = qqbar_vec(deg) - ccall((:qqbar_roots_fmpq_poly, libcalcium), + ccall((:qqbar_roots_fmpq_poly, libflint), Nothing, (Ptr{qqbar_struct}, Ref{QQPolyRingElem}, Int), roots, f, 0) res = array(R, roots, deg) qqbar_vec_clear(roots, deg) @@ -1012,7 +1012,7 @@ function conjugates(a::QQBarFieldElem) return [a] end conjugates = qqbar_vec(deg) - ccall((:qqbar_conjugates, libcalcium), + ccall((:qqbar_conjugates, libflint), Nothing, (Ptr{qqbar_struct}, Ref{QQBarFieldElem}), conjugates, a) res = array(parent(a), conjugates, deg) qqbar_vec_clear(conjugates, deg) @@ -1027,7 +1027,7 @@ function _eigvals_internal(R::QQBarField, A::ZZMatrix) return Array{QQBarFieldElem}(undef, 0) end roots = qqbar_vec(n) - ccall((:qqbar_eigenvalues_fmpz_mat, libcalcium), + ccall((:qqbar_eigenvalues_fmpz_mat, libflint), Nothing, (Ptr{qqbar_struct}, Ref{ZZMatrix}, Int), roots, A, 0) res = array(R, roots, n) qqbar_vec_clear(roots, n) @@ -1042,7 +1042,7 @@ function _eigvals_internal(R::QQBarField, A::QQMatrix) return Array{QQBarFieldElem}(undef, 0) end roots = qqbar_vec(n) - ccall((:qqbar_eigenvalues_fmpq_mat, libcalcium), + ccall((:qqbar_eigenvalues_fmpq_mat, libflint), Nothing, (Ptr{qqbar_struct}, Ref{QQMatrix}, Int), roots, A, 0) res = array(R, roots, n) qqbar_vec_clear(roots, n) @@ -1105,7 +1105,7 @@ of algebraic numbers `C`. function root_of_unity(C::QQBarField, n::Int) n <= 0 && throw(DomainError(n)) z = QQBarFieldElem() - ccall((:qqbar_root_of_unity, libcalcium), + ccall((:qqbar_root_of_unity, libflint), Nothing, (Ref{QQBarFieldElem}, Int, UInt), z, 1, n) return z end @@ -1119,7 +1119,7 @@ of algebraic numbers `C`. function root_of_unity(C::QQBarField, n::Int, k::Int) n <= 0 && throw(DomainError(n)) z = QQBarFieldElem() - ccall((:qqbar_root_of_unity, libcalcium), + ccall((:qqbar_root_of_unity, libflint), Nothing, (Ref{QQBarFieldElem}, Int, UInt), z, k, n) return z end @@ -1130,7 +1130,7 @@ end Return whether the given algebraic number is a root of unity. """ function is_root_of_unity(a::QQBarFieldElem) - return Bool(ccall((:qqbar_is_root_of_unity, libcalcium), + return Bool(ccall((:qqbar_is_root_of_unity, libflint), Cint, (Ptr{Int}, Ptr{Int}, Ref{QQBarFieldElem}), C_NULL, C_NULL, a)) end @@ -1144,7 +1144,7 @@ $0 \le p < q$. Throws if `a` is not a root of unity. function root_of_unity_as_args(a::QQBarFieldElem) p = Vector{Int}(undef, 1) q = Vector{Int}(undef, 1) - if !Bool(ccall((:qqbar_is_root_of_unity, libcalcium), + if !Bool(ccall((:qqbar_is_root_of_unity, libflint), Cint, (Ptr{Int}, Ptr{Int}, Ref{QQBarFieldElem}), p, q, a)) throw(DomainError(a, "value is not a root of unity")) end @@ -1162,7 +1162,7 @@ function exp_pi_i(a::QQBarFieldElem) p = Int(numerator(r)) q = Int(denominator(r)) z = QQBarFieldElem() - ccall((:qqbar_exp_pi_i, libcalcium), + ccall((:qqbar_exp_pi_i, libflint), Nothing, (Ref{QQBarFieldElem}, Int, Int), z, p, q) return z end @@ -1189,7 +1189,7 @@ function sinpi(a::QQBarFieldElem) p = Int(numerator(r)) q = Int(denominator(r)) z = QQBarFieldElem() - ccall((:qqbar_sin_pi, libcalcium), Nothing, (Ref{QQBarFieldElem}, Int, Int), z, p, q) + ccall((:qqbar_sin_pi, libflint), Nothing, (Ref{QQBarFieldElem}, Int, Int), z, p, q) return z end @@ -1215,7 +1215,7 @@ function cospi(a::QQBarFieldElem) p = Int(numerator(r)) q = Int(denominator(r)) z = QQBarFieldElem() - ccall((:qqbar_cos_pi, libcalcium), Nothing, (Ref{QQBarFieldElem}, Int, Int), z, p, q) + ccall((:qqbar_cos_pi, libflint), Nothing, (Ref{QQBarFieldElem}, Int, Int), z, p, q) return z end @@ -1241,9 +1241,9 @@ function sincospi(a::QQBarFieldElem) p = Int(numerator(r)) q = Int(denominator(r)) s = QQBarFieldElem() - ccall((:qqbar_sin_pi, libcalcium), Nothing, (Ref{QQBarFieldElem}, Int, Int), s, p, q) + ccall((:qqbar_sin_pi, libflint), Nothing, (Ref{QQBarFieldElem}, Int, Int), s, p, q) c = QQBarFieldElem() - ccall((:qqbar_cos_pi, libcalcium), Nothing, (Ref{QQBarFieldElem}, Int, Int), c, p, q) + ccall((:qqbar_cos_pi, libflint), Nothing, (Ref{QQBarFieldElem}, Int, Int), c, p, q) return s, c end @@ -1259,7 +1259,7 @@ function tanpi(a::QQBarFieldElem) p = Int(numerator(r)) q = Int(denominator(r)) z = QQBarFieldElem() - if !Bool(ccall((:qqbar_tan_pi, libcalcium), + if !Bool(ccall((:qqbar_tan_pi, libflint), Cint, (Ref{QQBarFieldElem}, Int, Int), z, p, q)) throw(DomainError(a, "function value is not algebraic")) end @@ -1275,7 +1275,7 @@ Throws if this value is transcendental or undefined. function atanpi(a::QQBarFieldElem) p = Vector{Int}(undef, 1) q = Vector{Int}(undef, 1) - if !Bool(ccall((:qqbar_atan_pi, libcalcium), + if !Bool(ccall((:qqbar_atan_pi, libflint), Cint, (Ptr{Int}, Ptr{Int}, Ref{QQBarFieldElem}), p, q, a)) throw(DomainError(a, "function value is not algebraic")) end @@ -1291,7 +1291,7 @@ Throws if this value is transcendental. function asinpi(a::QQBarFieldElem) p = Vector{Int}(undef, 1) q = Vector{Int}(undef, 1) - if !Bool(ccall((:qqbar_asin_pi, libcalcium), + if !Bool(ccall((:qqbar_asin_pi, libflint), Cint, (Ptr{Int}, Ptr{Int}, Ref{QQBarFieldElem}), p, q, a)) throw(DomainError(a, "function value is not algebraic")) end @@ -1307,7 +1307,7 @@ Throws if this value is transcendental. function acospi(a::QQBarFieldElem) p = Vector{Int}(undef, 1) q = Vector{Int}(undef, 1) - if !Bool(ccall((:qqbar_acos_pi, libcalcium), + if !Bool(ccall((:qqbar_acos_pi, libflint), Cint, (Ptr{Int}, Ptr{Int}, Ref{QQBarFieldElem}), p, q, a)) throw(DomainError(a, "function value is not algebraic")) end @@ -1323,7 +1323,7 @@ Throws if this value is transcendental or undefined. function log_pi_i(a::QQBarFieldElem) p = Vector{Int}(undef, 1) q = Vector{Int}(undef, 1) - if !Bool(ccall((:qqbar_log_pi_i, libcalcium), + if !Bool(ccall((:qqbar_log_pi_i, libflint), Cint, (Ptr{Int}, Ptr{Int}, Ref{QQBarFieldElem}), p, q, a)) throw(DomainError(a, "function value is not algebraic")) end @@ -1369,7 +1369,7 @@ function guess(R::QQBarField, x::T, maxdeg::Int, maxbits::Int=0) where {T <: Uni maxbits = prec end res = QQBarFieldElem() - found = Bool(ccall((:qqbar_guess, libcalcium), + found = Bool(ccall((:qqbar_guess, libflint), Cint, (Ref{QQBarFieldElem}, Ref{T}, Int, Int, Int, Int), res, x, maxdeg, maxbits, 0, prec)) if !found @@ -1403,7 +1403,7 @@ Throws if `a` is not a real number. function (R::ArbField)(a::QQBarFieldElem) prec = precision(R) z = R() - ccall((:qqbar_get_arb, libcalcium), + ccall((:qqbar_get_arb, libflint), Nothing, (Ref{ArbFieldElem}, Ref{QQBarFieldElem}, Int), z, a, prec) !isfinite(z) && throw(DomainError(a, "nonreal algebraic number")) return z @@ -1417,7 +1417,7 @@ Convert `a` to a complex ball with the precision of the parent field `R`. function (R::AcbField)(a::QQBarFieldElem) prec = precision(R) z = R() - ccall((:qqbar_get_acb, libcalcium), + ccall((:qqbar_get_acb, libflint), Nothing, (Ref{AcbFieldElem}, Ref{QQBarFieldElem}, Int), z, a, prec) return z end @@ -1431,7 +1431,7 @@ Throws if `a` is not a real number. function (R::RealField)(a::QQBarFieldElem) prec = precision(Balls) z = R() - ccall((:qqbar_get_arb, libcalcium), + ccall((:qqbar_get_arb, libflint), Nothing, (Ref{RealFieldElem}, Ref{QQBarFieldElem}, Int), z, a, prec) !isfinite(z) && throw(DomainError(a, "nonreal algebraic number")) return z @@ -1445,7 +1445,7 @@ Convert `a` to a complex ball with the precision of the parent field `R`. function (R::ComplexField)(a::QQBarFieldElem) prec = precision(Balls) z = R() - ccall((:qqbar_get_acb, libcalcium), + ccall((:qqbar_get_acb, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{QQBarFieldElem}, Int), z, a, prec) return z end @@ -1491,24 +1491,24 @@ end ############################################################################### function zero!(z::QQBarFieldElem) - ccall((:qqbar_zero, libcalcium), Nothing, (Ref{QQBarFieldElem},), z) + ccall((:qqbar_zero, libflint), Nothing, (Ref{QQBarFieldElem},), z) return z end function mul!(z::QQBarFieldElem, x::QQBarFieldElem, y::QQBarFieldElem) - ccall((:qqbar_mul, libcalcium), Nothing, + ccall((:qqbar_mul, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, x, y) return z end function addeq!(z::QQBarFieldElem, x::QQBarFieldElem) - ccall((:qqbar_add, libcalcium), Nothing, + ccall((:qqbar_add, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, z, x) return z end function add!(z::QQBarFieldElem, x::QQBarFieldElem, y::QQBarFieldElem) - ccall((:qqbar_add, libcalcium), Nothing, + ccall((:qqbar_add, libflint), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, x, y) return z end diff --git a/src/flint/FlintTypes.jl b/src/flint/FlintTypes.jl index 9c31114d0..e9ee90fc7 100644 --- a/src/flint/FlintTypes.jl +++ b/src/flint/FlintTypes.jl @@ -2202,10 +2202,9 @@ A finite field. Implemented as $\mathbb F_p[t]/f$ for the prime $p$ being an [`I See [`FqPolyRepField`](@ref) for $p$ being a [`ZZRingElem`](@ref). See [`fqPolyRepFieldElem`](@ref) for elements. """ @attributes mutable struct fqPolyRepField <: FinField - p :: Int - n :: Int - ninv :: Int - norm :: Int + n :: UInt + ninv :: UInt + norm :: UInt sparse_modulus :: Cint is_conway :: Cint a :: Ptr{Nothing} @@ -2229,19 +2228,23 @@ See [`FqPolyRepField`](@ref) for $p$ being a [`ZZRingElem`](@ref). See [`fqPolyR overfields :: Dict{Int, Vector{FinFieldMorphism}} subfields :: Dict{Int, Vector{FinFieldMorphism}} - function fqPolyRepField(c::ZZRingElem, deg::Int, s::Symbol, cached::Bool = true; check::Bool = true) + function fqPolyRepField(c::UInt, deg::Int, s::Symbol, cached::Bool = true; check::Bool = true) check && !is_prime(c) && throw(DomainError(c, "the characteristic must be a prime")) return get_cached!(FqNmodFiniteFieldID, (c, deg, s), cached) do d = new() - ccall((:fq_nmod_ctx_init, libflint), Nothing, - (Ref{fqPolyRepField}, Ref{ZZRingElem}, Int, Ptr{UInt8}), - d, c, deg, string(s)) + ccall((:fq_nmod_ctx_init_ui, libflint), Nothing, + (Ref{fqPolyRepField}, UInt, Int, Ptr{UInt8}), + d, c, deg, string(s)) finalizer(_FqNmodFiniteField_clear_fn, d) return d end end + function fqPolyRepField(c::T, deg::Int, s::Symbol, cached::Bool = true; check::Bool = true) where T <: Union{Int, ZZRingElem} + return fqPolyRepField(UInt(c), deg, s, cached, check = check) + end + function fqPolyRepField(f::zzModPolyRingElem, s::Symbol, cached::Bool = true; check::Bool = true) check && !is_prime(modulus(f)) && throw(DomainError(base_ring(f), "the base ring of the polynomial must be a field")) @@ -2269,7 +2272,7 @@ See [`FqPolyRepField`](@ref) for $p$ being a [`ZZRingElem`](@ref). See [`fqPolyR end -const FqNmodFiniteFieldID = CacheDictType{Tuple{ZZRingElem, Int, Symbol}, fqPolyRepField}() +const FqNmodFiniteFieldID = CacheDictType{Tuple{UInt, Int, Symbol}, fqPolyRepField}() const FqNmodFiniteFieldIDNmodPol = CacheDictType{Tuple{zzModPolyRing, zzModPolyRingElem, Symbol}, fqPolyRepField}() @@ -2364,8 +2367,12 @@ end A finite field. The constructor automatically determines a fast implementation. """ @attributes mutable struct FqField <: FinField - # fq_default_ctx_struct is 208 bytes on 64 bit machine - opaque::NTuple{208, Int8} + # gr_ctx_struct + data::NTuple{6 * sizeof(UInt), Int8} + which_ring::UInt + sizeof_elem::Int + methods::Ptr{Nothing} + size_limit::UInt # end of flint struct var::String @@ -2566,152 +2573,77 @@ end # ############################################################################### -if NEW_FLINT - @doc raw""" - FqPolyRepField <: FinField - - A finite field. Implemented as $\mathbb F_p[t]/f$ for the prime $p$ being a [`ZZRingElem`](@ref). - See [`fqPolyRepField`](@ref) for $p$ being an [`Int`](@ref). See [`FqPolyRepFieldElem`](@ref) for elements. - """ - @attributes mutable struct FqPolyRepField <: FinField - p::Int # fmpz_t - add_fxn::Ptr{Nothing} - sub_fxn::Ptr{Nothing} - mul_fxn::Ptr{Nothing} - n2::UInt - ninv::UInt - norm::UInt - n_limbs::Tuple{UInt, UInt, UInt} - ninv_limbs::Tuple{UInt, UInt, UInt} - ninv_huge::Ptr{Nothing} # fmpz_preinvn_struct - - sparse_modulus :: Cint - is_conway :: Cint - a::Ptr{Nothing} - j::Ptr{Nothing} - len::Int - mod_coeffs::Ptr{Nothing} - mod_alloc::Int - mod_length::Int - inv_coeffs::Ptr{Nothing} - inv_alloc::Int - inv_length::Int - var::Ptr{Nothing} - # end of flint struct - - overfields :: Dict{Int, Vector{FinFieldMorphism}} - subfields :: Dict{Int, Vector{FinFieldMorphism}} - - function FqPolyRepField(char::ZZRingElem, deg::Int, s::Symbol, cached::Bool = true; check::Bool = true) - check && !is_probable_prime(char) && - throw(DomainError(char, "the characteristic must be a prime")) - return get_cached!(FqFiniteFieldID, (char, deg, s), cached) do - d = new() - finalizer(_FqFiniteField_clear_fn, d) - ccall((:fq_ctx_init, libflint), Nothing, - (Ref{FqPolyRepField}, Ref{ZZRingElem}, Int, Ptr{UInt8}), - d, char, deg, string(s)) - return d - end - end - - function FqPolyRepField(f::ZZModPolyRingElem, s::Symbol, cached::Bool = true; check::Bool = true) - check && !is_probable_prime(modulus(f)) && - throw(DomainError(base_ring(f), "the base ring of the polynomial must be a field")) - return get_cached!(FqFiniteFieldIDFmpzPol, (f, s), cached) do - z = new() - ccall((:fq_ctx_init_modulus, libflint), Nothing, - (Ref{FqPolyRepField}, Ref{ZZModPolyRingElem}, Ref{fmpz_mod_ctx_struct}, Ptr{UInt8}), - z, f, base_ring(parent(f)).ninv, string(s)) - finalizer(_FqFiniteField_clear_fn, z) - return z - end - end - - function FqPolyRepField(f::FpPolyRingElem, s::Symbol, cached::Bool = true; check::Bool = true) - # check ignored - return get_cached!(FqFiniteFieldIDGFPPol, (f, s), cached) do - z = new() - ccall((:fq_ctx_init_modulus, libflint), Nothing, - (Ref{FqPolyRepField}, Ref{FpPolyRingElem}, Ref{fmpz_mod_ctx_struct}, Ptr{UInt8}), - z, f, base_ring(parent(f)).ninv, string(s)) - finalizer(_FqFiniteField_clear_fn, z) - return z - end - end - end -else - @doc raw""" - FqPolyRepField <: FinField - - A finite field. Implemented as $\mathbb F_p[t]/f$ for the prime $p$ being a [`ZZRingElem`](@ref). - See [`fqPolyRepField`](@ref) for $p$ being an [`Int`](@ref). See [`FqPolyRepFieldElem`](@ref) for elements. - """ - @attributes mutable struct FqPolyRepField <: FinField - p::Int # fmpz_t - add_fxn::Ptr{Nothing} - sub_fxn::Ptr{Nothing} - mul_fxn::Ptr{Nothing} - n2::UInt - ninv::UInt - norm::UInt - n_limbs::Tuple{UInt, UInt, UInt} - ninv_limbs::Tuple{UInt, UInt, UInt} - - sparse_modulus :: Cint - is_conway :: Cint - a::Ptr{Nothing} - j::Ptr{Nothing} - len::Int - mod_coeffs::Ptr{Nothing} - mod_alloc::Int - mod_length::Int - inv_coeffs::Ptr{Nothing} - inv_alloc::Int - inv_length::Int - var::Ptr{Nothing} - # end of flint struct - - overfields :: Dict{Int, Vector{FinFieldMorphism}} - subfields :: Dict{Int, Vector{FinFieldMorphism}} - - function FqPolyRepField(char::ZZRingElem, deg::Int, s::Symbol, cached::Bool = true; check::Bool = true) - check && !is_probable_prime(char) && - throw(DomainError(char, "the characteristic must be a prime")) - return get_cached!(FqFiniteFieldID, (char, deg, s), cached) do - d = new() - finalizer(_FqFiniteField_clear_fn, d) - ccall((:fq_ctx_init, libflint), Nothing, - (Ref{FqPolyRepField}, Ref{ZZRingElem}, Int, Ptr{UInt8}), - d, char, deg, string(s)) - return d - end - end - - function FqPolyRepField(f::ZZModPolyRingElem, s::Symbol, cached::Bool = true; check::Bool = true) - check && !is_probable_prime(modulus(f)) && - throw(DomainError(base_ring(f), "the base ring of the polynomial must be a field")) - return get_cached!(FqFiniteFieldIDFmpzPol, (f, s), cached) do - z = new() - ccall((:fq_ctx_init_modulus, libflint), Nothing, - (Ref{FqPolyRepField}, Ref{ZZModPolyRingElem}, Ref{fmpz_mod_ctx_struct}, Ptr{UInt8}), - z, f, base_ring(parent(f)).ninv, string(s)) - finalizer(_FqFiniteField_clear_fn, z) - return z - end - end - - function FqPolyRepField(f::FpPolyRingElem, s::Symbol, cached::Bool = true; check::Bool = true) - # check ignored - return get_cached!(FqFiniteFieldIDGFPPol, (f, s), cached) do - z = new() - ccall((:fq_ctx_init_modulus, libflint), Nothing, - (Ref{FqPolyRepField}, Ref{FpPolyRingElem}, Ref{fmpz_mod_ctx_struct}, Ptr{UInt8}), - z, f, base_ring(parent(f)).ninv, string(s)) - finalizer(_FqFiniteField_clear_fn, z) - return z - end - end +@doc raw""" + FqPolyRepField <: FinField + +A finite field. Implemented as $\mathbb F_p[t]/f$ for the prime $p$ being a [`ZZRingElem`](@ref). +See [`fqPolyRepField`](@ref) for $p$ being an [`Int`](@ref). See [`FqPolyRepFieldElem`](@ref) for elements. +""" +@attributes mutable struct FqPolyRepField <: FinField + p::Int # fmpz_t + add_fxn::Ptr{Nothing} + sub_fxn::Ptr{Nothing} + mul_fxn::Ptr{Nothing} + n2::UInt + ninv::UInt + norm::UInt + n_limbs::Tuple{UInt, UInt, UInt} + ninv_limbs::Tuple{UInt, UInt, UInt} + ninv_huge::Ptr{Nothing} # fmpz_preinvn_struct + + sparse_modulus :: Cint + is_conway :: Cint + a::Ptr{Nothing} + j::Ptr{Nothing} + len::Int + mod_coeffs::Ptr{Nothing} + mod_alloc::Int + mod_length::Int + inv_coeffs::Ptr{Nothing} + inv_alloc::Int + inv_length::Int + var::Ptr{Nothing} + # end of flint struct + + overfields :: Dict{Int, Vector{FinFieldMorphism}} + subfields :: Dict{Int, Vector{FinFieldMorphism}} + + function FqPolyRepField(char::ZZRingElem, deg::Int, s::Symbol, cached::Bool = true; check::Bool = true) + check && !is_probable_prime(char) && + throw(DomainError(char, "the characteristic must be a prime")) + return get_cached!(FqFiniteFieldID, (char, deg, s), cached) do + d = new() + finalizer(_FqFiniteField_clear_fn, d) + ccall((:fq_ctx_init, libflint), Nothing, + (Ref{FqPolyRepField}, Ref{ZZRingElem}, Int, Ptr{UInt8}), + d, char, deg, string(s)) + return d + end + end + + function FqPolyRepField(f::ZZModPolyRingElem, s::Symbol, cached::Bool = true; check::Bool = true) + check && !is_probable_prime(modulus(f)) && + throw(DomainError(base_ring(f), "the base ring of the polynomial must be a field")) + return get_cached!(FqFiniteFieldIDFmpzPol, (f, s), cached) do + z = new() + ccall((:fq_ctx_init_modulus, libflint), Nothing, + (Ref{FqPolyRepField}, Ref{ZZModPolyRingElem}, Ref{fmpz_mod_ctx_struct}, Ptr{UInt8}), + z, f, base_ring(parent(f)).ninv, string(s)) + finalizer(_FqFiniteField_clear_fn, z) + return z + end + end + + function FqPolyRepField(f::FpPolyRingElem, s::Symbol, cached::Bool = true; check::Bool = true) + # check ignored + return get_cached!(FqFiniteFieldIDGFPPol, (f, s), cached) do + z = new() + ccall((:fq_ctx_init_modulus, libflint), Nothing, + (Ref{FqPolyRepField}, Ref{FpPolyRingElem}, Ref{fmpz_mod_ctx_struct}, Ptr{UInt8}), + z, f, base_ring(parent(f)).ninv, string(s)) + finalizer(_FqFiniteField_clear_fn, z) + return z + end end end @@ -5303,7 +5235,6 @@ mutable struct ZZModMatrix <: MatElem{ZZModRingElem} r::Int c::Int rows::Ptr{Nothing} - mod::Int # ZZRingElem # end flint struct base_ring::ZZModRing @@ -5315,50 +5246,63 @@ mutable struct ZZModMatrix <: MatElem{ZZModRingElem} return z end - function ZZModMatrix(r::Int, c::Int, n::ZZRingElem) + function ZZModMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct) z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{ZZModMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{ZZModMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_fmpz_mod_mat_clear_fn, z) return z end - function ZZModMatrix(r::Int, c::Int, n::ZZRingElem, arr::AbstractMatrix{ZZRingElem}, transpose::Bool = false) + function ZZModMatrix(r::Int, c::Int, R::ZZModRing) + ZZModMatrix(r, c, R.ninv) + end + + function ZZModMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct, arr::AbstractMatrix{ZZRingElem}, transpose::Bool = false) z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{ZZModMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{ZZModMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_fmpz_mod_mat_clear_fn, z) if transpose arr = Base.transpose(arr) end for i = 1:r for j = 1:c - setindex_raw!(z, mod(arr[i, j], n), i, j) + setindex_raw!(z, _reduce(arr[i, j], ctx), i, j) end end return z end - function ZZModMatrix(r::Int, c::Int, n::ZZRingElem, arr::AbstractMatrix{T}, transpose::Bool = false) where T <: Integer + function ZZModMatrix(r::Int, c::Int, R::ZZModRing, arr::AbstractMatrix{ZZRingElem}, transpose::Bool = false) + ZZModMatrix(r, c, R.ninv, arr, transpose) + end + + function ZZModMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct, arr::AbstractMatrix{T}, transpose::Bool = false) where T <: Integer z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{ZZModMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{ZZModMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_fmpz_mod_mat_clear_fn, z) if transpose arr = Base.transpose(arr) end for i = 1:r for j = 1:c - setindex_raw!(z, mod(ZZRingElem(arr[i, j]), n), i, j) + setindex_raw!(z, _reduce(ZZRingElem(arr[i, j]), ctx), i, j) end end return z end - function ZZModMatrix(r::Int, c::Int, n::ZZRingElem, arr::AbstractMatrix{ZZModRingElem}, transpose::Bool = false) + function ZZModMatrix(r::Int, c::Int, R::ZZModRing, arr::AbstractMatrix{T}, transpose::Bool = false) where T <: Integer + ZZModMatrix(r, c, R.ninv, arr, transpose) + end + + function ZZModMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct, arr::AbstractMatrix{ZZModRingElem}, transpose::Bool = false) + # FIXME: Check compatibility between ctx and arr? z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{ZZModMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{ZZModMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_fmpz_mod_mat_clear_fn, z) if transpose arr = Base.transpose(arr) @@ -5371,36 +5315,49 @@ mutable struct ZZModMatrix <: MatElem{ZZModRingElem} return z end - function ZZModMatrix(r::Int, c::Int, n::ZZRingElem, arr::AbstractVector{ZZRingElem}) + function ZZModMatrix(r::Int, c::Int, R::ZZModRing, arr::AbstractMatrix{ZZModRingElem}, transpose::Bool = false) + ZZModMatrix(r, c, R, arr, transpose) + end + + function ZZModMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct, arr::AbstractVector{ZZRingElem}) z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{ZZModMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{ZZModMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_fmpz_mod_mat_clear_fn, z) for i = 1:r for j = 1:c - setindex_raw!(z, mod(arr[(i - 1)*c + j], n), i, j) + setindex_raw!(z, _reduce(arr[(i - 1)*c + j], ctx), i, j) end end return z end - function ZZModMatrix(r::Int, c::Int, n::ZZRingElem, arr::AbstractVector{T}) where T <: Integer + function ZZModMatrix(r::Int, c::Int, R::ZZModRing, arr::AbstractVector{ZZRingElem}) + ZZModMatrix(r, c, R.ninv, arr) + end + + function ZZModMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct, arr::AbstractVector{T}) where T <: Integer z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{ZZModMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{ZZModMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_fmpz_mod_mat_clear_fn, z) for i = 1:r for j = 1:c - setindex_raw!(z, mod(ZZRingElem(arr[(i - 1)*c + j]), n), i, j) + setindex_raw!(z, _reduce(ZZRingElem(arr[(i - 1)*c + j]), ctx), i, j) end end return z end - function ZZModMatrix(r::Int, c::Int, n::ZZRingElem, arr::AbstractVector{ZZModRingElem}) + function ZZModMatrix(r::Int, c::Int, R::ZZModRing, arr::AbstractVector{T}) where T <: Integer + ZZModMatrix(r, c, R.ninv, arr) + end + + function ZZModMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct, arr::AbstractVector{ZZModRingElem}) + # FIXME: Check compatibility between ctx and arr? z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{ZZModMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{ZZModMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_fmpz_mod_mat_clear_fn, z) for i = 1:r for j = 1:c @@ -5421,12 +5378,14 @@ mutable struct ZZModMatrix <: MatElem{ZZModRingElem} function ZZModMatrix(n::ZZRingElem, b::ZZMatrix) (n < 2) && error("Modulus must be >= 2") z = new() + R = ZZModRing(n) ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{ZZModMatrix}, Int, Int, Ref{ZZRingElem}), z, b.r, b.c, n) + (Ref{ZZModMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), + z, b.r, b.c, R.ninv) finalizer(_fmpz_mod_mat_clear_fn, z) for i = 1:b.r for j = 1:b.c - setindex_raw!(z, mod(ZZRingElem(b[i,j]), n), i, j) + setindex_raw!(z, _reduce(b[i,j], R.ninv), i, j) end end return z @@ -5435,7 +5394,8 @@ end function _fmpz_mod_mat_clear_fn(mat::ZZModMatrix) - ccall((:fmpz_mod_mat_clear, libflint), Nothing, (Ref{ZZModMatrix}, ), mat) + ccall((:fmpz_mod_mat_clear, libflint), Nothing, + (Ref{ZZModMatrix}, Ref{Nothing}), mat, C_NULL) # Hack end ############################################################################### @@ -5462,7 +5422,6 @@ mutable struct FpMatrix <: MatElem{FpFieldElem} r::Int c::Int rows::Ptr{Nothing} - mod::Int # ZZRingElem # end flint struct base_ring::FpField @@ -5474,50 +5433,51 @@ mutable struct FpMatrix <: MatElem{FpFieldElem} return z end - function FpMatrix(r::Int, c::Int, n::ZZRingElem) + function FpMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct) z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{FpMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{FpMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_gfp_fmpz_mat_clear_fn, z) return z end - function FpMatrix(r::Int, c::Int, n::ZZRingElem, arr::AbstractMatrix{ZZRingElem}, transpose::Bool = false) + function FpMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct, arr::AbstractMatrix{ZZRingElem}, transpose::Bool = false) z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{FpMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{FpMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_gfp_fmpz_mat_clear_fn, z) if transpose arr = Base.transpose(arr) end for i = 1:r for j = 1:c - setindex_raw!(z, mod(arr[i, j], n), i, j) + setindex_raw!(z, _reduce(arr[i, j], ctx), i, j) end end return z end - function FpMatrix(r::Int, c::Int, n::ZZRingElem, arr::AbstractMatrix{T}, transpose::Bool = false) where T <: Integer + function FpMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct, arr::AbstractMatrix{T}, transpose::Bool = false) where T <: Integer z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{FpMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{FpMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_gfp_fmpz_mat_clear_fn, z) if transpose arr = Base.transpose(arr) end for i = 1:r for j = 1:c - setindex_raw!(z, mod(ZZRingElem(arr[i, j]), n), i, j) + setindex_raw!(z, _reduce(ZZRingElem(arr[i, j]), ctx), i, j) end end return z end - function FpMatrix(r::Int, c::Int, n::ZZRingElem, arr::AbstractMatrix{FpFieldElem}, transpose::Bool = false) + function FpMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct, arr::AbstractMatrix{FpFieldElem}, transpose::Bool = false) + # FIXME: Check compatibility between ctx and arr? z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{FpMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{FpMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_gfp_fmpz_mat_clear_fn, z) if transpose arr = Base.transpose(arr) @@ -5530,36 +5490,37 @@ mutable struct FpMatrix <: MatElem{FpFieldElem} return z end - function FpMatrix(r::Int, c::Int, n::ZZRingElem, arr::AbstractVector{ZZRingElem}) + function FpMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct, arr::AbstractVector{ZZRingElem}) z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{FpMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{FpMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_gfp_fmpz_mat_clear_fn, z) for i = 1:r for j = 1:c - setindex_raw!(z, mod(arr[(i - 1)*c + j], n), i, j) + setindex_raw!(z, _reduce(arr[(i - 1)*c + j], ctx), i, j) end end return z end - function FpMatrix(r::Int, c::Int, n::ZZRingElem, arr::AbstractVector{T}) where T <: Integer + function FpMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct, arr::AbstractVector{T}) where T <: Integer z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{FpMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{FpMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_gfp_fmpz_mat_clear_fn, z) for i = 1:r for j = 1:c - setindex_raw!(z, mod(ZZRingElem(arr[(i - 1)*c + j]), n), i, j) + setindex_raw!(z, _reduce(ZZRingElem(arr[(i - 1)*c + j]), ctx), i, j) end end return z end - function FpMatrix(r::Int, c::Int, n::ZZRingElem, arr::AbstractVector{FpFieldElem}) + function FpMatrix(r::Int, c::Int, ctx::fmpz_mod_ctx_struct, arr::AbstractVector{FpFieldElem}) + # FIXME: Check compatibility between ctx and arr? z = new() ccall((:fmpz_mod_mat_init, libflint), Nothing, - (Ref{FpMatrix}, Int, Int, Ref{ZZRingElem}), z, r, c, n) + (Ref{FpMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), z, r, c, ctx) finalizer(_gfp_fmpz_mat_clear_fn, z) for i = 1:r for j = 1:c @@ -5571,7 +5532,8 @@ mutable struct FpMatrix <: MatElem{FpFieldElem} end function _gfp_fmpz_mat_clear_fn(mat::FpMatrix) - ccall((:fmpz_mod_mat_clear, libflint), Nothing, (Ref{FpMatrix}, ), mat) + ccall((:fmpz_mod_mat_clear, libflint), Nothing, + (Ref{FpMatrix}, Ref{Nothing}), mat, C_NULL) # Hack end ################################################################################ diff --git a/src/flint/fmpq.jl b/src/flint/fmpq.jl index 649ffd394..84e65ab14 100644 --- a/src/flint/fmpq.jl +++ b/src/flint/fmpq.jl @@ -917,7 +917,7 @@ julia> d = bernoulli(12) function bernoulli(n::Int) n < 0 && throw(DomainError(n, "Index must be non-negative")) c = QQFieldElem() - ccall((:bernoulli_fmpq_ui, libarb), Nothing, (Ref{QQFieldElem}, Int), c, n) + ccall((:bernoulli_fmpq_ui, libflint), Nothing, (Ref{QQFieldElem}, Int), c, n) return c end @@ -943,7 +943,7 @@ julia> e = bernoulli(100) function bernoulli_cache(n::Int) n = n + 1 n < 0 && throw(DomainError(n, "Index must be non-negative")) - ccall((:bernoulli_cache_compute, libarb), Nothing, (Int,), n) + ccall((:bernoulli_cache_compute, libflint), Nothing, (Int,), n) end @doc raw""" diff --git a/src/flint/fmpz.jl b/src/flint/fmpz.jl index 3093cee4a..a2a0cb819 100644 --- a/src/flint/fmpz.jl +++ b/src/flint/fmpz.jl @@ -2127,7 +2127,7 @@ function number_of_partitions(x::Int) return 0 end z = ZZRingElem() - ccall((:partitions_fmpz_ui, libarb), Nothing, + ccall((:partitions_fmpz_ui, libflint), Nothing, (Ref{ZZRingElem}, UInt), z, x) return Int(z) end @@ -2137,7 +2137,7 @@ function number_of_partitions(x::ZZRingElem) if x < 0 return z end - ccall((:partitions_fmpz_fmpz, libarb), Nothing, + ccall((:partitions_fmpz_fmpz, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Int), z, x, 0) return z end diff --git a/src/flint/fmpz_mod.jl b/src/flint/fmpz_mod.jl index 0bed4d355..d931f7707 100644 --- a/src/flint/fmpz_mod.jl +++ b/src/flint/fmpz_mod.jl @@ -64,6 +64,14 @@ end characteristic(R::ZZModRing) = modulus(R) +function _reduce(a::ZZRingElem, ctx::fmpz_mod_ctx_struct) + b = ZZRingElem() + ccall((:fmpz_mod_set_fmpz, libflint), Nothing, + (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{fmpz_mod_ctx_struct}), + b, a, ctx) + return b +end + ############################################################################### # # Canonicalisation diff --git a/src/flint/fmpz_mod_mat.jl b/src/flint/fmpz_mod_mat.jl index 8ca6067ed..7a043fbc4 100644 --- a/src/flint/fmpz_mod_mat.jl +++ b/src/flint/fmpz_mod_mat.jl @@ -32,7 +32,7 @@ end ############################################################################### function similar(::MatElem, R::ZZModRing, r::Int, c::Int) - z = ZZModMatrix(r, c, R.n) + z = ZZModMatrix(r, c, R.ninv) z.base_ring = R return z end @@ -47,7 +47,8 @@ end @boundscheck Generic._checkbounds(a, i, j) u = ZZRingElem() ccall((:fmpz_mod_mat_get_entry, libflint), Nothing, - (Ref{ZZRingElem}, Ref{T}, Int, Int), u, a, i - 1 , j - 1) + (Ref{ZZRingElem}, Ref{T}, Int, Int, Ref{fmpz_mod_ctx_struct}), + u, a, i - 1 , j - 1, base_ring(a).ninv) return ZZModRingElem(u, base_ring(a)) # no reduction needed end @@ -55,14 +56,15 @@ end function getindex_raw(a::T, i::Int, j::Int) where T <: Zmod_fmpz_mat u = ZZRingElem() ccall((:fmpz_mod_mat_get_entry, libflint), Nothing, - (Ref{ZZRingElem}, Ref{T}, Int, Int), u, a, i - 1, j - 1) + (Ref{ZZRingElem}, Ref{T}, Int, Int, Ref{fmpz_mod_ctx_struct}), + u, a, i - 1, j - 1, base_ring(a).ninv) return u end @inline function setindex!(a::T, u::ZZRingElem, i::Int, j::Int) where T <: Zmod_fmpz_mat @boundscheck Generic._checkbounds(a, i, j) R = base_ring(a) - setindex_raw!(a, mod(u, R.n), i, j) + setindex_raw!(a, _reduce(u, R.ninv), i, j) end @inline function setindex!(a::T, u::ZZModRingElem, i::Int, j::Int) where T <: Zmod_fmpz_mat @@ -78,7 +80,8 @@ end # as per setindex! but no reduction mod n and no bounds checking @inline function setindex_raw!(a::T, u::ZZRingElem, i::Int, j::Int) where T <: Zmod_fmpz_mat ccall((:fmpz_mod_mat_set_entry, libflint), Nothing, - (Ref{T}, Int, Int, Ref{ZZRingElem}), a, i - 1, j - 1, u) + (Ref{T}, Int, Int, Ref{ZZRingElem}, Ref{Nothing}), + a, i - 1, j - 1, u, C_NULL) # ctx is not needed here end function setindex!(a::ZZModMatrix, b::ZZModMatrix, r::UnitRange{Int64}, c::UnitRange{Int64}) @@ -86,16 +89,17 @@ function setindex!(a::ZZModMatrix, b::ZZModMatrix, r::UnitRange{Int64}, c::UnitR size(b) == (length(r), length(c)) || throw(DimensionMismatch("tried to assign a $(size(b, 1))x$(size(b, 2)) matrix to a $(length(r))x$(length(c)) destination")) A = view(a, r, c) ccall((:fmpz_mod_mat_set, libflint), Nothing, - (Ref{ZZModMatrix}, Ref{ZZModMatrix}), A, b) + (Ref{ZZModMatrix}, Ref{ZZModMatrix}, Ref{Nothing}), A, b, C_NULL) # ctx not used end function deepcopy_internal(a::ZZModMatrix, dict::IdDict) - z = ZZModMatrix(nrows(a), ncols(a), modulus(base_ring(a))) + z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv) if isdefined(a, :base_ring) z.base_ring = a.base_ring end ccall((:fmpz_mod_mat_set, libflint), Nothing, - (Ref{ZZModMatrix}, Ref{ZZModMatrix}), z, a) + (Ref{ZZModMatrix}, Ref{ZZModMatrix}, Ref{fmpz_mod_ctx_struct}), + z, a, base_ring(a).ninv) return z end @@ -118,12 +122,14 @@ zero(a::ZZModMatrixSpace) = a() function one(a::ZZModMatrixSpace) (nrows(a) != ncols(a)) && error("Matrices must be square") z = a() - ccall((:fmpz_mod_mat_one, libflint), Nothing, (Ref{ZZModMatrix}, ), z) + ccall((:fmpz_mod_mat_one, libflint), Nothing, + (Ref{ZZModMatrix}, Ref{fmpz_mod_ctx_struct}), z, base_ring(a).ninv) return z end function iszero(a::T) where T <: Zmod_fmpz_mat - r = ccall((:fmpz_mod_mat_is_zero, libflint), Cint, (Ref{T}, ), a) + r = ccall((:fmpz_mod_mat_is_zero, libflint), Cint, + (Ref{T}, Ref{fmpz_mod_ctx_struct}), a, base_ring(a).ninv) return Bool(r) end @@ -135,7 +141,8 @@ end ==(a::T, b::T) where T <: Zmod_fmpz_mat = (a.base_ring == b.base_ring) && Bool(ccall((:fmpz_mod_mat_equal, libflint), Cint, - (Ref{T}, Ref{T}), a, b)) + (Ref{T}, Ref{T}, Ref{fmpz_mod_ctx_struct}), + a, b, base_ring(a).ninv)) isequal(a::T, b::T) where T <: Zmod_fmpz_mat = ==(a, b) @@ -148,14 +155,14 @@ isequal(a::T, b::T) where T <: Zmod_fmpz_mat = ==(a, b) function transpose(a::T) where T <: Zmod_fmpz_mat z = similar(a, ncols(a), nrows(a)) ccall((:fmpz_mod_mat_transpose, libflint), Nothing, - (Ref{T}, Ref{T}), z, a) + (Ref{T}, Ref{T}, Ref{fmpz_mod_ctx_struct}), z, a, base_ring(a).ninv) return z end function transpose!(a::T) where T <: Zmod_fmpz_mat !is_square(a) && error("Matrix must be a square matrix") ccall((:fmpz_mod_mat_transpose, libflint), Nothing, - (Ref{T}, Ref{T}), a, a) + (Ref{T}, Ref{T}, Ref{fmpz_mod_ctx_struct}), a, a, base_ring(a).ninv) end ############################################################################### @@ -217,7 +224,7 @@ reverse_cols(x::T) where T <: Zmod_fmpz_mat = reverse_cols!(deepcopy(x)) function -(x::T) where T <: Zmod_fmpz_mat z = similar(x) ccall((:fmpz_mod_mat_neg, libflint), Nothing, - (Ref{T}, Ref{T}), z, x) + (Ref{T}, Ref{T}, Ref{fmpz_mod_ctx_struct}), z, x, base_ring(x).ninv) return z end @@ -231,7 +238,8 @@ function +(x::T, y::T) where T <: Zmod_fmpz_mat check_parent(x,y) z = similar(x) ccall((:fmpz_mod_mat_add, libflint), Nothing, - (Ref{T}, Ref{T}, Ref{T}), z, x, y) + (Ref{T}, Ref{T}, Ref{T}, Ref{fmpz_mod_ctx_struct}), + z, x, y, base_ring(x).ninv) return z end @@ -239,7 +247,8 @@ function -(x::T, y::T) where T <: Zmod_fmpz_mat check_parent(x,y) z = similar(x) ccall((:fmpz_mod_mat_sub, libflint), Nothing, - (Ref{T}, Ref{T}, Ref{T}), z, x, y) + (Ref{T}, Ref{T}, Ref{T}, Ref{fmpz_mod_ctx_struct}), + z, x, y, base_ring(x).ninv) return z end @@ -248,7 +257,8 @@ function *(x::T, y::T) where T <: Zmod_fmpz_mat (ncols(x) != nrows(y)) && error("Dimensions are wrong") z = similar(x, nrows(x), ncols(y)) ccall((:fmpz_mod_mat_mul, libflint), Nothing, - (Ref{T}, Ref{T}, Ref{T}), z, x, y) + (Ref{T}, Ref{T}, Ref{T}, Ref{fmpz_mod_ctx_struct}), + z, x, y, base_ring(x).ninv) return z end @@ -260,31 +270,36 @@ end ################################################################################ function mul!(a::T, b::T, c::T) where T <: Zmod_fmpz_mat - ccall((:fmpz_mod_mat_mul, libflint), Nothing, (Ref{T}, Ref{T}, Ref{T}), a, b, c) + ccall((:fmpz_mod_mat_mul, libflint), Nothing, + (Ref{T}, Ref{T}, Ref{T}, Ref{fmpz_mod_ctx_struct}), + a, b, c, base_ring(b).ninv) return a end function add!(a::T, b::T, c::T) where T <: Zmod_fmpz_mat - ccall((:fmpz_mod_mat_add, libflint), Nothing, (Ref{T}, Ref{T}, Ref{T}), a, b, c) + ccall((:fmpz_mod_mat_add, libflint), Nothing, + (Ref{T}, Ref{T}, Ref{T}, Ref{fmpz_mod_ctx_struct}), + a, b, c, base_ring(b).ninv) return a end function zero!(a::T) where T <: Zmod_fmpz_mat - ccall((:fmpz_mod_mat_zero, libflint), Nothing, (Ref{T}, ), a) + ccall((:fmpz_mod_mat_zero, libflint), Nothing, + (Ref{T}, Ref{fmpz_mod_ctx_struct}), a, base_ring(a).ninv) return a end function mul!(z::Vector{ZZRingElem}, a::T, b::Vector{ZZRingElem}) where T <: Zmod_fmpz_mat ccall((:fmpz_mod_mat_mul_fmpz_vec_ptr, libflint), Nothing, - (Ptr{Ref{ZZRingElem}}, Ref{T}, Ptr{Ref{ZZRingElem}}, Int), - z, a, b, length(b)) + (Ptr{Ref{ZZRingElem}}, Ref{T}, Ptr{Ref{ZZRingElem}}, Int, Ref{fmpz_mod_ctx_struct}), + z, a, b, length(b), base_ring(a).ninv) return z end function mul!(z::Vector{ZZRingElem}, a::Vector{ZZRingElem}, b::T) where T <: Zmod_fmpz_mat ccall((:fmpz_mod_mat_fmpz_vec_mul_ptr, libflint), Nothing, - (Ptr{Ref{ZZRingElem}}, Ptr{Ref{ZZRingElem}}, Int, Ref{T}), - z, a, length(a), b) + (Ptr{Ref{ZZRingElem}}, Ptr{Ref{ZZRingElem}}, Int, Ref{T}, Ref{fmpz_mod_ctx_struct}), + z, a, length(a), b, base_ring(b).ninv) return z end @@ -308,7 +323,8 @@ end function *(x::T, y::Int) where T <: Zmod_fmpz_mat z = similar(x) ccall((:fmpz_mod_mat_scalar_mul_si, libflint), Nothing, - (Ref{T}, Ref{T}, Int), z, x, y) + (Ref{T}, Ref{T}, Int, Ref{fmpz_mod_ctx_struct}), + z, x, y, base_ring(x).ninv) return z end @@ -317,7 +333,8 @@ end function *(x::T, y::ZZRingElem) where T <: Zmod_fmpz_mat z = similar(x) ccall((:fmpz_mod_mat_scalar_mul_fmpz, libflint), Nothing, - (Ref{T}, Ref{T}, Ref{ZZRingElem}), z, x, y) + (Ref{T}, Ref{T}, Ref{ZZRingElem}, Ref{fmpz_mod_ctx_struct}), + z, x, y, base_ring(x).ninv) return z end @@ -371,7 +388,8 @@ end ################################################################################ function strong_echelon_form!(a::T) where T <: Zmod_fmpz_mat - ccall((:fmpz_mod_mat_strong_echelon_form, libflint), Nothing, (Ref{T}, ), a) + ccall((:fmpz_mod_mat_strong_echelon_form, libflint), Nothing, + (Ref{T}, Ref{fmpz_mod_ctx_struct}), a, base_ring(a).ninv) end @doc raw""" @@ -389,7 +407,8 @@ function strong_echelon_form(a::ZZModMatrix) end function howell_form!(a::T) where T <: Zmod_fmpz_mat - ccall((:fmpz_mod_mat_howell_form, libflint), Nothing, (Ref{T}, ), a) + ccall((:fmpz_mod_mat_howell_form, libflint), Nothing, + (Ref{T}, Ref{fmpz_mod_ctx_struct}), a, base_ring(a).ninv) end @doc raw""" @@ -417,7 +436,9 @@ function tr(a::T) where T <: Zmod_fmpz_mat !is_square(a) && error("Matrix must be a square matrix") R = base_ring(a) r = ZZRingElem() - ccall((:fmpz_mod_mat_trace, libflint), Nothing, (Ref{ZZRingElem}, Ref{T}), r, a) + ccall((:fmpz_mod_mat_trace, libflint), Nothing, + (Ref{ZZRingElem}, Ref{T}, Ref{fmpz_mod_ctx_struct}), + r, a, base_ring(a).ninv) return ZZModRingElem(r, R) end @@ -514,7 +535,7 @@ function Solve._can_solve_internal_no_check(A::ZZModMatrix, b::ZZModMatrix, task x = similar(A, ncols(A), ncols(b)) # This is probably only correct if the characteristic is prime fl = ccall((:fmpz_mod_mat_can_solve, libflint), Cint, - (Ref{ZZModMatrix}, Ref{ZZModMatrix}, Ref{ZZModMatrix}), x, A, b) + (Ref{ZZModMatrix}, Ref{ZZModMatrix}, Ref{ZZModMatrix}, Ref{fmpz_mod_ctx_struct}), x, A, b, base_ring(x).ninv) if task === :only_check || task === :with_solution return Bool(fl), x, zero(A, 0, 0) end @@ -599,8 +620,8 @@ function Base.view(x::ZZModMatrix, r1::Int, c1::Int, r2::Int, c2::Int) z.base_ring = x.base_ring z.view_parent = x ccall((:fmpz_mod_mat_window_init, libflint), Nothing, - (Ref{ZZModMatrix}, Ref{ZZModMatrix}, Int, Int, Int, Int), - z, x, r1 - 1, c1 - 1, r2, c2) + (Ref{ZZModMatrix}, Ref{ZZModMatrix}, Int, Int, Int, Int, Ref{fmpz_mod_ctx_struct}), + z, x, r1 - 1, c1 - 1, r2, c2, base_ring(x).ninv) finalizer(_fmpz_mod_mat_window_clear_fn, z) return z end @@ -610,7 +631,8 @@ function Base.view(x::T, r::AbstractUnitRange{Int}, c::AbstractUnitRange{Int}) w end function _fmpz_mod_mat_window_clear_fn(a::ZZModMatrix) - ccall((:fmpz_mod_mat_window_clear, libflint), Nothing, (Ref{ZZModMatrix}, ), a) + ccall((:fmpz_mod_mat_window_clear, libflint), Nothing, + (Ref{ZZModMatrix}, Ref{fmpz_mod_ctx_struct}), a, base_ring(a).ninv) end function sub(x::T, r1::Int, c1::Int, r2::Int, c2::Int) where T <: Zmod_fmpz_mat @@ -636,7 +658,8 @@ function hcat(x::T, y::T) where T <: Zmod_fmpz_mat (x.r != y.r) && error("Matrices must have same number of rows") z = similar(x, nrows(x), ncols(x) + ncols(y)) ccall((:fmpz_mod_mat_concat_horizontal, libflint), Nothing, - (Ref{T}, Ref{T}, Ref{T}), z, x, y) + (Ref{T}, Ref{T}, Ref{T}, Ref{fmpz_mod_ctx_struct}), + z, x, y, base_ring(x).ninv) return z end @@ -645,7 +668,8 @@ function vcat(x::T, y::T) where T <: Zmod_fmpz_mat (x.c != y.c) && error("Matrices must have same number of columns") z = similar(x, nrows(x) + nrows(y), ncols(x)) ccall((:fmpz_mod_mat_concat_vertical, libflint), Nothing, - (Ref{T}, Ref{T}, Ref{T}), z, x, y) + (Ref{T}, Ref{T}, Ref{T}, Ref{fmpz_mod_ctx_struct}), + z, x, y, base_ring(x).ninv) return z end @@ -748,7 +772,7 @@ promote_rule(::Type{ZZModMatrix}, ::Type{ZZRingElem}) = ZZModMatrix ################################################################################ function (a::ZZModMatrixSpace)() - z = ZZModMatrix(nrows(a), ncols(a), modulus(base_ring(a))) + z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv) z.base_ring = a.base_ring return z end @@ -798,42 +822,42 @@ end function (a::ZZModMatrixSpace)(arr::AbstractMatrix{BigInt}, transpose::Bool = false) _check_dim(nrows(a), ncols(a), arr, transpose) - z = ZZModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr, transpose) + z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr, transpose) z.base_ring = a.base_ring return z end function (a::ZZModMatrixSpace)(arr::AbstractVector{BigInt}) _check_dim(nrows(a), ncols(a), arr) - z = ZZModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) + z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) z.base_ring = a.base_ring return z end function (a::ZZModMatrixSpace)(arr::AbstractMatrix{ZZRingElem}, transpose::Bool = false) _check_dim(nrows(a), ncols(a), arr, transpose) - z = ZZModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr, transpose) + z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr, transpose) z.base_ring = a.base_ring return z end function (a::ZZModMatrixSpace)(arr::AbstractVector{ZZRingElem}) _check_dim(nrows(a), ncols(a), arr) - z = ZZModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) + z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) z.base_ring = a.base_ring return z end function (a::ZZModMatrixSpace)(arr::AbstractMatrix{Int}, transpose::Bool = false) _check_dim(nrows(a), ncols(a), arr, transpose) - z = ZZModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr, transpose) + z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr, transpose) z.base_ring = a.base_ring return z end function (a::ZZModMatrixSpace)(arr::AbstractVector{Int}) _check_dim(nrows(a), ncols(a), arr) - z = ZZModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) + z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) z.base_ring = a.base_ring return z end @@ -841,7 +865,7 @@ end function (a::ZZModMatrixSpace)(arr::AbstractMatrix{ZZModRingElem}, transpose::Bool = false) _check_dim(nrows(a), ncols(a), arr, transpose) (length(arr) > 0 && (base_ring(a) != parent(arr[1]))) && error("Elements must have same base ring") - z = ZZModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr, transpose) + z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr, transpose) z.base_ring = a.base_ring return z end @@ -849,14 +873,17 @@ end function (a::ZZModMatrixSpace)(arr::AbstractVector{ZZModRingElem}) _check_dim(nrows(a), ncols(a), arr) (length(arr) > 0 && (base_ring(a) != parent(arr[1]))) && error("Elements must have same base ring") - z = ZZModMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) + z = ZZModMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) z.base_ring = a.base_ring return z end function (a::ZZModMatrixSpace)(b::ZZMatrix) (ncols(a) != b.c || nrows(a) != b.r) && error("Dimensions do not fit") - z = ZZModMatrix(modulus(base_ring(a)), b) + z = ZZModMatrix(b.r, b.c, base_ring(a).ninv) + ccall((:fmpz_mod_mat_set_fmpz_mat, libflint), Nothing, + (Ref{ZZModMatrix}, Ref{ZZMatrix}, Ref{fmpz_mod_ctx_struct}), + z, b, base_ring(a).ninv) z.base_ring = a.base_ring return z end @@ -868,14 +895,14 @@ end ############################################################################### function matrix(R::ZZModRing, arr::AbstractMatrix{<: Union{ZZModRingElem, ZZRingElem, Integer}}) - z = ZZModMatrix(size(arr, 1), size(arr, 2), R.n, arr) + z = ZZModMatrix(size(arr, 1), size(arr, 2), R.ninv, arr) z.base_ring = R return z end function matrix(R::ZZModRing, r::Int, c::Int, arr::AbstractVector{<: Union{ZZModRingElem, ZZRingElem, Integer}}) _check_dim(r, c, arr) - z = ZZModMatrix(r, c, R.n, arr) + z = ZZModMatrix(r, c, R.ninv, arr) z.base_ring = R return z end @@ -890,7 +917,7 @@ function zero_matrix(R::ZZModRing, r::Int, c::Int) if r < 0 || c < 0 error("dimensions must not be negative") end - z = ZZModMatrix(r, c, R.n) + z = ZZModMatrix(r, c, R.ninv) z.base_ring = R return z end @@ -965,7 +992,7 @@ function nullspace(M::ZZModMatrix) # Apparently this only works correctly if base_ring(M) is a field N = similar(M, ncols(M), ncols(M)) nullity = ccall((:fmpz_mod_mat_nullspace, libflint), Int, - (Ref{ZZModMatrix}, Ref{ZZModMatrix}), N, M) + (Ref{ZZModMatrix}, Ref{ZZModMatrix}, Ref{fmpz_mod_ctx_struct}), N, M, base_ring(N).ninv) return nullity, view(N, 1:nrows(N), 1:nullity) end diff --git a/src/flint/fq_default.jl b/src/flint/fq_default.jl index 3a79637aa..7c4147b0f 100644 --- a/src/flint/fq_default.jl +++ b/src/flint/fq_default.jl @@ -286,12 +286,12 @@ end function _get_raw_type(::Type{fpField}, F::FqField) @assert _fq_default_ctx_type(F) == 4 - return Native.GF(UInt(order(F))) + return Native.GF(UInt(order(F)), cached = false) end function _get_raw_type(::Type{FpField}, F::FqField) @assert _fq_default_ctx_type(F) == 5 - return Native.GF(order(F)) + return Native.GF(order(F), cached = false) end # image/preimage diff --git a/src/flint/fq_default_extended.jl b/src/flint/fq_default_extended.jl index f091aa768..eed1f347f 100644 --- a/src/flint/fq_default_extended.jl +++ b/src/flint/fq_default_extended.jl @@ -527,20 +527,27 @@ function _fq_field_from_fmpz_mod_poly_in_disguise(f::FqPolyRingElem, s::Symbol) # f is an fmpz_mod_poly in disguise # I cannot use the FqField constructor, since f has the wrong type # on the julia side - z = @new_struct(FqField) # this is just new() usable outside the type definition - z.var = string(s) - # I need to get to the fmpz_mod_ctx + # + # The following trick of picking the fmpz_mod_ctx_struct from the fq_default_ctx + # does not work anymore: + # # It is in K but the first 4 bytes are the type + # z = @new_struct(FqField) # this is just new() usable outside the type definition + # z.var = string(s) # Temporary hack #_K = _get_raw_type(FpField, K) - ss = string(s) - GC.@preserve K ss begin - ccall((:fq_default_ctx_init_modulus, libflint), Nothing, - (Ref{FqField}, Ref{FqPolyRingElem}, Ptr{Nothing}, Ptr{UInt8}), - #z, f, _K.ninv, string(s)) - z, f, pointer_from_objref(K) + 2 * sizeof(Cint), ss) - finalizer(_FqDefaultFiniteField_clear_fn, z) - end + # ss = string(s) + # GC.@preserve K ss begin + # ccall((:fq_default_ctx_init_modulus, libflint), Nothing, + # (Ref{FqField}, Ref{FqPolyRingElem}, Ptr{Nothing}, Ptr{UInt8}), + # #z, f, _K.ninv, string(s)) + # z, f, pointer_from_objref(K) + 2 * sizeof(Cint), ss) + # finalizer(_FqDefaultFiniteField_clear_fn, z) + # end + _K = _get_raw_type(FpField, K) + ff = map_coefficients(c -> _K(lift(ZZ, c)), f; cached = false) + z = FqField(ff, s, false; check = false) + z.isabsolute = true z.isstandard = true z.base_field = K diff --git a/src/flint/fq_default_mat.jl b/src/flint/fq_default_mat.jl index 34ea5a635..ed0792a19 100644 --- a/src/flint/fq_default_mat.jl +++ b/src/flint/fq_default_mat.jl @@ -366,15 +366,15 @@ end ################################################################################ function rref(a::FqMatrix) - z = deepcopy(a) + z = similar(a) r = ccall((:fq_default_mat_rref, libflint), Int, - (Ref{FqMatrix}, Ref{FqField}), z, base_ring(a)) + (Ref{FqMatrix}, Ref{FqMatrix}, Ref{FqField}), z, a, base_ring(a)) return r, z end function rref!(a::FqMatrix) r = ccall((:fq_default_mat_rref, libflint), Int, - (Ref{FqMatrix}, Ref{FqField}), a, base_ring(a)) + (Ref{FqMatrix}, Ref{FqMatrix}, Ref{FqField}), a, a, base_ring(a)) return r end diff --git a/src/flint/fq_mat.jl b/src/flint/fq_mat.jl index 3e12a7c8e..6f67820da 100644 --- a/src/flint/fq_mat.jl +++ b/src/flint/fq_mat.jl @@ -380,15 +380,17 @@ end ################################################################################ function rref(a::FqPolyRepMatrix) - z = deepcopy(a) + z = similar(a) r = ccall((:fq_mat_rref, libflint), Int, - (Ref{FqPolyRepMatrix}, Ref{FqPolyRepField}), z, base_ring(a)) + (Ref{FqPolyRepMatrix}, Ref{FqPolyRepMatrix}, Ref{FqPolyRepField}), + z, a, base_ring(a)) return r, z end function rref!(a::FqPolyRepMatrix) r = ccall((:fq_mat_rref, libflint), Int, - (Ref{FqPolyRepMatrix}, Ref{FqPolyRepField}), a, base_ring(a)) + (Ref{FqPolyRepMatrix}, Ref{FqPolyRepMatrix}, Ref{FqPolyRepField}), + a, a, base_ring(a)) return r end diff --git a/src/flint/fq_nmod.jl b/src/flint/fq_nmod.jl index 841472611..487593cf2 100644 --- a/src/flint/fq_nmod.jl +++ b/src/flint/fq_nmod.jl @@ -104,10 +104,7 @@ is_unit(a::fqPolyRepFieldElem) = ccall((:fq_nmod_is_invertible, libflint), Bool, (Ref{fqPolyRepFieldElem}, Ref{fqPolyRepField}), a, a.parent) function characteristic(a::fqPolyRepField) - d = ZZRingElem() - ccall((:__fq_nmod_ctx_prime, libflint), Nothing, - (Ref{ZZRingElem}, Ref{fqPolyRepField}), d, a) - return d + return ZZ(a.n) end function order(a::fqPolyRepField) @@ -118,8 +115,7 @@ function order(a::fqPolyRepField) end function degree(a::fqPolyRepField) - return ccall((:fq_nmod_ctx_degree, libflint), Int, - (Ref{fqPolyRepField},), a) + return ccall((:fq_nmod_ctx_degree, libflint), Int, (Ref{fqPolyRepField},), a) end function deepcopy_internal(d::fqPolyRepFieldElem, dict::IdDict) diff --git a/src/flint/fq_nmod_mat.jl b/src/flint/fq_nmod_mat.jl index cdb3f4fd6..c8541ec73 100644 --- a/src/flint/fq_nmod_mat.jl +++ b/src/flint/fq_nmod_mat.jl @@ -368,15 +368,17 @@ end ################################################################################ function rref(a::fqPolyRepMatrix) - z = deepcopy(a) + z = similar(a) r = ccall((:fq_nmod_mat_rref, libflint), Int, - (Ref{fqPolyRepMatrix}, Ref{fqPolyRepField}), z, base_ring(a)) + (Ref{fqPolyRepMatrix}, Ref{fqPolyRepMatrix}, Ref{fqPolyRepField}), + z, a, base_ring(a)) return r, z end function rref!(a::fqPolyRepMatrix) r = ccall((:fq_nmod_mat_rref, libflint), Int, - (Ref{fqPolyRepMatrix}, Ref{fqPolyRepField}), a, base_ring(a)) + (Ref{fqPolyRepMatrix}, Ref{fqPolyRepMatrix}, Ref{fqPolyRepField}), + a, a, base_ring(a)) return r end diff --git a/src/flint/gfp_fmpz_mat.jl b/src/flint/gfp_fmpz_mat.jl index 9bf8847db..5c0e64e7a 100644 --- a/src/flint/gfp_fmpz_mat.jl +++ b/src/flint/gfp_fmpz_mat.jl @@ -23,7 +23,7 @@ dense_matrix_type(::Type{FpFieldElem}) = FpMatrix ############################################################################### function similar(::MatElem, R::FpField, r::Int, c::Int) - z = FpMatrix(r, c, R.n) + z = FpMatrix(r, c, R.ninv) z.base_ring = R return z end @@ -49,7 +49,8 @@ end @inline function getindex_raw(a::FpMatrix, i::Int, j::Int) u = ZZRingElem() ccall((:fmpz_mod_mat_get_entry, libflint), Nothing, - (Ref{ZZRingElem}, Ref{FpMatrix}, Int, Int), u, a, i - 1, j - 1) + (Ref{ZZRingElem}, Ref{FpMatrix}, Int, Int, Ref{fmpz_mod_ctx_struct}), + u, a, i - 1, j - 1, base_ring(a).ninv) return u end @@ -77,7 +78,8 @@ end # as per setindex! but no reduction mod n and no bounds checking @inline function setindex_raw!(a::FpMatrix, u::ZZRingElem, i::Int, j::Int) ccall((:fmpz_mod_mat_set_entry, libflint), Nothing, - (Ref{FpMatrix}, Int, Int, Ref{ZZRingElem}), a, i - 1, j - 1, u) + (Ref{FpMatrix}, Int, Int, Ref{ZZRingElem}, Ref{Nothing}), + a, i - 1, j - 1, u, C_NULL) # ctx is not needed here end function setindex!(a::FpMatrix, b::FpMatrix, r::UnitRange{Int64}, c::UnitRange{Int64}) @@ -85,16 +87,17 @@ function setindex!(a::FpMatrix, b::FpMatrix, r::UnitRange{Int64}, c::UnitRange{I size(b) == (length(r), length(c)) || throw(DimensionMismatch("tried to assign a $(size(b, 1))x$(size(b, 2)) matrix to a $(length(r))x$(length(c)) destination")) A = view(a, r, c) ccall((:fmpz_mod_mat_set, libflint), Nothing, - (Ref{FpMatrix}, Ref{FpMatrix}), A, b) + (Ref{FpMatrix}, Ref{FpMatrix}, Ref{Nothing}), A, b, C_NULL) end function deepcopy_internal(a::FpMatrix, dict::IdDict) - z = FpMatrix(nrows(a), ncols(a), modulus(base_ring(a))) + z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv) if isdefined(a, :base_ring) z.base_ring = a.base_ring end ccall((:fmpz_mod_mat_set, libflint), Nothing, - (Ref{FpMatrix}, Ref{FpMatrix}), z, a) + (Ref{FpMatrix}, Ref{FpMatrix}, Ref{fmpz_mod_ctx_struct}), + z, a, base_ring(a).ninv) return z end @@ -117,12 +120,14 @@ zero(a::FpMatrixSpace) = a() function one(a::FpMatrixSpace) (nrows(a) != ncols(a)) && error("Matrices must be square") z = a() - ccall((:fmpz_mod_mat_one, libflint), Nothing, (Ref{FpMatrix}, ), z) + ccall((:fmpz_mod_mat_one, libflint), Nothing, + (Ref{FpMatrix}, Ref{fmpz_mod_ctx_struct}), z, base_ring(a).ninv) return z end function iszero(a::FpMatrix) - r = ccall((:fmpz_mod_mat_is_zero, libflint), Cint, (Ref{FpMatrix}, ), a) + r = ccall((:fmpz_mod_mat_is_zero, libflint), Cint, + (Ref{FpMatrix}, Ref{fmpz_mod_ctx_struct}), a, base_ring(a).ninv) return Bool(r) end @@ -175,7 +180,8 @@ function tr(a::FpMatrix) R = base_ring(a) r = ZZRingElem() ccall((:fmpz_mod_mat_trace, libflint), Nothing, - (Ref{ZZRingElem}, Ref{FpMatrix}), r, a) + (Ref{ZZRingElem}, Ref{FpMatrix}, Ref{fmpz_mod_ctx_struct}), + r, a, base_ring(a).ninv) return FpFieldElem(r, R) end @@ -207,14 +213,15 @@ function Base.view(x::FpMatrix, r1::Int, c1::Int, r2::Int, c2::Int) z.base_ring = x.base_ring z.view_parent = x ccall((:fmpz_mod_mat_window_init, libflint), Nothing, - (Ref{FpMatrix}, Ref{FpMatrix}, Int, Int, Int, Int), - z, x, r1 - 1, c1 - 1, r2, c2) + (Ref{FpMatrix}, Ref{FpMatrix}, Int, Int, Int, Int, Ref{fmpz_mod_ctx_struct}), + z, x, r1 - 1, c1 - 1, r2, c2, base_ring(x).ninv) finalizer(_gfp_fmpz_mat_window_clear_fn, z) return z end function _gfp_fmpz_mat_window_clear_fn(a::FpMatrix) - ccall((:fmpz_mod_mat_window_clear, libflint), Nothing, (Ref{FpMatrix}, ), a) + ccall((:fmpz_mod_mat_window_clear, libflint), Nothing, + (Ref{FpMatrix}, Ref{fmpz_mod_ctx_struct}), a, base_ring(a).ninv) end @@ -256,7 +263,8 @@ function inv(a::FpMatrix) !is_square(a) && error("Matrix must be a square matrix") z = similar(a) r = ccall((:fmpz_mod_mat_inv, libflint), Int, - (Ref{FpMatrix}, Ref{FpMatrix}), z, a) + (Ref{FpMatrix}, Ref{FpMatrix}, Ref{fmpz_mod_ctx_struct}), + z, a, base_ring(a).ninv) !Bool(r) && error("Matrix not invertible") return z end @@ -268,7 +276,7 @@ end ################################################################################ function (a::FpMatrixSpace)() - z = FpMatrix(nrows(a), ncols(a), modulus(base_ring(a))) + z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv) z.base_ring = a.base_ring return z end @@ -292,42 +300,42 @@ end function (a::FpMatrixSpace)(arr::AbstractMatrix{BigInt}, transpose::Bool = false) _check_dim(nrows(a), ncols(a), arr, transpose) - z = FpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr, transpose) + z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr, transpose) z.base_ring = a.base_ring return z end function (a::FpMatrixSpace)(arr::AbstractVector{BigInt}) _check_dim(nrows(a), ncols(a), arr) - z = FpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) + z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) z.base_ring = a.base_ring return z end function (a::FpMatrixSpace)(arr::AbstractMatrix{ZZRingElem}, transpose::Bool = false) _check_dim(nrows(a), ncols(a), arr, transpose) - z = FpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr, transpose) + z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr, transpose) z.base_ring = a.base_ring return z end function (a::FpMatrixSpace)(arr::AbstractVector{ZZRingElem}) _check_dim(nrows(a), ncols(a), arr) - z = FpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) + z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) z.base_ring = a.base_ring return z end function (a::FpMatrixSpace)(arr::AbstractMatrix{Int}, transpose::Bool = false) _check_dim(nrows(a), ncols(a), arr, transpose) - z = FpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr, transpose) + z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr, transpose) z.base_ring = a.base_ring return z end function (a::FpMatrixSpace)(arr::AbstractVector{Int}) _check_dim(nrows(a), ncols(a), arr) - z = FpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) + z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) z.base_ring = a.base_ring return z end @@ -335,7 +343,7 @@ end function (a::FpMatrixSpace)(arr::AbstractMatrix{FpFieldElem}, transpose::Bool = false) _check_dim(nrows(a), ncols(a), arr, transpose) (length(arr) > 0 && (base_ring(a) != parent(arr[1]))) && error("Elements must have same base ring") - z = FpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr, transpose) + z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr, transpose) z.base_ring = a.base_ring return z end @@ -343,7 +351,7 @@ end function (a::FpMatrixSpace)(arr::AbstractVector{FpFieldElem}) _check_dim(nrows(a), ncols(a), arr) (length(arr) > 0 && (base_ring(a) != parent(arr[1]))) && error("Elements must have same base ring") - z = FpMatrix(nrows(a), ncols(a), modulus(base_ring(a)), arr) + z = FpMatrix(nrows(a), ncols(a), base_ring(a).ninv, arr) z.base_ring = a.base_ring return z end @@ -355,14 +363,14 @@ end ############################################################################### function matrix(R::FpField, arr::AbstractMatrix{<: Union{FpFieldElem, ZZRingElem, Integer}}) - z = FpMatrix(size(arr, 1), size(arr, 2), R.n, arr) + z = FpMatrix(size(arr, 1), size(arr, 2), R.ninv, arr) z.base_ring = R return z end function matrix(R::FpField, r::Int, c::Int, arr::AbstractVector{<: Union{FpFieldElem, ZZRingElem, Integer}}) _check_dim(r, c, arr) - z = FpMatrix(r, c, R.n, arr) + z = FpMatrix(r, c, R.ninv, arr) z.base_ring = R return z end @@ -377,7 +385,7 @@ function zero_matrix(R::FpField, r::Int, c::Int) if r < 0 || c < 0 error("dimensions must not be negative") end - z = FpMatrix(r, c, R.n) + z = FpMatrix(r, c, R.ninv) z.base_ring = R return z end @@ -417,7 +425,7 @@ end function nullspace(M::FpMatrix) N = similar(M, ncols(M), ncols(M)) nullity = ccall((:fmpz_mod_mat_nullspace, libflint), Int, - (Ref{FpMatrix}, Ref{FpMatrix}, Ref{FpField}), N, M, base_ring(M)) + (Ref{FpMatrix}, Ref{FpMatrix}, Ref{fmpz_mod_ctx_struct}), N, M, base_ring(M).ninv) return nullity, view(N, 1:nrows(N), 1:nullity) end @@ -436,7 +444,7 @@ function Solve._can_solve_internal_no_check(A::FpMatrix, b::FpMatrix, task::Symb x = similar(A, ncols(A), ncols(b)) fl = ccall((:fmpz_mod_mat_can_solve, libflint), Cint, - (Ref{FpMatrix}, Ref{FpMatrix}, Ref{FpMatrix}), x, A, b) + (Ref{FpMatrix}, Ref{FpMatrix}, Ref{FpMatrix}, Ref{fmpz_mod_ctx_struct}), x, A, b, base_ring(x).ninv) if task === :only_check || task === :with_solution return Bool(fl), x, zero(A, 0, 0) end @@ -447,15 +455,15 @@ end # different matrix types function _solve_tril_right_flint!(x::FpMatrix, L::FpMatrix, B::FpMatrix, unit::Bool) ccall((:fmpz_mod_mat_solve_tril, libflint), Nothing, - (Ref{FpMatrix}, Ref{FpMatrix}, Ref{FpMatrix}, Cint), - x, L, B, Cint(unit)) + (Ref{FpMatrix}, Ref{FpMatrix}, Ref{FpMatrix}, Cint, Ref{fmpz_mod_ctx_struct}), + x, L, B, Cint(unit), base_ring(x).ninv) return nothing end function _solve_triu_right_flint!(x::FpMatrix, U::FpMatrix, B::FpMatrix, unit::Bool) ccall((:fmpz_mod_mat_solve_triu, libflint), Nothing, - (Ref{FpMatrix}, Ref{FpMatrix}, Ref{FpMatrix}, Cint), - x, U, B, Cint(unit)) + (Ref{FpMatrix}, Ref{FpMatrix}, Ref{FpMatrix}, Cint, Ref{fmpz_mod_ctx_struct}), + x, U, B, Cint(unit), base_ring(x).ninv) return nothing end @@ -469,8 +477,8 @@ function lu!(P::Generic.Perm, x::FpMatrix) P.d .-= 1 rank = ccall((:fmpz_mod_mat_lu, libflint), Int, - (Ptr{Int}, Ref{FpMatrix}, Cint), - P.d, x, Cint(false)) + (Ptr{Int}, Ref{FpMatrix}, Cint, Ref{fmpz_mod_ctx_struct}), + P.d, x, Cint(false), base_ring(x).ninv) P.d .+= 1 diff --git a/src/gaussiannumbers/continued_fraction.jl b/src/gaussiannumbers/continued_fraction.jl index 26d88dcdc..1015b3eac 100644 --- a/src/gaussiannumbers/continued_fraction.jl +++ b/src/gaussiannumbers/continued_fraction.jl @@ -301,7 +301,7 @@ function _left_and_right(x::ArbFieldElem) a = ZZRingElem() b = ZZRingElem() f = ZZRingElem() - ccall((:arb_get_interval_fmpz_2exp, libarb), Nothing, + ccall((:arb_get_interval_fmpz_2exp, libflint), Nothing, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ArbFieldElem}), a, b, f, x) fits(Int, f) || error("Ball endpoints do not fit into QQFieldElem") diff --git a/test/arb/Real-test.jl b/test/arb/Real-test.jl index 296925b50..2235ccf13 100644 --- a/test/arb/Real-test.jl +++ b/test/arb/Real-test.jl @@ -39,10 +39,10 @@ end @testset "arf.hecke_semantics" begin x = Nemo.arf_struct(0, 0, 0, 0) y = ZZRingElem(3)^100 - ccall((:arf_set_fmpz, Nemo.libarb), Nothing, + ccall((:arf_set_fmpz, Nemo.libflint), Nothing, (Ref{Nemo.arf_struct}, Ref{ZZRingElem}), x, y) - ccall((:arf_clear, Nemo.libarb), Nothing, + ccall((:arf_clear, Nemo.libflint), Nothing, (Ref{Nemo.arf_struct},), x) end diff --git a/test/arb/arb-test.jl b/test/arb/arb-test.jl index b2281a8b4..3b30408b8 100644 --- a/test/arb/arb-test.jl +++ b/test/arb/arb-test.jl @@ -16,10 +16,10 @@ end @testset "arf.hecke_semantics" begin x = Nemo.arf_struct(0, 0, 0, 0) y = ZZRingElem(3)^100 - ccall((:arf_set_fmpz, Nemo.libarb), Nothing, + ccall((:arf_set_fmpz, Nemo.libflint), Nothing, (Ref{Nemo.arf_struct}, Ref{ZZRingElem}), x, y) - ccall((:arf_clear, Nemo.libarb), Nothing, + ccall((:arf_clear, Nemo.libflint), Nothing, (Ref{Nemo.arf_struct},), x) end diff --git a/test/gaussiannumbers/continued_fraction-test.jl b/test/gaussiannumbers/continued_fraction-test.jl index d8f7386a3..c51518855 100644 --- a/test/gaussiannumbers/continued_fraction-test.jl +++ b/test/gaussiannumbers/continued_fraction-test.jl @@ -105,7 +105,7 @@ end (ZZRingElem[-1, 1, 2, 7], matrix(ZZ, [-7 -1; 22 3])) z = CC() - ccall((:arb_zero_pm_one, Nemo.libarb), Nothing, (Ref{ArbFieldElem},), z) + ccall((:arb_zero_pm_one, Nemo.libflint), Nothing, (Ref{ArbFieldElem},), z) @test_throws Exception continued_fraction(inv(z)) # need exact intervals [-1, 1], [543//512, 17/16], [542//512, 17//16] here @test continued_fraction(z) == ZZRingElem[]