Givaro
Public Types | Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
IntSqrtModDom< RandIter > Class Template Reference

Modular square roots. More...

#include <givintsqrootmod.h>

+ Inheritance diagram for IntSqrtModDom< RandIter >:
+ Collaboration diagram for IntSqrtModDom< RandIter >:

Public Types

typedef IntFactorDom< RandIter > Father_t
typedef IntFactorDom< RandIter >
::Rep 
Rep
typedef RandIter random_generator
typedef Rep Element

Public Member Functions

 IntSqrtModDom (RandIter g=RandIter())
Repsqrootmod (Rep &x, const Rep &a, const Rep &n) const
Repsqrootmodprime (Rep &x, const Rep &a, const Rep &p) const
Repsqrootmodprimepower (Rep &x, const Rep &a, const Rep &p, const unsigned long k, const Rep &pk) const
Repsqrootmodpoweroftwo (Rep &x, const Rep &a, const unsigned long k, const Rep &pk) const
Repfactor (Rep &r, const Rep &n, unsigned long loops=0) const
Repiffactorprime (Rep &r, const Rep &n, unsigned long loops=0) const
Repprimefactor (Rep &r, const Rep &n) const
template<class Container1 , class Container2 >
bool set (Container1 &setint, Container2 &setpwd, const Rep &a, unsigned long loops=0) const
 Factors with primes.
template<class Container >
void set (Container &, const Rep &) const
template<class Container >
void Erathostene (Container &, const Rep &) const
RepErathostene (Rep &, const Rep &p) const
 returns a small factor
template<class Container , class Cont2 , class Cont3 >
Container & divisors (Container &L, const Cont2 &Lf, const Cont3 &Le) const
template<class Container >
Container & divisors (Container &, const Rep &) const
RepPollard (const RandIter &, Rep &, const Rep &n, unsigned long threshold=0) const
RepLenstra (const RandIter &, Rep &, const Rep &n, const Rep &B1=10000000, const unsigned long curves=30) const
std::ostream & write (std::ostream &o, const Rep &n) const
template<class Array >
std::ostream & write (std::ostream &o, Array &, const Rep &n) const
std::ostream & write (std::ostream &o) const
std::ostream & write (std::ostream &o, const Rep &n) const
int isprime (const Rep &n, int r=5) const
unsigned int isprimepower (Rep &, const Rep &) const
template<class RandIter >
unsigned int Miller (RandIter &g, const Rep &n=5) const
template<class RandIter >
Reptest_Lehmann (RandIter &g, Rep &, const Rep &n=5) const
template<class RandIter >
int Lehmann (RandIter &g, const Rep &n=5) const
int isprime_Tabule (const int n) const
int isprime_Tabule2 (const int n) const
Repnextprime (Rep &, const Rep &, int r=5) const
Repprevprime (Rep &, const Rep &, int r=5) const
Repnextprimein (Rep &, int r=5) const
Repprevprimein (Rep &, int r=5) const
int local_prime (const Rep &n, int r=5) const
int operator== (const IntegerDom &) const
int operator!= (const IntegerDom &) const
Repinit (Rep &a) const
Repinit (Rep &a, const Rep &b) const
Repread (Rep &a, const long i) const
Repread (Rep &a, const unsigned long i) const
Repread (Rep &a, const int i) const
Repread (Rep &a, const unsigned int i) const
std::istream & read (std::istream &i)
std::istream & read (std::istream &i, Rep &n) const
Repconvert (Rep &a, const Rep &b) const
template<class XXX >
XXX & convert (XXX &x, const Rep &a) const
Repassign (Rep &a, const Rep &b) const
const Repaccess (const Rep &a) const
Repmul (Rep &r, const Rep &a, const Rep &b) const
Repdiv (Rep &r, const Rep &a, const Rep &b) const
Repmod (Rep &r, const Rep &a, const Rep &b) const
Repadd (Rep &r, const Rep &a, const Rep &b) const
Repsub (Rep &r, const Rep &a, const Rep &b) const
Repdivmod (Rep &q, Rep &r, const Rep &a, const Rep &b) const
Repdivexact (Rep &q, const Rep &a, const Rep &b) const
Repmulin (Rep &r, const Rep &a) const
Repdivin (Rep &r, const Rep &a) const
Repmodin (Rep &r, const Rep &a) const
Repaddin (Rep &r, const Rep &a) const
Repsubin (Rep &r, const Rep &a) const
Repaxpy (Rep &r, const Rep &a, const Rep &b, const Rep &c) const
Repmaxpy (Rep &r, const Rep &a, const Rep &b, const Rep &c) const
Repmaxpyin (Rep &r, const Rep &a, const Rep &b) const
Repaxmy (Rep &r, const Rep &a, const Rep &b, const Rep &c) const
Repaxpyin (Rep &r, const Rep &a, const Rep &b) const
Repaxmyin (Rep &r, const Rep &a, const Rep &b) const
Repneg (Rep &r, const Rep &a) const
Repnegin (Rep &r) const
Repgcd (Rep &g, Rep &u, Rep &v, const Rep &a, const Rep &b) const
Repgcd (Rep &g, const Rep &a, const Rep &b) const
Replcm (Rep &l, const Rep &a, const Rep &b) const
Replcmin (Rep &l, const Rep &a) const
Repinv (Rep &u, const Rep &a, const Rep &b) const
Repinvin (Rep &u, const Rep &b) const
Reppow (Rep &r, const Rep &n, const long l) const
Reppow (Rep &r, const Rep &n, const unsigned long l) const
Reppow (Rep &r, const Rep &n, const int l) const
Reppow (Rep &r, const Rep &n, const unsigned int l) const
Repsqrt (Rep &s, const Rep &n) const
Repsqrt (Rep &s, Rep &r, const Rep &n) const
long logp (const Rep &a, const Rep &p) const
Reppowmod (Rep &r, const Rep &n, const long e, const Rep &m) const
Reppowmod (Rep &r, const Rep &n, const Rep &e, const Rep &m) const
unsigned long length (const Rep &a) const
int sign (const Rep &a) const
bool isZero (const Rep &a) const
bool isOne (const Rep &a) const
bool areEqual (const Rep &a, const Rep &b) const
bool areNEqual (const Rep &a, const Rep &b) const
bool isgeq (const Rep &a, const Rep &b) const
bool isgeq (const long b, const Rep &a) const
bool isgeq (const Rep &a, const long b) const
bool isleq (const Rep &a, const Rep &b) const
bool isleq (const long b, const Rep &a) const
bool isleq (const Rep &a, const long b) const
bool isgt (const Rep &a, const Rep &b) const
bool isgt (const long b, const Rep &a) const
bool isgt (const Rep &a, const long b) const
bool islt (const Rep &a, const Rep &b) const
bool islt (const long b, const Rep &a) const
bool islt (const Rep &a, const long b) const
template<class RandIter >
Reprandom (RandIter &, Rep &r, long s=1) const
template<class RandIter >
Reprandom (RandIter &, Rep &r, const Rep &b) const
template<class RandIter >
Repnonzerorandom (RandIter &, Rep &r, long s=1) const
template<class RandIter >
Repnonzerorandom (RandIter &, Rep &r, const Rep &b) const

