There are three main ways to use the openf4 library (from the simplest to the most involved):
-
In Sage (not yet available):
-
R.<x0,x1,x2,x3,x4,x5> = Zmod(65521)[]
-
I = sage.rings.ideal.Cyclic(R,6)
-
I.groebner_basis('openf4')
-
As a C++ library:
-
Include the library header: libopenf4.h.
-
Link with the library during the compilation: -lopenf4
-
Use the function groebnerBasisF4(int64_t modulo, int nbVariable, std::vector<std::string> variableName, std::vector<std::string> polynomialList, int nbThread, int verbose);
-
Look at the example tutorial-method2.cpp into the section example.
-
As a template library:
-
Include the header openf4.h.
-
Create and configure the element type with your modulo:
-
If modulo < 2^8 use ElementPrime<int16_t>
-
If modulo < 2^16 use ElementPrime<int32_t>
-
If modulo < 2^32 use ElementPrime<int64_t>
-
Configure the class monomial with the number of variables and an initial degree for the monomial precomputation.
-
Create an ideal with a vector of polynomials and others informations: F4::Ideal::Ideal(std::vector<Polynomial<Element>> & polynomialArray, int nbVariable, int capacity, int degree);
-
Call the method f4: F4::Ideal::f4();
-
Compile with:
-
-std=c++11 to enable c++11 support
-
-DNDEBUG to disable assertion
-
-fopenmp to use parallelisation
-
-march=native to use vectorisation (if your system support SSE instructions).
-
-03 -funroll-loops -ftree-vectorize (for fast)
-
-Wall -Wno-strict-overflow to enable useful warning.
-
Link with:
-
-lgmp for big number.
-
-lgmpxx for big number.
-
-lgivaro for prime field based on GMP.
-
-fopenmp to use parallelisation
-
-lopenblas (to use fflas-ffpack with OpenBlas) or -lcblas -latlas (to use fflas-ffpack with Atlas).
-
Look at the example tutorial-method3.cpp into the section example.