Skip to content

Commit

Permalink
add mstd, divrem
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes14 authored and fingolfin committed Mar 20, 2023
1 parent 016784e commit 2730f5c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 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.17.0"
version = "0.17.1"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand All @@ -23,9 +23,9 @@ BinaryWrappers = "~0.1.1"
CxxWrap = "0.11, 0.12, 0.13"
Nemo = "0.33.0"
RandomExtensions = "0.4.2"
Singular_jll = "~403.101.500"
Singular_jll = "~403.201.000"
julia = "1.6"
libsingular_julia_jll = "~0.29.0"
libsingular_julia_jll = "~0.30.0"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
37 changes: 36 additions & 1 deletion src/ideal/ideal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export sideal, IdealSet, syz, lead, normalize!, is_constant, is_zerodim, fglm,
independent_sets, maximal_independent_set, ngens, sres, intersection,
quotient, reduce, eliminate, kernel, equal, contains, is_var_generated,
saturation, satstd, slimgb, std, vdim, interreduce, degree, mult,
hilbert_series, std_hilbert, is_homogeneous, division
hilbert_series, std_hilbert, is_homogeneous, division, divrem, mstd

###############################################################################
#
Expand Down Expand Up @@ -542,6 +542,24 @@ function std(I::sideal{S}; complete_reduction::Bool=false) where S <: SPolyUnion
return sideal{S}(R, ptr, true, I.isTwoSided)
end

@doc Markdown.doc"""
mstd(I::sideal{S}; complete_reduction::Bool=false) where S <: SPolyUnion
Compute a Groebner basis for the ideal $I$ and a minimal generating set.
Note that without `complete_reduction` set to `true`,
the generators of the Groebner basis
only have unique leading terms (up to permutation and multiplication by
constants). If `complete_reduction` is set to `true` (and the ordering is
a global ordering) then the Groebner basis is unique.
"""
function mstd(I::sideal{S}; complete_reduction::Bool=false) where S <: SPolyUnion
R = base_ring(I)
ptr,ptr_min = GC.@preserve I R libSingular.id_MinStd(I.ptr, R.ptr, complete_reduction)
libSingular.idSkipZeroes(ptr)
libSingular.idSkipZeroes(ptr_min)
return (sideal{S}(R, ptr), sideal{S}(R, ptr_min))
end

@doc Markdown.doc"""
interreduce(I::sideal{S}) where {T <: Nemo.RingElem, S <: Union{spoly{T}, spluralg{T}}}
Expand Down Expand Up @@ -663,6 +681,23 @@ function division(I::sideal{S}, G::sideal{S}) where S <: SPolyUnion
return (smodule{S}(R,ptr_T), sideal{S}(R,ptr_Rest), smodule{S}(R,ptr_U))
end

@doc Markdown.doc"""
divrem(I::sideal{S}, G::sideal{S}) where S <: SPolyUnion
Computes a division with remainder of the generators of `I` by
the generators of `G`. Returns a tuple (Quo, Rem, U) where
`Matrix(I)*Matrix(U) = Matrix(G)*Matrix(Quo) + Matrix(Rem)`
and `Rem = normalform(I, G)`. `U` is a diagonal matrix of units differing
from the identity matrix only for local ring orderings.
"""
function divrem(I::sideal{S}, G::sideal{S}) where S <: SPolyUnion
check_parent(I, G)
R = base_ring(I)
ptr_T,ptr_Rest,ptr_U = GC.@preserve I G R libSingular.id_DivRem_Unit(I.ptr, G.ptr,
R.ptr)
return (smodule{S}(R,ptr_T), sideal{S}(R,ptr_Rest), smodule{S}(R,ptr_U))
end

###############################################################################
#
# Eliminate
Expand Down

0 comments on commit 2730f5c

Please sign in to comment.