Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

CRA Class Template Reference

#include <cra.h>

template<class _Integer>
class LinBox::CRA< _Integer >


Public Types

typedef _Integer Integer
typedef std::vector< IntegerVector
typedef std::list< VectorLVector
typedef std::list< IntegerList
typedef std::vector< int > IntVector

Public Member Functions

 CRA (size_t n=0, unsigned int EARLY=1, const double BOUND=0)
 CRA (size_t n, unsigned int EARLY, const integer BOUND)
void initialize (size_t n, unsigned int EARLY, const integer BOUND)
void initialize (size_t n, unsigned int EARLY=1, const double BOUND=0)
template<class Vect, class Function, class RandPrime> Vect & operator() (Vect &res, const Function &F, RandPrime &genprime)
 The CRA loop.

void progress (const Integer &p, const Integer &d)
 Function for adding a new prime and it's residue to the CRA process.

template<class Vect> void progress (const Integer &p, const Vect &d)
 Taking a step when the CRA process is being applied ot a vector or list of values..

int steps ()
bool terminated ()
size_t stableSteps ()
 Number of progress steps without change in the combined residue.

integerresult (integer &d)
 result mod the lcm of the moduli.

template<class Vect> Vect & result (Vect &w)
 results mod the lcm of the moduli.

Integermodulus ()

Protected Member Functions

void buildTree (List &holdprime, LVector &holdres)
void combine (List &holdprime, LVector &holdres)
void buildTree (List &holdp, List &holdv)
void combine (List &holdp, List &holdv)
void normalize (Integer &res, const Integer &m)
void normalize (Vector &res, const Integer &m)
template<class Vect> void printVect (const Vect &v)
void debug ()
template<class Vect1, class Vect2> bool check (const Vect1 &v1, const Vect2 &v2, const Integer &p)
template<class Vect1, class Vect2> void dot (Integer &d, const Vect1 &v1, const Vect2 &v2)

Protected Attributes

Integer m
double lm
Integer cert
std::vector< int > randv
unsigned int EARLY_TERM_THRESHOLD
double UPPER_BOUND
LVector holdres
List holdvalue
List holdprime
size_t occurency
int k

Member Typedef Documentation

typedef _Integer Integer
 

typedef std::vector<Integer> Vector
 

typedef std::list<Vector> LVector
 

typedef std::list<Integer> List
 

typedef std::vector<int> IntVector
 


Constructor & Destructor Documentation

CRA size_t  n = 0,
unsigned int  EARLY = 1,
const double  BOUND = 0
[inline]
 

CRA size_t  n,
unsigned int  EARLY,
const integer  BOUND
[inline]
 


Member Function Documentation

void initialize size_t  n,
unsigned int  EARLY,
const integer  BOUND
[inline]
 

void initialize size_t  n,
unsigned int  EARLY = 1,
const double  BOUND = 0
[inline]
 

Vect& operator() Vect &  res,
const Function &  F,
RandPrime &  genprime
[inline]
 

The CRA loop.

Given a function to generate residues mod a single prime, this loop produces the residues resulting from the Chinese remainder process on sufficiently many primes to meet the termination condition.

F - Function object of two arguments, F(r, p), given prime p it outputs residue(s) r. This loop may be parallelized. F must be reentrant, thread safe. For example, F may be returning the coefficients of the minimal polynomial of a matrix mod p. Warning - we won't detect bad primes.

genprime - RandIter object for generating primes.

Returns:
res - an integer or object of a class meeting the FixedVector interface (with iterator requirement relaxed to forward iterators). Vectors, SubVectors, STL lists may be used.

void progress const Integer p,
const Integer d
[inline]
 

Function for adding a new prime and it's residue to the CRA process.

p - A modulus. Process is most efficient if it is relatively prime to all other moduli used. d - A residue, image mod p of the desired value.

void progress const Integer p,
const Vect &  d
[inline]
 

Taking a step when the CRA process is being applied ot a vector or list of values..

p - A modulus. Process is most efficient if it is relatively prime to all other moduli used. d - A residue sequence: images mod p of the desired value. May be a list, vector, SubVector.

int steps  )  [inline]
 

bool terminated  )  [inline]
 

size_t stableSteps  )  [inline]
 

Number of progress steps without change in the combined residue.

Allows flexibility in deciding early termination. (earlier early termination).

integer& result integer d  )  [inline]
 

result mod the lcm of the moduli.

A value mod the lcm of the progress step moduli which agrees with each residue mod the corresponding modulus.

Vect& result Vect &  w  )  [inline]
 

results mod the lcm of the moduli.

A sequence of values mod the lcm of the progress step moduli each entry of which agrees with the corresponding (sequence position) residue mod the corresponding (progress step) modulus.

Integer& modulus  )  [inline]
 

void buildTree List holdprime,
LVector holdres
[inline, protected]
 

void combine List holdprime,
LVector holdres
[inline, protected]
 

void buildTree List holdp,
List holdv
[inline, protected]
 

void combine List holdp,
List holdv
[inline, protected]
 

void normalize Integer res,
const Integer m
[inline, protected]
 

void normalize Vector res,
const Integer m
[inline, protected]
 

void printVect const Vect &  v  )  [inline, protected]
 

void debug  )  [inline, protected]
 

bool check const Vect1 &  v1,
const Vect2 &  v2,
const Integer p
[inline, protected]
 

void dot Integer d,
const Vect1 &  v1,
const Vect2 &  v2
[inline, protected]
 


Field Documentation

Integer m [protected]
 

double lm [protected]
 

Integer cert [protected]
 

std::vector<int> randv [protected]
 

unsigned int EARLY_TERM_THRESHOLD [protected]
 

double UPPER_BOUND [protected]
 

LVector holdres [protected]
 

List holdvalue [protected]
 

List holdprime [protected]
 

size_t occurency [protected]
 

int k [protected]
 


Generated on Fri Jul 8 10:29:45 2005 for linbox by doxygen 1.3.7