Data Fields

const Integer one
const Integer mOne
const Integer zero

Protected Member Functions

Repsqrootlinear (Rep &x, const Rep &a, const Rep &p, const unsigned long k) const
Repsqroottwolinear (Rep &x, const Rep &a, const unsigned long k) const
Repsqroothensellift (Rep &x, const Rep &a, const Rep &p, const unsigned long k, const Rep &pk) const
Repsqrootonemorelift (Rep &x, const Rep &a, const Rep &p, const unsigned long k, const Rep &pk) const
Repsqrootmodtwolift (Rep &x, const Rep &a, const unsigned long k, const Rep &pk) const

Protected Attributes

RandIter _g

Detailed Description

template<class RandIter = GivRandom>
class Givaro::IntSqrtModDom< RandIter >

Modular square roots.

Examples:
examples/Integer/ModularSquareRoot.C.

Member Typedef Documentation

typedef IntFactorDom< RandIter > Father_t
typedef IntFactorDom< RandIter >::Rep Rep

Reimplemented from IntegerDom.

typedef RandIter random_generator
inherited

Reimplemented in IntRSADom< RandIter >.

typedef Rep Element
inherited

Constructor & Destructor Documentation

IntSqrtModDom ( RandIter  g = RandIter ())
inline

Member Function Documentation

