Skip to content

Commit

Permalink
divrem with flag complete_reduction (#681)
Browse files Browse the repository at this point in the history
* divrem with flag complete_reduction

* complete_reduction for reduce (#682)

* implementation via idLift and options
  • Loading branch information
hannes14 authored Jul 28, 2023
1 parent 9ec03a7 commit 9d08f66
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/ideal/ideal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -747,20 +747,24 @@ function division(I::sideal{S}, G::sideal{S}) where S <: SPolyUnion
end

@doc raw"""
divrem(I::sideal{S}, G::sideal{S}) where S <: SPolyUnion
divrem(I::sideal{S}, G::sideal{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)*Matrix(U) = Matrix(G)*Matrix(Quo) + Matrix(Rem)`
`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::sideal{S}, G::sideal{S}) where S <: SPolyUnion
function divrem(I::sideal{S}, G::sideal{S}; complete_reduction::Bool = false) 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))
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), sideal{S}(R,ptr_Rest), smatrix{S}(R,ptr_U))
end

###############################################################################
Expand Down

0 comments on commit 9d08f66

Please sign in to comment.