Skip to content

Commit

Permalink
Adapt to Nemo renaming (#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored and thofma committed Jan 31, 2024
1 parent f5db183 commit 6fc9094
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 43 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Singular"
uuid = "bcd08a7b-43d2-5ff7-b6d4-c458787f915c"
version = "0.22.0"
version = "0.22.1"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand All @@ -19,12 +19,12 @@ lib4ti2_jll = "1493ae25-0f90-5c0e-a06c-8c5077d6d66f"
libsingular_julia_jll = "ae4fbd8f-ecdb-54f8-bbce-35570499b30e"

[compat]
AbstractAlgebra = "0.36"
AbstractAlgebra = "0.37"
BinaryWrappers = "~0.1.1"
CxxWrap = "0.14"
Libdl = "1.6"
LinearAlgebra = "1.6"
Nemo = "0.40"
Nemo = "0.41"
Pidfile = "1.3"
Pkg = "1.6"
Random = "1.6"
Expand Down
2 changes: 1 addition & 1 deletion src/MessyHacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ let zero_parameter_types = [
Nemo.ZZPolyRing => Nemo.ZZPolyRingElem,
Nemo.fqPolyRepField => Nemo.fqPolyRepFieldElem,
Nemo.FqPolyRepField => Nemo.FqPolyRepFieldElem,
Nemo.AnticNumberField => Nemo.nf_elem
Nemo.AbsSimpleNumField => Nemo.AbsSimpleNumFieldElem
],

one_parameter_types = [
Expand Down
2 changes: 1 addition & 1 deletion src/caller.jl
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ end
function prepare_argument(x::Union{
Matrix{ <: Union{Nemo.Integer, Nemo.ZZRingElem}},
Nemo.MatElem{ <: Union{Nemo.Integer, Nemo.ZZRingElem}},
Nemo.MatAlgElem{ <: Union{Nemo.Integer, Nemo.ZZRingElem}}})
Nemo.MatRingElem{ <: Union{Nemo.Integer, Nemo.ZZRingElem}}})
return prepare_argument(sbigintmat(x))
end

Expand Down
56 changes: 28 additions & 28 deletions src/libsingular/antic/nf_elem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

function nf_elemInit(i::Clong, cf::Ptr{Cvoid})
cf_ptr = get_coeff_data_void(cf)
R = julia(cf_ptr)::Nemo.AnticNumberField
R = julia(cf_ptr)::Nemo.AbsSimpleNumField
return number(R(Int(i)))
end

Expand All @@ -17,7 +17,7 @@ function nf_elemDelete(ptr::Ptr{Ptr{Cvoid}}, cf::Ptr{Cvoid})
end

function nf_elemCopy(a::Ptr{Cvoid}, cf::Ptr{Cvoid})
n = julia(a)::Nemo.nf_elem
n = julia(a)::Nemo.AbsSimpleNumFieldElem
return number(deepcopy(n))
end

Expand All @@ -40,7 +40,7 @@ function nf_elemCoeffWrite(cf::Ptr{Cvoid}, d::Cint)
end

function nf_elemWrite(a::Ptr{Cvoid}, cf::Ptr{Cvoid})
n = julia(a)::Nemo.nf_elem
n = julia(a)::Nemo.AbsSimpleNumFieldElem
libSingular.StringAppendS(AbstractAlgebra.obj_to_string_wrt_times(n))
nothing
end
Expand All @@ -52,60 +52,60 @@ end
###############################################################################

function nf_elemNeg(a::Ptr{Cvoid}, cf::Ptr{Cvoid})
n = julia(a)::Nemo.nf_elem
n = julia(a)::Nemo.AbsSimpleNumFieldElem
return number(-n)
end

function nf_elemInpNeg(a::Ptr{Cvoid}, cf::Ptr{Cvoid})
cf_ptr = get_coeff_data_void(cf)
ccall((:nf_elem_neg, libantic), Cvoid,
(Ptr{Nemo.nf_elem}, Ptr{Nemo.nf_elem}, Ptr{Nemo.AnticNumberField}),
(Ptr{Nemo.AbsSimpleNumFieldElem}, Ptr{Nemo.AbsSimpleNumFieldElem}, Ptr{Nemo.AbsSimpleNumField}),
a, a, cf_ptr)
return a
end

function nf_elemInvers(a::Ptr{Cvoid}, cf::Ptr{Cvoid})
n = julia(a)::Nemo.nf_elem
n = julia(a)::Nemo.AbsSimpleNumFieldElem
return number(Nemo.inv(n))
end

function nf_elemMult(a::Ptr{Cvoid}, b::Ptr{Cvoid}, cf::Ptr{Cvoid})
n1 = julia(a)::Nemo.nf_elem
n2 = julia(b)::Nemo.nf_elem
n1 = julia(a)::Nemo.AbsSimpleNumFieldElem
n2 = julia(b)::Nemo.AbsSimpleNumFieldElem
return number(n1*n2)
end

