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(115792089237316195423570985008687907853269984665640564039457584007913129640233)[]
-
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 groebnerBasisGivaroIntegerF4(std::string modulo, int nbVariable, std::vector<std::string> variableName, std::vector<std::string> polynomialList, int nbThread, int verbose);
-
Look at the example tutorial-big-modulo-method2.cpp into the section example.
-
As a template library:
-
Include the header openf4.h.
-
Create and configure the element type with your modulo:
-
Define the Givaro field type: typedef Givaro::Modular<Givaro::Integer> Field;
-
Create a field with your modulo: Field F(Givaro::Integer("115792089237316195423570985008687907853269984665640564039457584007913129640233"));
-
Use the field type to define your element type: typedef ElementGivaro<Field> eltType;
-
Initialise your element type with the field F: eltType::setField(F);
-
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
-
Look at the example tutorial-big-modulo-method3.cpp into the section example.