Skip to content

Commit

Permalink
Handle zero ideal cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi Prebet committed Sep 16, 2024
1 parent 2768ecb commit 5781ff5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/algorithms/groebner-bases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,13 @@ function _core_groebner_basis(
)

F = I.gens
R = first(F).parent

if F == repeat([R(0)], length(F))
I.gb[eliminate] = F
return F
if iszero(F)
I.gb[eliminate] = QQMPolyRingElem[]
return I.gb[eliminate]
end

R = first(F).parent
nr_vars = nvars(R)
nr_gens = length(F)
field_char = Int(characteristic(R))
Expand Down Expand Up @@ -214,7 +215,7 @@ function _core_groebner_basis(
# coefficient handling depending on field characteristic
if field_char == 0
ptr = reinterpret(Ptr{BigInt}, gb_cf[])
jl_cf = [QQFieldElem(unsafe_load(ptr, i)) for i in 1:nr_terms]
jl_cf = QQFieldElem[QQFieldElem(unsafe_load(ptr, i)) for i in 1:nr_terms]
else
ptr = reinterpret(Ptr{Int32}, gb_cf[])
jl_cf = Base.unsafe_wrap(Array, ptr, nr_terms)
Expand Down

0 comments on commit 5781ff5

Please sign in to comment.