LatMRG Guide
1.0
A software package to test and search for new linear congruential random number generators
|
This class keeps parameters closely associated with a modulus of congruence. More...
#include <latmrg/Modulus.h>
Public Member Functions | |
Modulus () | |
Modulus (const Int &m) | |
Constructor with modulus of congruence \(m\). More... | |
Modulus (long b, long e, long c) | |
Constructor with value \(m =b^e + c\). More... | |
virtual | ~Modulus () |
Destructor. More... | |
void | init (const Int &m) |
Initializes with value \(m\). More... | |
void | init (long b, long e, long c) |
Initializes with value \(m =b^e + c\). More... | |
bool | perMaxPowPrime (const Int &a) |
Assumes that \(m\) is a power of a prime \(p=b\), the order \(k = 1\), and the recurrence is homogeneous. More... | |
void | reduceM (const Int &a) |
Reduces the modulus \(m\) and sets the variable mRed to the reduced modulus. More... | |
Public Attributes | |
long | b |
long | c |
When threeF is true , then \(m\) is given in the form \(m = b^e + c\); otherwise, \(b\), \(e\) and \(c\) are undefined. More... | |
long | e |
Int | m |
Value \(m\) of the modulus. More... | |
Int | mRac |
\(\sqrt{\lfloor m \rfloor}\). More... | |
Int | mRacNeg |
\(-\sqrt{\lfloor m \rfloor}\). More... | |
Int | mRed |
Reduced value of the modulus. More... | |
bool | primeF |
This flag is true when \(m\) is prime, otherwise false . More... | |
bool | threeF |
When this flag is true , the value of \(m\) is built out of the three numbers \(b\), \(e\) and \(c\) as described below; otherwise, the flag is set false . More... | |
Private Attributes | |
Int | b2 |
The constant \(b^2\). More... | |
Int | bm1 |
The constant \(b - 1\). More... | |
Int | Eight |
Int | Four |
Int | Y |
Work variables. More... | |
This class keeps parameters closely associated with a modulus of congruence.
Using it, it will not be necessary to recalculate the square roots of large integers, which are used repeatedly in searches for good generators.
LatMRG::Modulus< Int >::Modulus | ( | ) |
LatMRG::Modulus< Int >::Modulus | ( | const Int & | m | ) |
Constructor with modulus of congruence \(m\).
LatMRG::Modulus< Int >::Modulus | ( | long | b, |
long | e, | ||
long | c | ||
) |
Constructor with value \(m =b^e + c\).
Restrictions: \(b>1\) and \(e > 0\).
|
virtual |
Destructor.
void LatMRG::Modulus< Int >::init | ( | const Int & | m | ) |
Initializes with value \(m\).
Computes mRac
and mRacNeg
.
void LatMRG::Modulus< Int >::init | ( | long | b, |
long | e, | ||
long | c | ||
) |
Initializes with value \(m =b^e + c\).
Restrictions: \(b>1\) and \(e > 0\). Computes mRac
and mRacNeg
.
bool LatMRG::Modulus< Int >::perMaxPowPrime | ( | const Int & | a | ) |
Assumes that \(m\) is a power of a prime \(p=b\), the order \(k = 1\), and the recurrence is homogeneous.
Returns true
iff the maximal period conditions are satisfied.
void LatMRG::Modulus< Int >::reduceM | ( | const Int & | a | ) |
Reduces the modulus \(m\) and sets the variable mRed
to the reduced modulus.
The modulus must have the form \(m=p^e\). The multiplier of the LCG is \(a\).
long LatMRG::Modulus< Int >::b |
|
private |
The constant \(b^2\).
|
private |
The constant \(b - 1\).
long LatMRG::Modulus< Int >::c |
When threeF
is true
, then \(m\) is given in the form \(m = b^e + c\); otherwise, \(b\), \(e\) and \(c\) are undefined.
long LatMRG::Modulus< Int >::e |
|
private |
|
private |
Int LatMRG::Modulus< Int >::m |
Value \(m\) of the modulus.
Int LatMRG::Modulus< Int >::mRac |
\(\sqrt{\lfloor m \rfloor}\).
Int LatMRG::Modulus< Int >::mRacNeg |
\(-\sqrt{\lfloor m \rfloor}\).
Int LatMRG::Modulus< Int >::mRed |
Reduced value of the modulus.
Computed by reduceM
.
bool LatMRG::Modulus< Int >::primeF |
This flag is true
when \(m\) is prime, otherwise false
.
bool LatMRG::Modulus< Int >::threeF |
When this flag is true
, the value of \(m\) is built out of the three numbers \(b\), \(e\) and \(c\) as described below; otherwise, the flag is set false
.
|
private |
Work variables.