function nf_elemInpMult(a::Ptr{Ptr{Cvoid}}, b::Ptr{Cvoid}, cf::Ptr{Cvoid})
r = unsafe_load(a)
aa = julia(r)::Nemo.nf_elem
bb = julia(b)::Nemo.nf_elem
aa = julia(r)::Nemo.AbsSimpleNumFieldElem
bb = julia(b)::Nemo.AbsSimpleNumFieldElem
Nemo.mul!(aa, aa, bb)
nothing
end

function nf_elemAdd(a::Ptr{Cvoid}, b::Ptr{Cvoid}, cf::Ptr{Cvoid})
n1 = julia(a)::Nemo.nf_elem
n2 = julia(b)::Nemo.nf_elem
n1 = julia(a)::Nemo.AbsSimpleNumFieldElem
n2 = julia(b)::Nemo.AbsSimpleNumFieldElem
return number(n1 + n2)
end

function nf_elemInpAdd(a::Ptr{Ptr{Cvoid}}, b::Ptr{Cvoid}, cf::Ptr{Cvoid})
r = unsafe_load(a)
aa = julia(r)::Nemo.nf_elem
bb = julia(b)::Nemo.nf_elem
aa = julia(r)::Nemo.AbsSimpleNumFieldElem
bb = julia(b)::Nemo.AbsSimpleNumFieldElem
Nemo.addeq!(aa, bb)
nothing
end

function nf_elemSub(a::Ptr{Cvoid}, b::Ptr{Cvoid}, cf::Ptr{Cvoid})
n1 = julia(a)::Nemo.nf_elem
n2 = julia(b)::Nemo.nf_elem
n1 = julia(a)::Nemo.AbsSimpleNumFieldElem
n2 = julia(b)::Nemo.AbsSimpleNumFieldElem
return number(n1 - n2)
end

function nf_elemDiv(a::Ptr{Cvoid}, b::Ptr{Cvoid}, cf::Ptr{Cvoid})
n1 = julia(a)::Nemo.nf_elem
n2 = julia(b)::Nemo.nf_elem
n1 = julia(a)::Nemo.AbsSimpleNumFieldElem
n2 = julia(b)::Nemo.AbsSimpleNumFieldElem
return number(Nemo.divexact(n1, n2))
end

Expand All @@ -116,29 +116,29 @@ end
###############################################################################

function nf_elemGreater(a::Ptr{Cvoid}, b::Ptr{Cvoid}, cf::Ptr{Cvoid})
n1 = julia(a)::Nemo.nf_elem
n2 = julia(b)::Nemo.nf_elem
n1 = julia(a)::Nemo.AbsSimpleNumFieldElem
n2 = julia(b)::Nemo.AbsSimpleNumFieldElem
return Cint(n1 != n2)
end

function nf_elemEqual(a::Ptr{Cvoid}, b::Ptr{Cvoid}, cf::Ptr{Cvoid})
n1 = julia(a)::Nemo.nf_elem
n2 = julia(b)::Nemo.nf_elem
n1 = julia(a)::Nemo.AbsSimpleNumFieldElem
n2 = julia(b)::Nemo.AbsSimpleNumFieldElem
return Cint(n1 == n2)
end

function nf_elemIsZero(a::Ptr{Cvoid}, cf::Ptr{Cvoid})
n = julia(a)::Nemo.nf_elem
n = julia(a)::Nemo.AbsSimpleNumFieldElem
return Cint(Nemo.iszero(n))
end

function nf_elemIsOne(a::Ptr{Cvoid}, cf::Ptr{Cvoid})
n = julia(a)::Nemo.nf_elem
n = julia(a)::Nemo.AbsSimpleNumFieldElem
return Cint(Nemo.isone(n))
end

function nf_elemIsMOne(a::Ptr{Cvoid}, cf::Ptr{Cvoid})
n = julia(a)::Nemo.nf_elem
n = julia(a)::Nemo.AbsSimpleNumFieldElem
return Cint(n == -1)
end

Expand All @@ -149,8 +149,8 @@ end
###############################################################################

function nf_elemGcd(a::Ptr{Cvoid}, b::Ptr{Cvoid}, cf::Ptr{Cvoid})
n1 = julia(a)::Nemo.nf_elem
n2 = julia(b)::Nemo.nf_elem
n1 = julia(a)::Nemo.AbsSimpleNumFieldElem
n2 = julia(b)::Nemo.AbsSimpleNumFieldElem
return number(Nemo.gcd(n1, n2))
end

Expand Down Expand Up @@ -222,7 +222,7 @@ function nf_elemInitChar(cf::Ptr{Cvoid}, p::Ptr{Cvoid})
return Cint(0)
end

