30 for (
int i= 0;
i <
k;
i++)
39 return (
double) result/
k;
44 double pi= 3.141592653589793;
45 double a= 0.140012288;
48 double buf= 2.0/(pi*
a)+
log (1.0-d*d)/2.0;
51 buf -=
log (1.0-d*d)/
a;
74 double pn=
pow ((
double) p, (
double) n);
75 double p1= (double) 1/p;
82 double p2= (double) (2*p-1)/(p*
p);
87 p2= (double) (2*p - 1)/(p*
p)-p2;
96 sqrtTrials *= den/
num;
98 int trials= (int) floor (
pow (sqrtTrials, 2.0));
100 double experimentalNumZeros=
numZeros (G, trials);
102 double pmiddle=
sqrt (p1*p2);
105 den=
sqrt (p1*(1.0-p2))+
sqrt (p2*(1.0-p1));
106 pmiddle *= (den/
num);
108 if (experimentalNumZeros < pmiddle)
const CanonicalForm int s
double numZeros(const CanonicalForm &F, int k)
evaluate F at k random points in Z/p^n and count the number of zeros that occur
CanonicalForm generate() const
gmp_float log(const gmp_float &a)
CanonicalForm compress(const CanonicalForm &f, CFMap &m)
CanonicalForm compress ( const CanonicalForm & f, CFMap & m )
const CanonicalForm CFMap CFMap & N
This file provides a probabilistic irreducibility test for polynomials over Z/p.
int status int void * buf
gmp_float sqrt(const gmp_float &a)
generate random elements in F_p
generate random integers, random elements of finite fields
double inverseERF(double d)
int probIrredTest(const CanonicalForm &F, double error)
given some error probIrredTest detects irreducibility or reducibility of F with confidence level 1-er...
Rational pow(const Rational &a, int e)