Skip to content

Commit

Permalink
Merge pull request oscar-system#402 from hannes14/saturation
Browse files Browse the repository at this point in the history
saturation: also return number of iterations
  • Loading branch information
fieker committed Mar 25, 2021
2 parents 59247c8 + 81c374e commit 50cae15
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/ideal/ideal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,21 @@ end
saturation{T <: Nemo.RingElem}(I::sideal{T}, J::sideal{T})
Returns the saturation of the ideal $I$ with respect to $J$, i.e. returns
the quotient ideal $(I:J^\infty)$.
the quotient ideal $(I:J^\infty)$ and the number of iterations.
"""
function saturation(I::sideal{T}, J::sideal{T}) where T <: Nemo.RingElem
check_parent(I, J)
R = base_ring(I)
!has_global_ordering(R) && error("Must be over a ring with global ordering")
Q = quotient(I, J)
# we already have contains(Q, I) automatically
k = 0
while !contains(I, Q)
I = Q
Q = quotient(I, J)
k = k + 1
end
return I
return I,k
end

###############################################################################
Expand Down
6 changes: 4 additions & 2 deletions test/ideal/sideal-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,14 @@ end
I = Ideal(R, (x^2 + x*y + 1)*(2y^2+1)^3, (2y^2 + 3)*(2y^2+1)^2)
J = Ideal(R, 2y^2 + 1)

@test equal(saturation(I, J), Ideal(R, 2y^2 + 3, x^2 + x*y + 1))
S,k = saturation(I, J)
@test equal(S, Ideal(R, 2y^2 + 3, x^2 + x*y + 1))

I = Ideal(R, (x*y + 1)*(2x^2*y^2 + x*y - 2) + 2x*y^2 + x, 2x*y + 1)
J = Ideal(R, x)

@test equal(satstd(I, J), std(saturation(I, J)))
S,k = saturation(I, J)
@test equal(satstd(I, J), std(S))
end

@testset "sideal.slimgb" begin
Expand Down

0 comments on commit 50cae15

Please sign in to comment.