| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
4.9.2 Number theoretic functions
uint32 gcd (unsigned long a, unsigned long b)cl_I gcd (const cl_I& a, const cl_I& b)This function returns the greatest common divisor of
aandb, normalized to be >= 0.cl_I xgcd (const cl_I& a, const cl_I& b, cl_I* u, cl_I* v)-
This function (“extended gcd”) returns the greatest common divisor
gofaandband at the same time the representation ofgas an integral linear combination ofaandb:uandvwithu*a+v*b = g,g>= 0.uandvwill be normalized to be of smallest possible absolute value, in the following sense: Ifaandbare non-zero, andabs(a) != abs(b),uandvwill satisfy the inequalitiesabs(u) <= abs(b)/(2*g),abs(v) <= abs(a)/(2*g). cl_I lcm (const cl_I& a, const cl_I& b)-
This function returns the least common multiple of
aandb, normalized to be >= 0. bool logp (const cl_I& a, const cl_I& b, cl_RA* l)bool logp (const cl_RA& a, const cl_RA& b, cl_RA* l)amust be > 0.bmust be >0 and != 1. If log(a,b) is rational number, this function returns true and sets *l = log(a,b), else it returns false.int jacobi (signed long a, signed long b)int jacobi (const cl_I& a, const cl_I& b)Returns the Jacobi symbol (a/b),
a,bmust be integers,b>0and odd. The result is 0 iff gcd(a,b)>1.bool isprobprime (const cl_I& n)-
Returns true if
nis a small prime or passes the Miller-Rabin primality test. The probability of a false positive is 1:10^30. cl_I nextprobprime (const cl_R& x)-
Returns the smallest probable prime >=
x.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on August 27, 2013 using texi2html 5.0.
