Skip to content

Conversation

Sequenzer
Copy link
Collaborator

@benlorenz and I added the f4ncgb algorithm by @maximaximal and @ClemensHofstadler as an option for non-commutative groebner basis computation. I set the new algorithm as the default since its performance is better than the other two options.

I added f4ncgb_jll as a dependency and wrote a basic interface to enable Oscar to communicate with the package.
Furthermore, the changes involve updating the documentation for the Groebner basis function and conducting some small tests to check the functionality of the f4ncgb interface.

@Sequenzer Sequenzer added the WIP NOT ready for merging label Sep 3, 2025
@req algorithm in (:f4, :buchberger, :letterplace) "Not a valid algorithm, use :f4ncgb, :buchberger or :letterplace"

if algorithm == :f4
@req ordering == :deglex "f4 only supports :deglex ordering"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that the default option does not work in all cases. In particular, this may break peoples code where they have a non-deglex ordering and the default algorithm. Their code used to work but will break now.
I think the solution to that is the following: Have as the default option algorithm=:default, and inside the function decide what the default algorithm should be (by looking at the situation). For the deglex case over QQ, you could change :default to :f4, while in other cases you change :default to :buchberger.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Idea, I changed it

@lgoettgens lgoettgens changed the title Added f4ncgb algorithm for non-commutative groebner basis computation. Add f4ncgb algorithm for non-commutative groebner basis computation Sep 3, 2025
@lgoettgens lgoettgens added the release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes label Sep 3, 2025
@fingolfin
Copy link
Member

Despite my minor quibbles (all easy to address): very nice, thanks for working on this!

@Sequenzer Sequenzer marked this pull request as ready for review September 5, 2025 12:52

if algorithm == :f4
@req ordering == :deglex "f4 only supports :deglex ordering"
@req base_ring(R) == QQ "only rational coefficients are supported"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, thanks a lot for integrating f4ncgb into Oscar!

Just wanted to let you know that f4ncgb does also support prime fields with p < 2^31 -1. To set the characteristic, we provide the method f4ncgb_set_characteristic. Just in case you also want to use F4 in those cases...

f4ncgb_set_blocks(handle, UInt32[ngens(R)])
f4ncgb_set_threads(handle, UInt32(1))

deg_bound > 0 && f4ncgb_set_maxdeg(handle, UInt32(deg_bound))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default f4ncgb performs only at most 10 iterations of the F4 algorithm, also when the user sets a degree bound. Without changing the iteration limit, the algorithm will stop for higher degree bounds because it hits this maximal number of iterations and not because it hits the degree bound.

The maximal number of iterations can be set with f4ncgb_set_maxiter. Maybe you want to expose this parameter to the user. Or, if not, at least set it so high that the degree bound will be the termination criterion and not the number of iterations.

Also, by default, f4ncgb uses some probabilistic tricks that speed up the computation but yield the correct result only with high probability. One can turn these tricks on and off with f4ncgb_set_tracer (by default it is on). Maybe you also want to expose this parameter to the user, or it least inform them if it is turned on by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: algebraic geometry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants