grobx computes reduced Gröbner bases of polynomial ideals over prime fields
GF(p), p a prime below 2^64, and over the rationals ℚ. GF(2) takes a path of
its own, with rows packed into machine words, and is much faster than the
other primes. grobx is a Rust crate
with a command-line program, a Python extension module, and a C interface.
All four take the ideal's generators as text and return the basis as text. The Rust crate, the
Python module, and the C interface also take FLINT's nmod_mpoly and fmpq_mpoly and return the
basis as them. grobx computes on all the machine's threads by default, or on as many as a call
names; in the browser on one.
Over ℚ, GF(p), and GF(2), grobx is at least 10× faster than any other software. grobx.com/benchmarks.html gives the time and memory of every instance.
grobx runs on Linux on x86-64 and aarch64, on Windows on x86-64, and on macOS on Apple Silicon
and Intel.
It also builds for the browser, wasm32-unknown-unknown, as the module in wasm/, which
grobx.com/live.html runs.
cargo add grobxlet outcome = grobx::groebner("x,y\n7\nx^2+y,\nx*y-1\n", &grobx::Params::default())?;
assert_eq!(outcome.basis, "[y^2+x,\nx*y+6,\nx^2+y]:\n");The input is msolve's format: the variables on line 1, the characteristic on line 2, a prime below 2^64 for GF(p) or 0 for ℚ, then the generators, separated by commas.
pip install grobxThe wheels are for Python 3.12 and later on Linux on x86-64 and aarch64, on Windows on x86-64, and on macOS on Apple Silicon and Intel.
import grobx
r = grobx.groebner("x,y\n7\nx^2+y,\nx*y-1\n")
r.basis # '[y^2+x,\nx*y+6,\nx^2+y]:\n'python-flint's polynomials go in and come back as python-flint's:
import flint
ctx = flint.nmod_mpoly_ctx.get(names=("x", "y"), ordering="degrevlex", modulus=7)
x, y = ctx.gens()
grobx.groebner([x**2 + y, x*y - 1]).basis
# [y^2 + x, x*y + 6, x^2 + y]python/README.md, python-flint, describes the call.
sage -pip install grobx-sageimport grobx_sage
R.<x,y> = PolynomialRing(GF(7))
grobx_sage.groebner_basis(R.ideal(x^2 + y, x*y - 1))
# [x^2 + y, x*y - 1, y^2 + x]sage/README.md describes the orders and keywords it takes.
Each release carries the command-line program for Linux on x86-64 and aarch64, Windows on x86-64, and macOS on Apple Silicon and Intel, each as a zip with the manual and the Maple package. macOS keeps a program downloaded by a browser from running, as no Apple signature vouches for it; once unzipped, it runs after:
xattr -d com.apple.quarantine grobxAll three also build from a clone of the repository:
git clone https://github.com/code1-de/grobx
cd grobxThe command-line program:
cargo build --release -p grobx-cli
target/release/grobx instance.ms > basis.txtThe C library: cargo build --release -p grobx-c writes
target/release/libgrobxc.so, libgrobxc.dylib on macOS, or grobxc.dll
on Windows. A C program includes c/grobx.h and links with -lgrobxc, on
Windows against the import library grobxc.dll.lib. c/grobx_flint.h, compiled against the
caller's FLINT, computes the bases of FLINT's nmod_mpoly and fmpq_mpoly.
The Maple package maple/Grobx.mpl, which runs the command-line program
from the PATH or from the path in GROBX:
read "maple/Grobx.mpl":
with(Grobx):
Basis([x^2 + y, x*y - 1], tdeg(x, y), characteristic = 7);
# [y^2 + x, x*y + 6, x^2 + y]
maple/README.md describes it.
MANUAL.md describes every interface, the input and output formats, how a call behaves, and the design of the engine. grobx.com has the benchmarks and the instance corpus.
GPL-3.0-only, see LICENSE. Copyright Code1 GmbH.
Code1 GmbH also offers grobx under a commercial license.