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

Adapted groebner_basis command #167

Merged
merged 1 commit into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Rings/mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,10 @@ function groebner_basis(I::MPolyIdeal)
return collect(I.gb)
end

function groebner_basis(I::MPolyIdeal, ord::Symbol)
function groebner_basis(I::MPolyIdeal, ord::Symbol; complete_reduction::Bool=false)
R = singular_ring(base_ring(I), ord)
i = Singular.std(Singular.Ideal(R, [convert(R, x) for x = gens(I)]))
!Oscar.Singular.has_global_ordering(R) && error("The ordering has to be a global ordering.")
i = Singular.std(Singular.Ideal(R, [convert(R, x) for x = gens(I)]), complete_reduction = complete_reduction)
return collect(BiPolyArray(base_ring(I), i))
end

Expand Down
8 changes: 8 additions & 0 deletions test/Rings/mpoly-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,11 @@ end
@test jacobi_matrix(f) == matrix(R, 2, 1, [2*x, 2*y])
@test jacobi_matrix(I) == matrix(R, 2, 2, [2*x, 4*x^3*y-y^3, 2*y, x^4-3*x*y^2])
end

@testset "Groebner" begin
R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"])
I = ideal([2*x+3*y+4*z-5,3*x+4*y+5*z-2])
@test groebner_basis(I,:degrevlex) == [y+2*z-11, 3*x+4*y+5*z-2]
@test groebner_basis(I,:degrevlex, complete_reduction = true) == [y+2*z-11, x-z+14]

end