#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);
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") );
Poly1Dom< GFqDom<int64_t>, Dense >
::Element G, H, J, mQ, irred, modP;
Pdom.init(G, Degree((int64_t)
GFq.exponent()-1));
Pdom.init(H, Degree(1) );
int64_t lowerpart;
GFq.convert(lowerpart, tmp);
std::cout <<
' ' <<
p <<
"-adic value of the lower part of the irreducible : " << lowerpart << std::endl;
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;
}
int main(int argc, char **argv)
Definition: benchmark-recint_exp.C:20
Rep Element
Definition: gfq.h:79
UTT Residu_t
Definition: gfq.h:91
Field::Element Element
Definition: f4n3.cpp:12
Namespace in which the whole Givaro library resides.
Definition: all_field.C:23
template double power(double x, unsigned int p)
GFqDom< TT > GFq
Definition: gfq.h:39
a p
Definition: rmadd.h:147