m4gb
m4gb copied to clipboard
Add support for givaro library for finite field ops
Update on givaro :
The support for proper finite field extension with Givaro is available in the branch https://github.com/cr-marcstevens/m4gb/tree/givaro. Here are some of the notes about the implementation of extension field in givaro
-
The main implementation of extension field in Givaro is in the class
GFqDom
which takes an integer type as template parameter (uint32_t, int32_t, uint64_t, int64_t). The constructor takes four parameters : field characteristic, the degree of extension, the defining irreducible polynomial, and selected generator for the field. The last two parameters are represented by vector of ceofficients and considered as optional parameters. However, without giving it explicitly givaro will randomly select them. -
There are three other implementation of extension field in givaro :
GFqExtFast
,GFqExt
, andGFqKronecker
. These classes are derived fromGFqDom
where the first two are specialized for fast conversion to floating number and the latter uses dynamic Kronecker substitution. But all the actual field operations are implemented inGFqDom
. -
Let
Fq
be a finite field withq = p^n
elements and letg
be a generator of nonzero elements ofF
. An elementsa
ofFq
is represented either in a polynomial form or as a positive integere (1 <= e <= q-1 )
such thatg^e = a
(the zero element is represented bye= 0
). We say thate
is the exponent representation ofa
w.r.t.g
. Givaro represents the polynomial form ofa = c_0 + c_1*x + ... + c_{n-1}*x^{n-1}
as an integerA = \sum_{i = 0}^{n-1} c_i * p^{i}
. However, all the finite field operations in givaro are based on the exponent representation. So, if eventually our framework represents the coefficients of polynomials over field extension using integer representation of the polynomial form, during the initialization step of M4GB the coefficients need to be converted to their exponential representation. And once the computation is finished, the coefficients of polynomials in the Grobner basis need to be converted back from exponential representation to integer representation of the polynomial form. Otherwise, these conversion must be done every time we do field operation (e.g. addition, multiplication, etc). -
Givaro operation on a vector of finite field elements is not applied on the 0-th element of the vector (e.g. see the loop in vector addition https://github.com/linbox-team/givaro/blob/master/src/kernel/field/gfq.inl#L465 ). For this reason,
gf_pn_givaro.hpp
directly access the givaro's internal macro of the from_GIVARO_GFQ_*
. To call these macros, an access to some protected members ofGFqDom
is needed (e.g._plus1
). This is the purpose of the classgivfield_exposer
ingf_pn_givaro.hpp