linbox
Public Member Functions | Protected Member Functions
CRABuilderProbSingle< Domain_Type > Struct Template Reference

Chinese Remaindering with guaranteed probability bound and early termination. More...

#include <cra-builder-single.h>

+ Inheritance diagram for CRABuilderProbSingle< Domain_Type >:
+ Collaboration diagram for CRABuilderProbSingle< Domain_Type >:

Public Member Functions

 CRABuilderProbSingle (const size_t bitbound, const double failprob=LINBOX_DEFAULT_FAILURE_PROBABILITY)
 Creates a new probabilistic CRA object. More...
 
template<typename ModType , typename ResType >
void initialize (const ModType &D, const ResType &e)
 Initialize the CRA with the first residue. More...
 
template<typename ModType , typename ResType >
void progress (const ModType &D, const ResType &e)
 Update the residue and termination condition. More...
 
bool terminated () const
 Checks whether the CRA is (heuristically) finished. More...
 
void initialize (const Integer &D, const Integer &e)
 Initialize the CRA with the first residue. More...
 
void initialize (const Domain &D, const DomainElement &e)
 Initialize the CRA with the first residue. More...
 
Integer & result (Integer &d)
 Gets the result recovered so far. More...
 
Integer & getResidue (Integer &r)
 Gets the result recovered so far.
 
Integer & getModulus (Integer &m)
 Gets the modulus of the result recovered so far.
 
bool noncoprime (const Integer &i) const
 Checks whether i is co-prime to the modulus so far. More...
 
decltype(Integer().bitsize()) modbits () const
 Returns a lower bound on the number of bits in the modulus.
 

Protected Member Functions

bool progress_check (const Integer &D, const Integer &e)
 Update the residue and check whether it changed. More...
 
bool progress_check (const Domain &D, const DomainElement &e)
 Update the residue and check whether it changed. More...
 

Detailed Description

template<class Domain_Type>
struct LinBox::CRABuilderProbSingle< Domain_Type >

Chinese Remaindering with guaranteed probability bound and early termination.

This strategy terminates when the probability of failure is below a certain threshold.

Constructor & Destructor Documentation

◆ CRABuilderProbSingle()

CRABuilderProbSingle ( const size_t  bitbound,
const double  failprob = LINBOX_DEFAULT_FAILURE_PROBABILITY 
)
inline

Creates a new probabilistic CRA object.

Parameters
bitboundAn upper bound on the number of bits in the result.
failprobAn upper bound on the probability of failure.

Member Function Documentation

◆ initialize() [1/3]

void initialize ( const ModType &  D,
const ResType &  e 
)
inline

Initialize the CRA with the first residue.

The eventually-recovered number will be congruent to e modulo D. This function must be called just once. Subsequent calls should be made to the progress() function.

Either the types of D and e should both be Integer, or D is the domain type (e.g., Modular<double>) and e is the element type (e.g., double)

Parameters
DThe modulus
eThe residue

◆ progress()

void progress ( const ModType &  D,
const ResType &  e 
)
inline

Update the residue and termination condition.

The eventually-recovered number will be congruent to e modulo D.

The initialize function must be called at least once before calling this one.

Either the types of D and e should both be Integer, or D is the domain type (e.g., Modular<double>) and e is the element type (e.g., double)

Parameters
DThe modulus of the new image
eThe residue modulo D

◆ terminated()

bool terminated ( ) const
inline

Checks whether the CRA is (heuristically) finished.

Returns
true iff the early termination condition has been reached.

◆ progress_check() [1/2]

bool progress_check ( const Integer &  D,
const Integer &  e 
)
inlineprotectedinherited

Update the residue and check whether it changed.

The eventually-recovered number will be congruent to e modulo D.

The initialize function should be called at least once before calling this one.

Parameters
DThe modulus of the new image
eThe residue modulo D
Returns
true iff the residue changed with this update

◆ progress_check() [2/2]

bool progress_check ( const Domain &  D,
const DomainElement &  e 
)
inlineprotectedinherited

Update the residue and check whether it changed.

The eventually-recovered number will be congruent to e modulo D.

The initialize function should be called at least once before calling this one.

Parameters
DThe modulus of the new image
eThe residue modulo D
Returns
true iff the residue changed with this update

◆ initialize() [2/3]

void initialize ( const Integer &  D,
const Integer &  e 
)
inlineinherited

Initialize the CRA with the first residue.

The eventually-recovered number will be congruent to e modulo D. This function must be called just once. Subsequent calls should be made to the progress() function.

Parameters
DThe modulus
eThe residue

◆ initialize() [3/3]

void initialize ( const Domain &  D,
const DomainElement &  e 
)
inlineinherited

Initialize the CRA with the first residue.

The eventually-recovered number will be congruent to e modulo D. This function must be called just once. Subsequent calls should be made to the progress() function.

Parameters
DThe modulus
eThe residue

◆ result()

Integer& result ( Integer &  d)
inlineinherited

Gets the result recovered so far.

(This is the same as getResidue.)

◆ noncoprime()

bool noncoprime ( const Integer &  i) const
inlineinherited

Checks whether i is co-prime to the modulus so far.

Returns
true iff i shares a common factor with the modulus

The documentation for this struct was generated from the following file: