LatMRG Online Documentation unknown
Tools to analyze the lattice structure of linear generators
Loading...
Searching...
No Matches
LatMRG::MRGComponent< Int > Class Template Reference

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.

Detailed Description

template<typename Int>
class LatMRG::MRGComponent< Int >

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.

Constructor & Destructor Documentation

◆ MRGComponent() [1/2]

template<typename Int>
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.

◆ MRGComponent() [2/2]

template<typename Int>
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\).

◆ ~MRGComponent()

template<typename Int>
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; }

Member Function Documentation

◆ setaa()

template<typename Int>
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.

◆ getaa()

template<typename Int>
IntVec LatMRG::MRGComponent< Int >::getaa ( ) const
inline

Returns the vector of multipliers of the recurrence, in same format as aa above.

◆ maxPeriod()

template<typename Int>
bool LatMRG::MRGComponent< Int >::maxPeriod ( const IntVec & aa)

Returns true if the coefficients \(aa\) give an MRG with maximal period; returns false otherwise.

◆ maxPeriod23()

template<typename Int>
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\).

◆ getModulus()

template<typename Int>
const Int LatMRG::MRGComponent< Int >::getModulus ( ) const
inline

Returns the value of the modulus \(m\) of the recurrence.

◆ getOrder()

template<typename Int>
int64_t LatMRG::MRGComponent< Int >::getOrder ( ) const
inline

Returns the value of the order \(k\) of the recurrence.

◆ getb()

template<typename Int>
Int & LatMRG::MRGComponent< Int >::getb ( )
inline

Returns the value of b for which b^e+r = m, when available.

◆ gete()

template<typename Int>
int64_t & LatMRG::MRGComponent< Int >::gete ( )
inline

Returns the value of e for which b^e+r = m, when available.

◆ getc()

template<typename Int>
Int & LatMRG::MRGComponent< Int >::getc ( )
inline

Returns the value of c for which b^e+c = m, when available.

◆ getOrbitSeed()

template<typename Int>
IntVec & LatMRG::MRGComponent< Int >::getOrbitSeed ( )
inline

Returns a const reference to the initial state orbitSeed, when available.

◆ toString()

template<typename Int>
std::string LatMRG::MRGComponent< Int >::toString ( )

Returns a descriptor of this object as a string.


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