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

Heuristic Chinese Remaindering with early termination. More...

#include <cra-builder-single.h>

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

Public Member Functions

 CRABuilderEarlySingle (const size_t EARLY=LINBOX_DEFAULT_EARLY_TERMINATION_THRESHOLD)
 Creates a new heuristic 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::CRABuilderEarlySingle< Domain_Type >

Heuristic Chinese Remaindering with early termination.

This approach stops as soon as the modulus doesn't changed for some fixed number of steps in a row.

Constructor & Destructor Documentation

◆ CRABuilderEarlySingle()

CRABuilderEarlySingle ( const size_t  EARLY = LINBOX_DEFAULT_EARLY_TERMINATION_THRESHOLD)
inline

Creates a new heuristic CRA object.

Parameters
EARLYhow many unchanging iterations until termination.

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: