m4gb icon indicating copy to clipboard operation
m4gb copied to clipboard

Add support for givaro library for finite field ops

Open cr-marcstevens opened this issue 7 years ago • 1 comments

cr-marcstevens avatar Nov 03 '17 12:11 cr-marcstevens

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

  1. 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.

  2. There are three other implementation of extension field in givaro : GFqExtFast, GFqExt, and GFqKronecker. These classes are derived from GFqDom 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 in GFqDom.

  3. Let Fq be a finite field with q = p^n elements and let g be a generator of nonzero elements of F. An elements a of Fq is represented either in a polynomial form or as a positive integer e (1 <= e <= q-1 ) such that g^e = a (the zero element is represented by e= 0). We say that e is the exponent representation of a w.r.t. g. Givaro represents the polynomial form of a = c_0 + c_1*x + ... + c_{n-1}*x^{n-1} as an integer A = \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).

  4. 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 of GFqDom is needed (e.g. _plus1). This is the purpose of the class givfield_exposer in gf_pn_givaro.hpp

rusydi avatar Nov 14 '17 14:11 rusydi