Skip to content

Commit

Permalink
Standard basis computations using highest corner (#3577)
Browse files Browse the repository at this point in the history
  • Loading branch information
ederc authored Apr 10, 2024
1 parent e143c8b commit 3b3a806
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
34 changes: 30 additions & 4 deletions src/Rings/groebner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ Return a standard basis of `I` with respect to `ordering`.
The keyword `algorithm` can be set to
- `:buchberger` (implementation of Buchberger's algorithm in *Singular*),
- `:hilbert` (implementation of a Hilbert driven Gröbner basis computation in *Singular*),
- `:fglm` (implementation of the FGLM algorithm in *Singular*), and
- `:f4` (implementation of Faugère's F4 algorithm in the *msolve* package).
- `:f4` (implementation of Faugère's F4 algorithm in the *msolve* package),
- `:fglm` (implementation of the FGLM algorithm in *Singular*),
- `:hc` (implementation of Buchberger's algorithm in *Singular* trying to first compute the highest corner modulo some prime), and
- `:hilbert` (implementation of a Hilbert driven Gröbner basis computation in *Singular*).
!!! note
See the description of the functions `groebner_basis_hilbert_driven`, `fglm`,
Expand Down Expand Up @@ -171,6 +172,8 @@ function standard_basis(I::MPolyIdeal; ordering::MonomialOrdering = default_orde
end
elseif algorithm == :fglm
_compute_groebner_basis_using_fglm(I, ordering)
elseif algorithm == :hc
standard_basis_highest_corner(I, ordering=ordering)
elseif algorithm == :hilbert
weights = _find_weights(gens(I))
if !any(iszero, weights)
Expand Down Expand Up @@ -304,6 +307,30 @@ function groebner_basis(I::MPolyIdeal; ordering::MonomialOrdering = default_orde
return standard_basis(I, ordering=ordering, complete_reduction=complete_reduction, algorithm=algorithm)
end

@doc raw"""
standard_basis_highest_corner(I::MPolyIdeal; ordering::MonomialOrdering = default_ordering(base_ring(I)))
Return a standard basis of `I` with respect to `ordering`. `ordering` needs to be local, the coefficient ring needs to be `QQ`.
The algorithm first computes a standard basis over a finite field in order to get an upper bound for the highest corner fast.
Then this bound is used to speed up the standard basis computation over `QQ´.
"""
function standard_basis_highest_corner(I::MPolyIdeal; ordering::MonomialOrdering = default_ordering(base_ring(I)))
@req is_local(ordering) "Monomial ordering must be local for this variant."
@req coefficient_ring(I) == QQ "Base ring must be QQ."

#= apply highest corner standard basis variant in Singular =#
ssb = Singular.LibStandard.groebner(singular_groebner_generators(I, ordering), "HC")

sb = IdealGens(I.gens.Ox, ssb, false)
sb.isGB = true
sb.ord = ordering
if isdefined(sb, :S)
sb.S.isGB = true
end
I.gb[ordering] = sb
return sb
end

@doc raw"""
groebner_basis_f4(I::MPolyIdeal, <keyword arguments>)
Expand Down Expand Up @@ -1602,7 +1629,6 @@ multi-modular strategy.
!!! note
This function is probabilistic and returns a correct result
only with high probability.
```jldoctest
julia> R, (x, y, z) = polynomial_ring(QQ, ["x","y","z"]);
Expand Down
1 change: 1 addition & 0 deletions src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,7 @@ export src
export stable_intersection
export stable_set_polytope
export standard_basis
export standard_basis_highest_corner
export standard_basis_with_transformation_matrix
export standard_tableaux
export stanley_reisner_ideal
Expand Down
7 changes: 7 additions & 0 deletions test/Rings/groebner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@
R, (x,y) = polynomial_ring(AcbField(64),["x","y"])
I = ideal([x^2+y^2+1//3,x^2+x*y+1//3*x])
@test_throws ArgumentError groebner_basis(I)

R, (x, y) = polynomial_ring(QQ, ["x", "y"])
I = ideal(R, [x+y^2, x^2+x*y+3*y])
H = QQMPolyRingElem[x,y]
standard_basis_highest_corner(I, ordering=negdeglex(R))
@test elements(I.gb[negdeglex(R)]) == H
@test_throws ArgumentError standard_basis_highest_corner(I)
end

@testset "groebner leading ideal" begin
Expand Down

0 comments on commit 3b3a806

Please sign in to comment.