NO DOC.
#include <iostream>
#include <stdlib.h>
#include <givaro/givintsqrootmod.h>
#include <givaro/givtimer.h>
#include <givaro/givpoly1factor.h>
#include <givaro/modular-integer.h>
int main(int argc, char** argv)
{
{
std::cerr << "a: " << a << std::endl;
std::cerr << "n: " << n << std::endl;
Integer::seeding ( (unsigned long)BaseTimer::seed ());
ISM.sqrootmod(r,a,n);
std::cout << r << std::endl;
std::cerr << chrono << std::endl;
std::cerr << "Check, (" << r << ")^2 mod " << n << " = " << ( (r*r)%n) << std::endl;
}
if (ISM.isprime(n)) {
std::cout << "Using polynomial factorization : " << std::endl;
typedef Polys::Element Polynomial;
Field F(n); Polys Pol(F,
"X");
Polynomial quad, root;
F.
init(quad[0],a); F.
negin(quad[0]);
if (Pol.is_irreducible(quad)) {
std::cerr << a << " is not a quadratic residue mod " << n << std::endl;
std::cerr << chrono << std::endl;
return 0;
}
Pol.SplitFactor(root, quad,
Degree(1));
Pol.divin(root, root[1]);
Pol.write(std::cout, root) << std::endl;
std::cerr << chrono << std::endl;
std::cerr << "Check, (" << root[0] << ")^2 mod " << n << " = " << ( (root[0]*root[0])%n) << std::endl;
}
return 0;
}
Degree type for polynomials.
Definition givdegree.h:28
Modular square roots.
Definition givintsqrootmod.h:42
This is the Integer class.
Definition gmp++_int.h:160
Forward declaration for Givaro::Modular.
Definition modular-inttype.h:38
Poly1FactorDom.
Definition givpoly1factor.h:34
Timer.
Definition givtimer.h:129
void start()
Start timer.
Definition givtimer.C:164
void stop()
Stop timer.
Definition givtimer.C:172
Namespace in which the whole Givaro library resides.
Definition all_field.C:23