#include <givaro/gfq.h>
#include <givaro/givpower.h>
#include <givaro/givtimer.h>
int main(int argc, char** argv)
{
int64_t p = (argc>1?atoi(argv[1]):5);
int64_t e = (argc>2?atoi(argv[2]):3);
typedef GFqDom<int64_t>::Residu_t TT ;
GFqDom<int64_t> GFq((TT)p, (TT)e);
GFqDom<int64_t> PrimeField((TT)p,1);
std::cout << "Working in GF(" << p << '^' << e << ')' << std::endl;
std::cout << "Elements are polynomials in X modulo " << p << std::endl;
Poly1Dom< GFqDom<int64_t>, Dense > Pdom( PrimeField, Indeter("X") );
GFqDom<int64_t>::Element temo, t, tmp;
Poly1Dom< GFqDom<int64_t>, Dense >::Element G, H, J, mQ, irred, modP;
Pdom.init(G, Degree((int64_t)GFq.exponent()-1));
GFq.init(temo,G);
Pdom.init(H, Degree(1) );
GFq.init(t,H);
GFq.init(tmp);
GFq.mul(tmp, temo, t);
GFq.negin(tmp);
int64_t lowerpart;
GFq.convert(lowerpart, tmp);
std::cout << ' ' << p << "-adic value of the lower part of the irreducible : " << lowerpart << std::endl;
int64_t ptoe = power(p,e);
std::cout << ' ' << p << '^' << e << " is : " << ptoe << std::endl;
std::cout << " --> Computed irreducible: " << ptoe+lowerpart << std::endl;
std::cout << "Stored irreducible: " << GFq.irreducible() << std::endl;
Poly1PadicDom< GFqDom<int64_t>, Dense > PAD(Pdom);
Poly1PadicDom< GFqDom<int64_t>, Dense >::Element Polynomial;
PAD.radix(Polynomial, GFq.irreducible());
std::cout << "Irreducible polynomial coefficients: ";
for(Poly1PadicDom< GFqDom<int64_t>, Dense >::Element::iterator it = Polynomial.begin(); it != Polynomial.end(); ++it)
PrimeField.write(std::cout << ' ', *it);
std::cout << std::endl;
PAD.write(std::cout << "The latter " << GFq.irreducible() << " represents: ", Polynomial)
<< " in " << p << "-adic"
<< std::endl;
return 0;
}
Namespace in which the whole Givaro library resides.
Definition: all_field.C:23