Rep& sqrootmod ( Rep x,
const Rep a,
const Rep n 
) const
inline
IntSqrtModDom< RandIter >::Rep & sqrootmodprime ( Rep x,
const Rep a,
const Rep p 
) const
inline
IntSqrtModDom< RandIter >::Rep & sqrootmodprimepower ( Rep x,
const Rep a,
const Rep p,
const unsigned long  k,
const Rep pk 
) const
inline
IntSqrtModDom< RandIter >::Rep & sqrootmodpoweroftwo ( Rep x,
const Rep a,
const unsigned long  k,
const Rep pk 
) const
inline
IntSqrtModDom< RandIter >::Rep & sqrootlinear ( Rep x,
const Rep a,
const Rep p,
const unsigned long  k 
) const
inlineprotected
IntSqrtModDom< RandIter >::Rep & sqroottwolinear ( Rep x,
const Rep a,
const unsigned long  k 
) const
inlineprotected
IntSqrtModDom< RandIter >::Rep & sqroothensellift ( Rep x,
const Rep a,
const Rep p,
const unsigned long  k,
const Rep pk 
) const
inlineprotected
IntSqrtModDom< RandIter >::Rep & sqrootonemorelift ( Rep x,
const Rep a,
const Rep p,
const unsigned long  k,
const Rep pk 
) const
inlineprotected
IntSqrtModDom< RandIter >::Rep & sqrootmodtwolift ( Rep x,
const Rep a,
const unsigned long  k,
const Rep pk 
) const
inlineprotected
Rep& factor ( Rep r,
const Rep n,
unsigned long  loops = 0 
) const
inlineinherited
Rep& iffactorprime ( Rep r,
const Rep n,
unsigned long  loops = 0 
) const
inlineinherited
Rep& primefactor ( Rep r,
const Rep n 
) const
inlineinherited
bool set ( Container1 &  setint,
Container2 &  setpwd,
const Rep a,
unsigned long  loops = 0 
) const
inherited

Factors with primes.

void set ( Container &  Lf,
const Rep n 
) const
inherited
void Erathostene ( Container &  Lf,
const Rep p 
) const
inherited
Rep& Erathostene ( Rep ,
const Rep p 
) const
inherited

returns a small factor

Container & divisors ( Container &  L,
const Cont2 &  Lf,
const Cont3 &  Le 
) const
inherited
Container & divisors ( Container &  L,
const Rep n 
) const
inherited
IntFactorDom< RandIter >::Rep & Pollard ( const RandIter &  gen,
Rep g,
const Rep n,
unsigned long  threshold = 0 
) const
inherited
IntFactorDom< RandIter >::Rep & Lenstra ( const RandIter &  gen,
Rep g,
const Rep n,
const Rep B1 = 10000000,
const unsigned long  curves = 30 
) const
inherited
std::ostream & write ( std::ostream &  o,
const Rep n 
) const
inherited
std::ostream & write ( std::ostream &  o,
Array &  Lf,
const Rep n 
) const
inherited
std::ostream& write ( std::ostream &  o) const
inlineinherited
std::ostream& write ( std::ostream &  o,
const Rep n 
) const
inlineinherited
int isprime ( const Rep n,
int  r = 5 
) const
inlineinherited
unsigned int isprimepower ( Rep q,
const Rep u 
) const
inherited
unsigned int Miller ( RandIter &  g,
const Rep n = 5 
) const
inherited
IntPrimeDom::Rep & test_Lehmann ( RandIter &  g,
Rep r,
const Rep n = 5 
) const
inherited
int Lehmann ( RandIter &  g,
const Rep n = 5 
) const
inherited
int isprime_Tabule ( const int  n) const
inherited
int isprime_Tabule2 ( const int  n) const
inherited
IntPrimeDom::Rep & nextprime ( Rep n,
const Rep p,
int  r = 5 
) const
inherited
IntPrimeDom::Rep & prevprime ( Rep n,
const Rep p,
int  r = 5 
) const
inherited
IntPrimeDom::Rep & nextprimein ( Rep n,
int  r = 5 
) const
inherited
IntPrimeDom::Rep & prevprimein ( Rep n,
int  r = 5 
) const
inherited
int local_prime ( const Rep n,
int  r = 5 
) const
inlineinherited
int operator== ( const IntegerDom ) const
inlineinherited
int operator!= ( const IntegerDom ) const
inlineinherited
Rep& init ( Rep a) const
inlineinherited
Rep& init ( Rep a,
const Rep b 
) const
inlineinherited
Rep& read ( Rep a,
const long  i 
) const
inlineinherited
Rep& read ( Rep a,
const unsigned long  i 
) const
inlineinherited
Rep& read ( Rep a,
const int  i 
) const
inlineinherited
Rep& read ( Rep a,
const unsigned int  i 
) const
inlineinherited
std::istream& read ( std::istream &  i)
inlineinherited
std::istream& read ( std::istream &  i,
Rep n 
) const
inlineinherited
Rep& convert ( Rep a,
const Rep b 
) const
inlineinherited
XXX& convert ( XXX &  x,
const Rep a 
) const
inlineinherited
Rep& assign ( Rep a,
const Rep b 
) const
inlineinherited
const Rep& access ( const Rep a) const
inlineinherited
Rep& mul ( Rep r,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& div ( Rep r,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& mod ( Rep r,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& add ( Rep r,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& sub ( Rep r,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& divmod ( Rep q,
Rep r,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& divexact ( Rep q,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& mulin ( Rep r,
const Rep a 
) const
inlineinherited
Rep& divin ( Rep r,
const Rep a 
) const
inlineinherited
Rep& modin ( Rep r,
const Rep a 
) const
inlineinherited
Rep& addin ( Rep r,
const Rep a 
) const
inlineinherited
Rep& subin ( Rep r,
const Rep a 
) const
inlineinherited
Rep& axpy ( Rep r,
const Rep a,
const Rep b,
const Rep c 
) const
inlineinherited
Rep& maxpy ( Rep r,
const Rep a,
const Rep b,
const Rep c 
) const
inlineinherited
Rep& maxpyin ( Rep r,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& axmy ( Rep r,
const Rep a,
const Rep b,
const Rep c 
) const
inlineinherited
Rep& axpyin ( Rep r,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& axmyin ( Rep r,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& neg ( Rep r,
const Rep a 
) const
inlineinherited
Rep& negin ( Rep r) const
inlineinherited
Rep& gcd ( Rep g,
Rep u,
Rep v,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& gcd ( Rep g,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& lcm ( Rep l,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& lcmin ( Rep l,
const Rep a 
) const
inlineinherited
Rep& inv ( Rep u,
const Rep a,
const Rep b 
) const
inlineinherited
Rep& invin ( Rep u,
const Rep b 
) const
inlineinherited
Rep& pow ( Rep r,
const Rep n,
const long  l 
) const
inlineinherited
Rep& pow ( Rep r,
const Rep n,
const unsigned long  l 
) const
inlineinherited
Rep& pow ( Rep r,
const Rep n,
const int  l 
) const
inlineinherited
Rep& pow ( Rep r,
const Rep n,
const unsigned int  l 
) const
inlineinherited
Rep& sqrt ( Rep s,
const Rep n 
) const
inlineinherited
Rep& sqrt ( Rep s,
Rep r,
const Rep n 
) const
inlineinherited
long logp ( const Rep a,
const Rep p 
) const
inlineinherited
Rep& powmod ( Rep r,
const Rep n,
const long  e,
const Rep m 
) const
inlineinherited
Rep& powmod ( Rep r,
const Rep n,
const Rep e,
const Rep m 
) const
inlineinherited
unsigned long length ( const Rep a) const
inlineinherited
int sign ( const Rep a) const
inlineinherited
bool isZero ( const Rep a) const
inlineinherited
bool isOne ( const Rep a) const
inlineinherited
bool areEqual ( const Rep a,
const Rep b 
) const
inlineinherited
bool areNEqual ( const Rep a,
const Rep b 
) const
inlineinherited
bool isgeq ( const Rep a,
const Rep b 
) const
inlineinherited
bool isgeq ( const long  b,
const Rep a 
) const
inlineinherited
bool isgeq ( const Rep a,
const long  b 
) const
inlineinherited
bool isleq ( const Rep a,
const Rep b 
) const
inlineinherited
bool isleq ( const long  b,
const Rep a 
) const
inlineinherited
bool isleq ( const Rep a,
const long  b 
) const
inlineinherited
bool isgt ( const Rep a,
const Rep b 
) const
inlineinherited
bool isgt ( const long  b,
const Rep a 
) const
inlineinherited
bool isgt ( const Rep a,
const long  b 
) const
inlineinherited
bool islt ( const Rep a,
const Rep b 
) const
inlineinherited
bool islt ( const long  b,
const Rep a 
) const
inlineinherited
bool islt ( const Rep a,
const long  b 
) const
inlineinherited
Rep& random ( RandIter &  ,
Rep r,
long  s = 1 
) const
inlineinherited
Rep& random ( RandIter &  ,
Rep r,
const Rep b 
) const
inlineinherited
Rep& nonzerorandom ( RandIter &  ,
Rep r,
long  s = 1 
) const
inlineinherited
Rep& nonzerorandom ( RandIter &  ,
Rep r,
const Rep b 
) const
inlineinherited

Field Documentation

RandIter _g
protectedinherited
const Integer one
inherited
const Integer mOne
inherited
const Integer zero
inherited

The documentation for this class was generated from the following files: