Skip to content

Commit f38e9c2

Browse files
authored
Merge pull request #140 from wegank/gb-bugfix-1
Fix bug in Gröbner basis caching
2 parents f22e334 + 2d3acfa commit f38e9c2

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/algorithms/groebner-bases.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,12 @@ function groebner_basis(
128128
worker_pool::Union{Nothing,AbstractWorkerPool}=nothing,
129129
info_level::Int=0
130130
)
131-
return get!(I.gb, eliminate) do
131+
key = if intersect && complete_reduction && !normalize && truncate_lifting == 0
132+
eliminate
133+
else
134+
reinterpret(Int64, hash((eliminate, intersect, complete_reduction, normalize, truncate_lifting)) | 0x8000000000000000)
135+
end
136+
return get!(I.gb, key) do
132137
_core_groebner_basis(I, initial_hts = initial_hts, nr_thrds = nr_thrds,
133138
max_nr_pairs = max_nr_pairs, la_option = la_option,
134139
eliminate = eliminate, intersect = intersect,

test/algorithms/groebner-bases.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ using Distributed
3030

3131
@test_throws ErrorException eliminate(I,0)
3232
L = eliminate(I,2)
33+
H = MPolyRingElem[
34+
z^4 + 38*z^3 + 95*z^2 + 95*z
35+
]
3336
@test L == H
3437
@test I.gb[2] == H
3538

0 commit comments

Comments
 (0)