LatMRG Guide  1.0
A software package to test and search for new linear congruential random number generators
LatMRG::Modulus< Int > Class Template Reference

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...
 

Detailed Description

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

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.

Constructor & Destructor Documentation

◆ Modulus() [1/3]

template<typename Int >
LatMRG::Modulus< Int >::Modulus ( )

◆ Modulus() [2/3]

template<typename Int >
LatMRG::Modulus< Int >::Modulus ( const Int &  m)

Constructor with modulus of congruence \(m\).

◆ Modulus() [3/3]

template<typename Int >
LatMRG::Modulus< Int >::Modulus ( long  b,
long  e,
long  c 
)

Constructor with value \(m =b^e + c\).

Restrictions: \(b>1\) and \(e > 0\).

◆ ~Modulus()

template<typename Int >
LatMRG::Modulus< Int >::~Modulus ( )
virtual

Destructor.

Member Function Documentation

◆ init() [1/2]

template<typename Int >
void LatMRG::Modulus< Int >::init ( const Int &  m)

Initializes with value \(m\).

Computes mRac and mRacNeg.

◆ init() [2/2]

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

◆ perMaxPowPrime()

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

◆ reduceM()

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

Member Data Documentation

◆ b

template<typename Int >
long LatMRG::Modulus< Int >::b

◆ b2

template<typename Int >
Int LatMRG::Modulus< Int >::b2
private

The constant \(b^2\).

◆ bm1

template<typename Int >
Int LatMRG::Modulus< Int >::bm1
private

The constant \(b - 1\).

◆ c

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

◆ e

template<typename Int >
long LatMRG::Modulus< Int >::e

◆ Eight

template<typename Int >
Int LatMRG::Modulus< Int >::Eight
private

◆ Four

template<typename Int >
Int LatMRG::Modulus< Int >::Four
private

◆ m

template<typename Int >
Int LatMRG::Modulus< Int >::m

Value \(m\) of the modulus.

◆ mRac

template<typename Int >
Int LatMRG::Modulus< Int >::mRac

\(\sqrt{\lfloor m \rfloor}\).

◆ mRacNeg

template<typename Int >
Int LatMRG::Modulus< Int >::mRacNeg

\(-\sqrt{\lfloor m \rfloor}\).

◆ mRed

template<typename Int >
Int LatMRG::Modulus< Int >::mRed

Reduced value of the modulus.

Computed by reduceM.

◆ primeF

template<typename Int >
bool LatMRG::Modulus< Int >::primeF

This flag is true when \(m\) is prime, otherwise false.

◆ threeF

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

◆ Y

template<typename Int >
Int LatMRG::Modulus< Int >::Y
private

Work variables.


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