LatMRG Online Documentation unknown
Tools to analyze the lattice structure of linear generators
|
This class represents the lattice associated to a Multiply-with-carry (MWC) random number generator. More...
Public Types | |
typedef NTL::vector< Int > | IntVec |
typedef NTL::matrix< Int > | IntMat |
Public Member Functions | |
MWCComponent (const Int &b, const IntVec &e, int k, int maxDim=1) | |
b is the modulo. | |
MWCComponent (const Int &b, const Int &m, int maxDim=1) | |
Another constructor with just b and m. | |
MWCComponent (const MWCComponent< Int, Real > &Lat) | |
Copy constructor. | |
MWCComponent< Int, Real > & | operator= (const MWCComponent< Int, Real > &Lat) |
Assigns Lat to this object. | |
~MWCComponent () | |
Destructor. | |
void | kill () |
Cleans and releases memory used by this object. | |
std::string | toStringCoef () const |
Gets the coefficients of the MRG that spawns the lattice in a string. | |
std::string | toString () const override |
Gets all the information on the lattice in a string. | |
const Int & | getMWCmod () const |
The modulo of the MWC generator this object represents. | |
int | getMWCorder () const |
The order of the MWC generator. | |
const IntVec & | geteCoef () const |
The coefficients of the MWC generator. | |
Public Member Functions inherited from LatMRG::MRGComponent< Int, Real > | |
MRGComponent (const Int &m, int64_t k, DecompType decompm1, const char *filem1, DecompType decompr, const char *filer) | |
Constructor for modulus \(m\) and order \(k\). | |
~MRGComponent () | |
Destructor. | |
void | setaa (const IntVec &aa) |
Sets the vector of multipliers to aa, with aa[j] containing \(a_j\). | |
IntVec | getaa () const |
Returns the vector of multipliers of the recurrence, in same format as aa above. | |
bool | maxPeriod (const IntVec &aa) |
Returns true if the coefficients \(aa\) give an MRG with maximal period; returns false otherwise. | |
bool | maxPeriod23 (const IntVec &aa) |
Assumes that the maximal-period condition (1) holds and checks only for conditions 2 and 3. | |
const Int | getModulus () const |
Returns the value of the modulus \(m\) of the recurrence. | |
int64_t | getOrder () const |
Returns the value of the order \(k\) of the recurrence. | |
Int & | getb () |
Returns the value of b for which b^e+r = m, when available. | |
int64_t & | gete () |
Returns the value of e for which b^e+r = m, when available. | |
Int & | getc () |
Returns the value of c for which b^e+c = m, when available. | |
IntVec & | getOrbitSeed () |
Returns a const reference to the initial state orbitSeed, when available. | |
std::string | toString () |
Returns a descriptor of this object as a string. |
Static Public Member Functions | |
static int | validate (const Int &b, const IntVec &e) |
This checks if b and e are suitable parameters for a MWC generator. | |
static int | fullPeriod (const Int &b, const IntVec &e) |
This is a basic method to check if the MWC generator described by b and e has full period. |
This class represents the lattice associated to a Multiply-with-carry (MWC) random number generator.
A MWC generator is defined by a recurrence of the form
\begin{align} x_n & = (e_1 x_{n-1} + \cdots + e_k x_{n-k} + c_{n-1})d\ \mathrm{mod} \ b \\ c_n & = \lfloor (e_0 x_n + e_1 x_{n-1} + \cdots + e_k x_{n-k} + c_{n-1} )/b \rfloor \\ u_n & = \sum_{i=1}^\infty x_{n+i-1} b^{-i} \end{align}
This generator can then be reprensented as an LCG and this class simply builds the correct MRGLattice object corresponding to a specific MWC generator. All the functions and attributes inherited by this class work as they would be expected to work on the lattice corresponding to that MRGLattice. For example, this means that the vector m_aCoef stores the coefficient of the LCG instead of the coefficients of the MWC generator.
This class simply implements a constructor and and the functions to compute the LCG equivalent to the MRG.
typedef NTL::vector<Int> LatMRG::MWCComponent< Int, Real >::IntVec |
typedef NTL::matrix<Int> LatMRG::MWCComponent< Int, Real >::IntMat |
LatMRG::MWCComponent< Int, Real >::MWCComponent | ( | const Int & | b, |
const IntVec & | e, | ||
int | k, | ||
int | maxDim = 1 ) |
b is the modulo.
e is the vector of coefficients. k is the order of the recurrence.
It is recommended to verify that the parameters passed to this constructor work before using it, because the program will crash of validate(b, e) != 0.
LatMRG::MWCComponent< Int, Real >::MWCComponent | ( | const Int & | b, |
const Int & | m, | ||
int | maxDim = 1 ) |
Another constructor with just b and m.
Of course, b and m have to be valid.
LatMRG::MWCComponent< Int, Real >::MWCComponent | ( | const MWCComponent< Int, Real > & | Lat | ) |
Copy constructor.
The maximal dimension of the created basis is set equal to Lat’s current dimension.
LatMRG::MWCComponent< Int, Real >::~MWCComponent | ( | ) |
Destructor.
MWCComponent< Int, Real > & LatMRG::MWCComponent< Int, Real >::operator= | ( | const MWCComponent< Int, Real > & | Lat | ) |
Assigns Lat to this object.
The maximal dimension of this basis is set equal to Lat’s current dimension.
void LatMRG::MWCComponent< Int, Real >::kill | ( | ) |
Cleans and releases memory used by this object.
std::string LatMRG::MWCComponent< Int, Real >::toStringCoef | ( | ) | const |
Gets the coefficients of the MRG that spawns the lattice in a string.
|
override |
Gets all the information on the lattice in a string.
This contains the type of generator and the coefficients.
|
inline |
The modulo of the MWC generator this object represents.
|
inline |
The order of the MWC generator.
An order of k means that the generator has k+1 coefficients.
|
inline |
The coefficients of the MWC generator.
We have that m_eCoef[i] = e_i. The MWC equations mean that if the order is k, the generator has k+1 coefficients.
|
inlinestatic |
This checks if b and e are suitable parameters for a MWC generator.
It is recommended to call this function before building a MWCComponent object because the program will exit if the condition verified here is not met.
This basically just checks that gcd(b, e[0]) = 1 and returns 1 if it is false and 0 if it checks out.
|
inlinestatic |
This is a basic method to check if the MWC generator described by b and e has full period.