NO DOC.
#include <iostream>
#include <givaro/givintnumtheo.h>
#include <givaro/givtimer.h>
#include <cmath>
int main(int argc, char** argv)
{
#ifdef __GMP_PLUSPLUS__
IP.seeding( (unsigned long)BaseTimer::seed() );
#endif
double error;
bool comp ; if ( (comp=(! IP.isprime(a))) ) std::cerr << a << " is not prime, primitive root will have no sense and may loop forever ..." << std::endl;
double epsilon = argc > 2 ? atof(argv[2]) : 0.0000001;
#define GIVARO_POLLARD
IP.probable_prim_root(pr, error, a, epsilon );
if (comp) std::cerr << IP.gcd(g,a,pr) << " is a factor of " << a << std::endl;
IntegerDom().
write( std::cout <<
"Prim root : ", pr );
if (error > 0) {
std::cout << ", correct with probability at least : 1-" << error << std::endl;
std::cerr << tim << std::endl;
std::cerr << "Now checking primitivity, this may take some time (complete factorization of n-1) ...";
#define GIVARO_LENSTRA
if ( IP.isorder(a-1, pr, a) ) {
std::cerr << "... Pimitivity checked" << std::endl;
std::cerr << verif << std::endl;
}
else {
std::cerr << "... WARNING : FAILURE" << std::endl;
std::cerr << verif << std::endl;
}
} else {
std::cout << ", deterministically correct" << std::endl;
std::cerr << tim << std::endl;
}
return 0;
}
Num theory Domain.
Definition: givintnumtheo.h:33
Integer Domain.
Definition: givinteger.h:31
This is the Integer class.
Definition: gmp++_int.h:160
Timer.
Definition: givtimer.h:129
void start()
Start timer.
Definition: givtimer.C:190
void stop()
Stop timer.
Definition: givtimer.C:198
void clear()
Clear timer.
Definition: givtimer.C:181
Namespace in which the whole Givaro library resides.
Definition: all_field.C:23