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

Chinese Remaindering with full precision and no chance of failure. More...

#include <cra-builder-single.h>

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

Public Member Functions

 CRABuilderFullSingle (const size_t bitbound)
 Creates a new deterministic 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...
 
const Integer & getResidue () const
 Gets the result recovered so far.
 
Integer & getResidue (Integer &r) const
 Gets the result recovered so far.
 
Integer & result (Integer &r) const
 alias for getResidue
 
template<typename ModType , class Vect >
void initialize (const ModType &D, const Vect &e)
 init
 
const std::vector< Integer > & result (bool normalized=true) const
 result
 

Protected Member Functions

void collapse () const
 Collapses all shelves by combining residues. More...
 
void normalize () const
 Collapses (if necessary) the top shelf and normalizes the result into the symmetric modulus range.
 

Static Protected Member Functions

static size_t getShelf (double logmod)
 Returns the index where the shelf (with specified natural log of modulus) belongs.
 
static const integermod_to_integer (const Integer &D)
 Returns a reference to D. More...
 
template<class Domain >
static integer mod_to_integer (const Domain &D)
 Returns the characteristic of D.
 
static void combineShelves (Shelf &dest, const Shelf &src)
 Incorporates the residue in src into dest and updates the modulus.
 
static void ensureShelf (size_t index, std::vector< Shelf > &shelves, size_t dim)
 Expands the shelves as necessary so that the given index exists in the array.
 

Detailed Description

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

Chinese Remaindering with full precision and no chance of failure.

Constructor & Destructor Documentation

◆ CRABuilderFullSingle()

CRABuilderFullSingle ( const size_t  bitbound)
inline

Creates a new deterministic 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()

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

◆ mod_to_integer()

static const integer& mod_to_integer ( const Integer &  D)
inlinestaticprotectedinherited

Returns a reference to D.

This is needed to automatically handle whether D is a Domain or an actual integer.

◆ collapse()

void collapse ( ) const
inlineprotectedinherited

Collapses all shelves by combining residues.

After this, there will be a single (top) shelf containing the current full residue.


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