Skip to content

Commit 5781ff5

Browse files
author
Remi Prebet
committed
Handle zero ideal cases
1 parent 2768ecb commit 5781ff5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/algorithms/groebner-bases.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,13 @@ function _core_groebner_basis(
150150
)
151151

152152
F = I.gens
153-
R = first(F).parent
154153

155-
if F == repeat([R(0)], length(F))
156-
I.gb[eliminate] = F
157-
return F
154+
if iszero(F)
155+
I.gb[eliminate] = QQMPolyRingElem[]
156+
return I.gb[eliminate]
158157
end
158+
159+
R = first(F).parent
159160
nr_vars = nvars(R)
160161
nr_gens = length(F)
161162
field_char = Int(characteristic(R))
@@ -214,7 +215,7 @@ function _core_groebner_basis(
214215
# coefficient handling depending on field characteristic
215216
if field_char == 0
216217
ptr = reinterpret(Ptr{BigInt}, gb_cf[])
217-
jl_cf = [QQFieldElem(unsafe_load(ptr, i)) for i in 1:nr_terms]
218+
jl_cf = QQFieldElem[QQFieldElem(unsafe_load(ptr, i)) for i in 1:nr_terms]
218219
else
219220
ptr = reinterpret(Ptr{Int32}, gb_cf[])
220221
jl_cf = Base.unsafe_wrap(Array, ptr, nr_terms)

0 commit comments

Comments
 (0)