function register(R::Nemo.AnticNumberField)
function register(R::Nemo.AbsSimpleNumField)
c = @cfunction(nf_elemInitChar, Cint, (Ptr{Cvoid}, Ptr{Cvoid}))
return nRegister(n_unknown, c)
end
4 changes: 2 additions & 2 deletions src/matrix/bigintmat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ end
# conversion to bigintmat

function sbigintmat(a::Union{Nemo.MatElem{ <: Union{Nemo.Integer, Nemo.ZZRingElem}},
Nemo.MatAlgElem{ <: Union{Nemo.Integer, Nemo.ZZRingElem}}})
Nemo.MatRingElem{ <: Union{Nemo.Integer, Nemo.ZZRingElem}}})
(r, c) = (nrows(a), ncols(a))
z = sbigintmat(r, c)
for i in 1:r, j in 1:c
Expand Down Expand Up @@ -97,7 +97,7 @@ function Nemo.matrix(R::Nemo.Ring, a::sbigintmat)
return z
end

function (R::Union{Nemo.MatSpace, Nemo.MatAlgebra})(a::sbigintmat)
function (R::Union{Nemo.MatSpace, Nemo.MatRing})(a::sbigintmat)
r = nrows(a)
c = ncols(a)
r == nrows(R) && c == ncols(R) || error("wrong matrix dimensions")
Expand Down
6 changes: 3 additions & 3 deletions src/number/n_algExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ promote_rule(C::Type{n_algExt}, ::Type{n_Z}) = n_algExt

promote_rule(C::Type{n_algExt}, ::Type{n_Q}) = n_algExt

# TODO really need a hand-crafted nf_elem <-> n_algExt
function (SK::Singular.N_AlgExtField)(a::Singular.Nemo.nf_elem)
# TODO really need a hand-crafted AbsSimpleNumFieldElem <-> n_algExt
function (SK::Singular.N_AlgExtField)(a::Singular.Nemo.AbsSimpleNumFieldElem)
K = parent(a)
SKa = gen(SK)
res = SK(coeff(a, 0))
Expand All @@ -301,7 +301,7 @@ function (SK::Singular.N_AlgExtField)(a::Singular.Nemo.nf_elem)
end

# this is going to be dreadfully slow
function (K::Singular.Nemo.AnticNumberField)(a::Singular.n_algExt)
function (K::Singular.Nemo.AbsSimpleNumField)(a::Singular.n_algExt)
SK = parent(a)
SF = parent(modulus(SK))
# it gets even worse: n_transExt_to_spoly only converts the "numerator"
Expand Down
6 changes: 3 additions & 3 deletions test/libsingular/nemo-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ end
@test deepcopy(f1c[1]) == f1c[1]
end

@testset "Nemo.nf_elem" begin
@testset "Nemo.AbsSimpleNumFieldElem" begin
U, z = Nemo.polynomial_ring(Nemo.QQ, "z")
K, a = Nemo.number_field(z^3 + 3z + 1, "a")

Expand All @@ -230,8 +230,8 @@ end
f3 = x^2 + 2x + 1

f1c = [c for c in coefficients(f1)]
@test f1c[1] isa Singular.n_FieldElem{Nemo.nf_elem}
@test K(f1c[1]) isa Nemo.nf_elem
@test f1c[1] isa Singular.n_FieldElem{Nemo.AbsSimpleNumFieldElem}
@test K(f1c[1]) isa Nemo.AbsSimpleNumFieldElem
@test !isempty(string(f1c[1]))
@test leading_coefficient(f1) == f1c[1]

Expand Down
2 changes: 1 addition & 1 deletion test/matrix/sbigintmat-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ end
a = BigInt[1 2 3; 4 5 6]
@test a == Array(Singular.sbigintmat(a))

R = Nemo.MatrixAlgebra(Nemo.ZZ, 2)
R = Nemo.matrix_ring(Nemo.ZZ, 2)
a = R([1 2; 3 4])
b = R([5 6; 7 8])
@test a == R(Singular.sbigintmat(a))
Expand Down
2 changes: 1 addition & 1 deletion test/number/n_algExt-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ end
@assert K1(1//2) == Singular.Nemo.QQ(1//2)

@assert K1(b) isa Singular.n_algExt
@assert K2(a) isa Singular.Nemo.nf_elem
@assert K2(a) isa Singular.Nemo.AbsSimpleNumFieldElem
@assert a == K1(K2(a))
@assert b == K2(K1(b))
@assert 0*a == K1(K2(0*a))
Expand Down

2 comments on commit 6fc9094

@thofma
Copy link
Collaborator

@thofma thofma commented on 6fc9094 Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/99970

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.22.1 -m "<description of version>" 6fc909466513fa0e3ff95af858d2d0c5dabe17a4
git push origin v0.22.1

Please sign in to comment.