Skip to content

Fix bug in Gröbner basis caching#140

Merged
mohabsafey merged 1 commit intoalgebraic-solving:mainfrom
wegank:gb-bugfix-1
Apr 12, 2026
Merged

Fix bug in Gröbner basis caching#140
mohabsafey merged 1 commit intoalgebraic-solving:mainfrom
wegank:gb-bugfix-1

Conversation

@wegank
Copy link
Copy Markdown
Contributor

@wegank wegank commented Apr 10, 2026

In the following test:

I = Ideal([x+2*y+2*z-1, x^2+2*y^2+2*z^2-x, 2*x*y+2*y*z-y])
G = groebner_basis(I, eliminate=2, intersect=false)
H = MPolyRingElem[
z^4 + 38*z^3 + 95*z^2 + 95*z
30*z^3 + 32*z^2 + y + 87*z
41*z^3 + 37*z^2 + x + 30*z + 100
]
@test G == H
@test_throws ErrorException eliminate(I,0)
L = eliminate(I,2)
@test L == H
@test I.gb[2] == H

Line 23 and Line 32 unexpectedly give the same results due to #135. This PR fixes the issue while maintaining maximum compatibility, by using truncated hashes as negative Int64 dictionary keys.

Closes #135.

@mohabsafey mohabsafey merged commit f38e9c2 into algebraic-solving:main Apr 12, 2026
8 checks passed
@wegank wegank deleted the gb-bugfix-1 branch April 12, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected/undocumented behavior of Gröbner basis caching

2 participants