Skip to content

Commit

Permalink
divrem for smodule (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes14 authored Jul 28, 2023
1 parent 9d08f66 commit 196abfd
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/module/module.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export jet, minimal_generating_set, ModuleClass, rank, smodule, slimgb, eliminate, modulo, lift, division
export jet, minimal_generating_set, ModuleClass, rank, smodule, slimgb, eliminate, modulo, lift, division, divrem

###############################################################################
#
Expand Down Expand Up @@ -195,6 +195,27 @@ function division(I::smodule{S}, G::smodule{S}) where S
return (smodule{S}(R,ptr_T), smodule{S}(R,ptr_Rest), smodule{S}(R,ptr_U))
end

@doc raw"""
divrem(I::smodule{S}, G::smodule{S}; complete_reduction::Bool = false) 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)*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::smodule{S}, G::smodule{S}; complete_reduction::Bool = false) where S <: SPolyUnion
check_parent(I, G)
R = base_ring(I)
old_redsb=libSingular.set_option("OPT_REDSB",complete_reduction)
old_redtail=libSingular.set_option("OPT_REDTAIL",complete_reduction)
ptr_T,ptr_Rest,ptr_U = GC.@preserve I G R libSingular.id_Lift(G.ptr, I.ptr, true,
false, true, R.ptr)
libSingular.set_option("OPT_REDSB",old_redsb)
libSingular.set_option("OPT_REDTAIL",old_redtail)
return (smodule{S}(R,ptr_T), smodule{S}(R,ptr_Rest), smatrix{S}(R,ptr_U))
end

###############################################################################
#
# Syzygies
Expand Down

0 comments on commit 196abfd

Please sign in to comment.