Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make saturation for principal ideals faster by delegating to remove #4485

Merged
merged 9 commits into from
Jan 25, 2025
Merged
14 changes: 14 additions & 0 deletions src/Rings/mpoly-ideals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,13 @@ Ideal generated by
```
"""
function saturation(I::MPolyIdeal{T}, J::MPolyIdeal{T} = ideal(base_ring(I), gens(base_ring(I))); iteration::Bool=false) where T
# `remove` is faster than `Singular.saturation` when saturating with
# respect to principal ideals
if ngens(I) == 1 && ngens(J) == 1
is_unit(J[1]) && return I
return ideal(remove(I[1], J[1])[2])
end

if iteration
K, _ = Singular.saturation(singular_generators(I), singular_generators(J))
else
Expand Down Expand Up @@ -401,6 +408,13 @@ julia> K, m = saturation_with_index(I)
```
"""
function saturation_with_index(I::MPolyIdeal{T}, J::MPolyIdeal{T} = ideal(base_ring(I), gens(base_ring(I)))) where T
# `remove` is faster than `Singular.saturation` when saturating with
# respect to principal ideals
if ngens(I) == 1 && ngens(J) == 1
is_unit(J[1]) && return (I, base_ring(I)(0))
return ideal(remove(I[1], J[1])[2])
paemurru marked this conversation as resolved.
Show resolved Hide resolved
end

K, k = Singular.saturation(singular_generators(I), singular_generators(J))
return (MPolyIdeal(base_ring(I), K), k)
end
Expand Down
Loading