Search code examples
c++polynomialsfinite-fieldgalois-field

Polynomial over final field library


I'm trying to find a C++ library that handles polynomials over some finite field GF(2^n) and have support of matrix representation with support for rank finding/inverse or even solving A=X*B. I'm trying to use Linbox, but there's very little documentation. What I was able to do it to transform an integer to a polynomial representation after doing some nasty stuff with the Givaro part of the library, but I couldn't use the rank/solve part of Linbox as they don't seem to handle polynomials, only prime bases with exponent to be one (GF(2)).

Here's a part from the code

LinBox::GivaroGfq GF28(2, 8);
typedef LinBox::BlasMatrix<LinBox::GivaroGfq> Matrix;
Matrix mat(GF28);
//...Resize to MxM and insert M^2 elements
unsigned long int r;
rank(r, mat);

When debugging, the rank function always treats the elements as elements over GF(2) and return incorrect values.

Any ideas on how to use this library for that matter? Have a matrix of MxM elements of GF(2^n) and inverse it or get its rank or solve linear equations? Or should I use another library?


Solution

  • Looks like NTL is the solution. It gives comfortable implementation of GF(2^n) polynomials modulo some polynomial and easy work with matrices (inverse, solving, etc..)