diff --git a/Project.toml b/Project.toml index b085dacab..c189bd3cb 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Singular" uuid = "bcd08a7b-43d2-5ff7-b6d4-c458787f915c" -version = "0.5.8" +version = "0.5.9" [deps] AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" @@ -17,13 +17,13 @@ lib4ti2_jll = "1493ae25-0f90-5c0e-a06c-8c5077d6d66f" libsingular_julia_jll = "ae4fbd8f-ecdb-54f8-bbce-35570499b30e" [compat] -AbstractAlgebra = "0.20.0" +AbstractAlgebra = "0.21.0" CxxWrap = "0.11" -Nemo = "0.25.1" +Nemo = "0.26.0" RandomExtensions = "0.4.2" -Singular_jll = "~402.000.102" +Singular_jll = "~402.100.100" julia = "1.3" -libsingular_julia_jll = "~0.15.0" +libsingular_julia_jll = "~0.16.0" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/src/number/NumberTypes.jl b/src/number/NumberTypes.jl index 3bc2c4ba5..3208f236d 100644 --- a/src/number/NumberTypes.jl +++ b/src/number/NumberTypes.jl @@ -55,6 +55,7 @@ mutable struct n_Z <: Nemo.RingElem end end +n_Z(n::n_Z) = n n_Z(n::Integer = 0) = n_Z(libSingular.number_ptr(n, ZZ.ptr)) n_Z(n::Nemo.fmpz) = n_Z(libSingular.number_ptr(n, ZZ.ptr)) @@ -96,6 +97,7 @@ mutable struct n_Q <: Nemo.FieldElem end end +n_Q(n::n_Q) = n n_Q(n::Integer = 0) = n_Q(libSingular.number_ptr(n, QQ.ptr)) n_Q(n::Nemo.fmpz) = n_Q(libSingular.number_ptr(n, QQ.ptr)) n_Q(n::n_Z) = n_Q(libSingular.nApplyMapFunc(n_Z_2_n_Q, n.ptr, ZZ.ptr, QQ.ptr)) diff --git a/src/number/n_GF.jl b/src/number/n_GF.jl index 29f2c4d14..6b1c0d89e 100644 --- a/src/number/n_GF.jl +++ b/src/number/n_GF.jl @@ -217,7 +217,7 @@ function inv(x::n_GF) return c(p) end -function divexact(x::n_GF, y::n_GF) +function divexact(x::n_GF, y::n_GF; check::Bool=true) c = parent(x) p = GC.@preserve x y c libSingular.n_Div(x.ptr, y.ptr, c.ptr) return c(p) diff --git a/src/number/n_Q.jl b/src/number/n_Q.jl index 168bcc28b..1e9003abd 100644 --- a/src/number/n_Q.jl +++ b/src/number/n_Q.jl @@ -243,7 +243,7 @@ function inv(x::n_Q) return c(p) end -function divexact(x::n_Q, y::n_Q) +function divexact(x::n_Q, y::n_Q; check::Bool=true) c = parent(x) p = GC.@preserve x y c libSingular.n_Div(x.ptr, y.ptr, c.ptr) return c(p) diff --git a/src/number/n_Z.jl b/src/number/n_Z.jl index 9656dc6f4..a09dd3e56 100644 --- a/src/number/n_Z.jl +++ b/src/number/n_Z.jl @@ -220,7 +220,7 @@ function div(x::n_Z, y::n_Z) return c(p) end -function divexact(x::n_Z, y::n_Z) +function divexact(x::n_Z, y::n_Z; check::Bool=true) c = parent(x) p = GC.@preserve x y c libSingular.n_ExactDiv(x.ptr, y.ptr, c.ptr) return c(p) diff --git a/src/number/n_Zn.jl b/src/number/n_Zn.jl index 283208aa6..42ac91106 100644 --- a/src/number/n_Zn.jl +++ b/src/number/n_Zn.jl @@ -194,7 +194,7 @@ end # ############################################################################### -function divexact(x::n_Zn, y::n_Zn) +function divexact(x::n_Zn, y::n_Zn; check::Bool=true) c = parent(x) p = GC.@preserve x y c libSingular.n_ExactDiv(x.ptr, y.ptr, c.ptr) return c(p) diff --git a/src/number/n_Zp.jl b/src/number/n_Zp.jl index c0c3e1ad9..5d5042df3 100644 --- a/src/number/n_Zp.jl +++ b/src/number/n_Zp.jl @@ -195,7 +195,7 @@ function inv(x::n_Zp) return c(p) end -function divexact(x::n_Zp, y::n_Zp) +function divexact(x::n_Zp, y::n_Zp; check::Bool=true) c = parent(x) p = GC.@preserve x y c libSingular.n_Div(x.ptr, y.ptr, c.ptr) return c(p) diff --git a/src/number/n_algExt.jl b/src/number/n_algExt.jl index 142604bed..25d8d7a06 100644 --- a/src/number/n_algExt.jl +++ b/src/number/n_algExt.jl @@ -205,7 +205,7 @@ function inv(x::n_algExt) return c(p) end -function divexact(x::n_algExt, y::n_algExt) +function divexact(x::n_algExt, y::n_algExt; check::Bool=true) check_parent(x, y) c = parent(x) p = GC.@preserve x y c libSingular.n_Div(x.ptr, y.ptr, c.ptr) diff --git a/src/number/n_transExt.jl b/src/number/n_transExt.jl index da33bc844..121cbbe43 100644 --- a/src/number/n_transExt.jl +++ b/src/number/n_transExt.jl @@ -250,7 +250,7 @@ function inv(x::n_transExt) return c(p) end -function divexact(x::n_transExt, y::n_transExt) +function divexact(x::n_transExt, y::n_transExt; check::Bool=true) c = parent(x) p = GC.@preserve x y c libSingular.n_Div(x.ptr, y.ptr, c.ptr) return c(p) diff --git a/src/number/n_unknown.jl b/src/number/n_unknown.jl index b1afec4fb..4a804f72a 100644 --- a/src/number/n_unknown.jl +++ b/src/number/n_unknown.jl @@ -136,7 +136,7 @@ end # ############################################################################### -function divexact(a::n_unknown, b::n_unknown) +function divexact(a::n_unknown, b::n_unknown; check::Bool=true) check_parent(a, b) R = parent(a) n = GC.@preserve a b R libSingular.n_ExactDiv(a.ptr, b.ptr, R.ptr) @@ -419,7 +419,7 @@ for op in (:iszero, :isone) end # one input, one wrapped output -for op in (:-, :zero, :one) +for op in (:-, :zero, :one, :inv) @eval begin function ($op)(a::($rew){S, T}) where {S, T} return ($rew){S, T}(($op)(a.data), a.parent) @@ -437,7 +437,7 @@ for op in (:(==), ) end # two inputs, one wrapped output -for op in (:+, :-, :*, :div, :divexact, :gcd) +for op in (:+, :-, :*, :div, :gcd) @eval begin function ($op)(a::($rew){S, T}, b::($rew){S, T}) where {S, T} return ($rew){S, T}(($op)(a.data, b.data), a.parent) @@ -445,6 +445,15 @@ for op in (:+, :-, :*, :div, :divexact, :gcd) end end +# two inputs, checked, one wrapped output +for op in (:divexact, ) + @eval begin + function ($op)(a::($rew){S, T}, b::($rew){S, T}; check::Bool=true) where {S, T} + return ($rew){S, T}(($op)(a.data, b.data, check=check), a.parent) + end + end +end + # two inputs, one non-wrapped and one wrapped output for op in (:divides, ) @eval begin diff --git a/src/poly/poly.jl b/src/poly/poly.jl index a5fc00cd7..b4c112a9d 100644 --- a/src/poly/poly.jl +++ b/src/poly/poly.jl @@ -510,7 +510,7 @@ end # ############################################################################### -function divexact(x::spoly, y::spoly) +function divexact(x::spoly, y::spoly; check::Bool=true) check_parent(x, y) R = parent(x) GC.@preserve x y R begin @@ -527,7 +527,7 @@ end # ############################################################################### -function divexact(x::spoly{T}, y::T) where T <: Nemo.RingElem +function divexact(x::spoly{T}, y::T; check::Bool=true) where T <: Nemo.RingElem R = parent(x) base_ring(x) != parent(y) && error("Incompatible rings") GC.@preserve x y R begin @@ -537,7 +537,7 @@ function divexact(x::spoly{T}, y::T) where T <: Nemo.RingElem end end -function divexact(x::spoly, y::n_Z) +function divexact(x::spoly, y::n_Z; check::Bool=true) y1 = base_ring(x)(y) R = parent(x) GC.@preserve x y1 R begin @@ -547,7 +547,7 @@ function divexact(x::spoly, y::n_Z) end end -function divexact(x::spoly, y::n_Q) +function divexact(x::spoly, y::n_Q; check::Bool=true) y1 = base_ring(x)(y) R = parent(x) GC.@preserve x y1 R begin @@ -557,7 +557,7 @@ function divexact(x::spoly, y::n_Q) end end -function divexact(x::spoly, y::Int) +function divexact(x::spoly, y::Int; check::Bool=true) R = base_ring(x) S = parent(x) GC.@preserve x R S begin @@ -569,10 +569,10 @@ function divexact(x::spoly, y::Int) end end -divexact(x::spoly, y::Integer) = divexact(x, base_ring(x)(y)) +divexact(x::spoly, y::Integer; check::Bool=true) = divexact(x, base_ring(x)(y), check=check) -function divexact(x::spoly, y::Rational) - return divexact(x, base_ring(x)(y)) +function divexact(x::spoly, y::Rational; check::Bool=true) + return divexact(x, base_ring(x)(y), check=check) end ################################################################################ @@ -600,8 +600,8 @@ function *(x::fmpq, y::spoly) return parent(y)(x) * y end -function divexact(x::spoly, y::fmpq) - return divexact(x, parent(x)(y)) +function divexact(x::spoly, y::fmpq; check::Bool=true) + return divexact(x, parent(x)(y), check=check) end ############################################################################### @@ -1501,16 +1501,16 @@ ordering_a(w::Vector{Int}) = sordering([sorder_block(ringorder_a, 0, w)]) Represents a block of variables with a general matrix ordering. The matrix `m` is expected to be invertible, and this is checked by default. """ -function ordering_M(m::Matrix{Int}; checked::Bool = true) +function ordering_M(m::Matrix{Int}; check::Bool=true) (nr, nc) = size(m) nr > 0 && nr == nc || throw(ArgumentError("weight matrix must be square")) - !checked || !iszero(Nemo.det(Nemo.matrix(Nemo.ZZ, m))) || throw(ArgumentError("weight matrix must nonsingular")) + !check || !iszero(Nemo.det(Nemo.matrix(Nemo.ZZ, m))) || throw(ArgumentError("weight matrix must nonsingular")) return sordering([sorder_block(ringorder_M, nr, vec(transpose(m)))]) end -function ordering_M(m::fmpz_mat, checked::Bool = true) - !checked || !iszero(Nemo.det(m)) || throw(ArgumentError("weight matrix must nonsingular")) - return ordering_M(Int.(m), checked = false) +function ordering_M(m::fmpz_mat, check::Bool=true) + !check || !iszero(Nemo.det(m)) || throw(ArgumentError("weight matrix must nonsingular")) + return ordering_M(Int.(m), check=false) end # C, c, and S can take a dummy int in singular, but they do nothing with it?