LatMRG Online Documentation unknown
Tools to analyze the lattice structure of linear generators
|
This class offers tools to verify if an MRG recurrence or order \(k\) modulo \(m\), of the form. More...
Public Member Functions | |
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 (Int b, int64_t e, Int c, int64_t k, DecompType decompm1, const char *filem1, DecompType decompr, const char *filer) | |
Same as the previous constructor, but with \(m = b^e + c\). | |
~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. |
This class offers tools to verify if an MRG recurrence or order \(k\) modulo \(m\), of the form.
\[ x_n = (a_1 x_{n-1} + \cdots+ a_k x_{n-k}) \mbox{ mod } m, \]
has full period or not. The object is constructed for given values of \(k\) and \(m\), and can be used for several values of the coefficients \(a_1,\dots,a_k\). It stores information such as the factorizations of \(m-1\) and of \(r = (m^k-1)/(m-1)\), which are needed to check the full period conditions. It does not look at the lattice structure.
LatMRG::MRGComponent< Int >::MRGComponent | ( | const Int & | m, |
int64_t | k, | ||
DecompType | decompm1, | ||
const char * | filem1, | ||
DecompType | decompr, | ||
const char * | filer ) |
Constructor for modulus \(m\) and order \(k\).
The vector of multipliers must be set separately by setaa. The Arguments decom1 and decor specify the type of the prime factor decomposition of \(m-1\) and \(r=(m^k-1)/(m-1)\), respectively. The type DecompType is defined in EnumTypes and offers the following choices: DECOMP: the integer will be factored, DECOMP_WRITE: it will be factored and the prime factors written in a file, DECOMP_READ: the prime factors are read from a file, DECOMP_PRIME: the integer is assumed to be prime. The names filem1 and filer (character strings) specify the file where the factors of \(m-1\) and \(r\), are read or written when the type DECOMP_WRITE or DECOMP_READ is used. The given files must be accessible by the program. The format for the factorization in these files is described in class IntFactorization.
LatMRG::MRGComponent< Int >::MRGComponent | ( | Int | b, |
int64_t | e, | ||
Int | c, | ||
int64_t | k, | ||
DecompType | decompm1, | ||
const char * | filem1, | ||
DecompType | decompr, | ||
const char * | filer ) |
Same as the previous constructor, but with \(m = b^e + c\).
LatMRG::MRGComponent< Int >::~MRGComponent | ( | ) |
Destructor.
template<typename Int> MRGComponent<Int>::MRGComponent(Modulus<Int> &modu, int64_t k, DecompType decom1, const char *filem1, DecompType decor, const char *filer) { init(modu.m, k, decom1, filem1, decor, filer);
LatticeTester::PrimeType status = LatticeTester::IntFactor < Int
::isPrime(modu.m, 100); if (status == LatticeTester::PRIME || LatticeTester::PROB_PRIME == status) { modu.primeF = true; } else { std::cout << " WARNING: m is NOT prime" << std::endl; modu.primeF = false; } module = modu; }
void LatMRG::MRGComponent< Int >::setaa | ( | const IntVec & | aa | ) |
Sets the vector of multipliers to aa, with aa[j] containing \(a_j\).
The order \(k\) of the MRG is set equal to the length of this vector, plus 1. If we only want to call maxPeriod, there is no need to call setaa before.
|
inline |
Returns the vector of multipliers of the recurrence, in same format as aa above.
bool LatMRG::MRGComponent< Int >::maxPeriod | ( | const IntVec & | aa | ) |
Returns true if the coefficients \(aa\) give an MRG with maximal period; returns false otherwise.
bool LatMRG::MRGComponent< Int >::maxPeriod23 | ( | const IntVec & | aa | ) |
Assumes that the maximal-period condition (1) holds and checks only for conditions 2 and 3.
Returns true iff these two conditions hold for the vector of coefficients \(aa\).
|
inline |
Returns the value of the modulus \(m\) of the recurrence.
|
inline |
Returns the value of the order \(k\) of the recurrence.
|
inline |
Returns the value of b for which b^e+r = m, when available.
|
inline |
Returns the value of e for which b^e+r = m, when available.
|
inline |
Returns the value of c for which b^e+c = m, when available.
|
inline |
Returns a const reference to the initial state orbitSeed, when available.
std::string LatMRG::MRGComponent< Int >::toString | ( | ) |
Returns a descriptor of this object as a string.