#include <cra.h>
Public Types | |
| typedef _Integer | Integer |
| typedef std::vector< Integer > | Vector |
| typedef std::list< Vector > | LVector |
| typedef std::list< Integer > | List |
| 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. | |
| integer & | result (integer &d) |
| result mod the lcm of the moduli. | |
| template<class Vect> Vect & | result (Vect &w) |
| results mod the lcm of the moduli. | |
| Integer & | modulus () |
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
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.
|
|
||||||||||||
|
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. |
|
||||||||||||
|
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. |
|
|
|
|
|
|
|
|
Number of progress steps without change in the combined residue. Allows flexibility in deciding early termination. (earlier early termination). |
|
|
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. |
|
|
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. |
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.3.7