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

Utility class used to read basic parameter fields in a configuration file. More...

#include <latmrg/ParamReaderExt.h>

Inheritance diagram for LatMRG::ParamReaderExt< Int, Dbl >:

Public Member Functions

 ParamReaderExt ()
 Constructor. More...
 
 ParamReaderExt (std::string fileName)
 Constructor. More...
 
 ~ParamReaderExt ()
 Destructor. More...
 
bool checkBound (const Int &m, const IntVec &A, int k)
 Checks that the components of \(A\) satisfy \(-m < A_i < m\), for \(i=1, 2, …, k\). More...
 
bool checkBound (const Int &m, const IntMat &A, int k)
 Checks that the components of \(A\) satisfy \(-m < A_{i,j} < m\), for \(i,j=1, 2, …, k\). More...
 
bool checkPrimePower (LatticeType lat, long e, long c, int k)
 In the case where lat = PRIMEPOWER, checks that the modulus \(m\) is given in the form \(m=b^e\), (that is \(e>0\) and \(c=0\). More...
 
void readCalcType (LatticeTester::CalcType &field, unsigned int line, unsigned int pos)
 Reads the type of calculation to do (PAL or BAL) for the PALPHA test from the pos-th token of the ln-th line into field. More...
 
void readDecompType (DecompType &field, unsigned int line, unsigned int pos)
 Reads the decomposition type from the pos-th token of the ln-th line into field. More...
 
void readGenType (GenType &field, unsigned int ln, unsigned int pos)
 Reads a GenType from the pos-th token of the ln-th line into field. More...
 
void readImplemCond (ImplemCond &field, unsigned int ln, unsigned int pos)
 Reads an implementation condition from the pos-th token of the ln-th line into field. More...
 
void readInterval (IntVec &B, IntVec &C, unsigned int &ln, int k)
 Reads 2k Int tokens into vectors B and C, starting at the ln-th line. More...
 
void readLacunary (int k, int fromDim, int toDim, unsigned int &ln, bool &lacunary, int &lacGroupSize, Int &lacSpacing, IntVec &Lac, GenType genType)
 Reads the fields, starting at the ln-th line, for a generator of order \(k\) and for a test in dimensions fromDim to toDim, to determine the lacunary indices, which are positive integers that will be read into Lac. More...
 
void readLacunaryType (LacunaryType &lacunaryType, unsigned int ln, unsigned int pos)
 Reads the type of lacunary projection used (either NONE, SUBVECTOR, or ARBITRARYINDICES). More...
 
void readLatticeType (LatticeType &field, unsigned int ln, unsigned int pos)
 Reads a lattice type from the pos-th token of the ln-th line into field. More...
 
void readMMat (IntMat &fields, unsigned int &ln, unsigned int pos, unsigned int numPos)
 Reads a IntMat from the pos-th token of the ln-th line into field. More...
 
void readMMRGLacunary (int ordre, int fromDim, int toDim, unsigned int &ln, bool &lacunary, LacunaryType &lacunaryType, int &m_numberLacIndices, IntVec &Lac, GenType genType)
 Reads the lacunary configuration specified in the input file. More...
 
void readOrbit (int J, MRGComponent< Int > **comp, unsigned int &ln)
 Reads the initial state for an orbit of a combined generator with \(J\) components comp, starting at the ln-th line. More...
 
void readSearchMethod (SearchMethod &field, unsigned int ln, unsigned int pos)
 Reads a search method from the pos-th token of the ln-th line into field. More...
 

Static Public Attributes

static const int MAX_WORD_SIZE = 64
 

Private Types

typedef NTL::matrix< Int > IntMat
 
typedef NTL::vector< Int > IntVec
 

Private Member Functions

void init ()
 Does nothing for now. More...
 
bool isDelim (char c)
 Checks if the character c is to be considered as a token separator or not. More...
 

Private Attributes

std::string m_fileName
 The path of the opened file. More...
 
std::vector< std::string > m_lines
 Internal line buffer. More...
 

Detailed Description

template<typename Int, typename Dbl>
class LatMRG::ParamReaderExt< Int, Dbl >

Utility class used to read basic parameter fields in a configuration file.

Lines whose first non-blank character is a # are considered as comments and discarded.

Member Typedef Documentation

◆ IntMat

template<typename Int , typename Dbl >
typedef NTL::matrix<Int> LatMRG::ParamReaderExt< Int, Dbl >::IntMat
private

◆ IntVec

template<typename Int , typename Dbl >
typedef NTL::vector<Int> LatMRG::ParamReaderExt< Int, Dbl >::IntVec
private

Constructor & Destructor Documentation

◆ ParamReaderExt() [1/2]

template<typename Int , typename Dbl >
LatMRG::ParamReaderExt< Int, Dbl >::ParamReaderExt ( )

Constructor.

◆ ParamReaderExt() [2/2]

template<typename Int , typename Dbl >
LatMRG::ParamReaderExt< Int, Dbl >::ParamReaderExt ( std::string  fileName)

Constructor.

Opens the file fileName.

◆ ~ParamReaderExt()

template<typename Int , typename Dbl >
LatMRG::ParamReaderExt< Int, Dbl >::~ParamReaderExt ( )

Destructor.

Member Function Documentation

◆ checkBound() [1/2]

template<typename Int , typename Dbl >
bool LatMRG::ParamReaderExt< Int, Dbl >::checkBound ( const Int &  m,
const IntVec A,
int  k 
)

Checks that the components of \(A\) satisfy \(-m < A_i < m\), for \(i=1, 2, …, k\).

◆ checkBound() [2/2]

template<typename Int , typename Dbl >
bool LatMRG::ParamReaderExt< Int, Dbl >::checkBound ( const Int &  m,
const IntMat A,
int  k 
)

Checks that the components of \(A\) satisfy \(-m < A_{i,j} < m\), for \(i,j=1, 2, …, k\).

◆ checkPrimePower()

template<typename Int , typename Dbl >
bool LatMRG::ParamReaderExt< Int, Dbl >::checkPrimePower ( LatticeType  lat,
long  e,
long  c,
int  k 
)

In the case where lat = PRIMEPOWER, checks that the modulus \(m\) is given in the form \(m=b^e\), (that is \(e>0\) and \(c=0\).

Checks also that the order \(k=1\). If these conditions are not satisfied, stops the program.

◆ init()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::init ( )
inlineprivate

Does nothing for now.

◆ isDelim()

template<typename Int , typename Dbl >
bool LatMRG::ParamReaderExt< Int, Dbl >::isDelim ( char  c)
private

Checks if the character c is to be considered as a token separator or not.

◆ readCalcType()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::readCalcType ( LatticeTester::CalcType &  field,
unsigned int  line,
unsigned int  pos 
)

Reads the type of calculation to do (PAL or BAL) for the PALPHA test from the pos-th token of the ln-th line into field.

◆ readDecompType()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::readDecompType ( DecompType field,
unsigned int  line,
unsigned int  pos 
)

Reads the decomposition type from the pos-th token of the ln-th line into field.

◆ readGenType()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::readGenType ( GenType field,
unsigned int  ln,
unsigned int  pos 
)

Reads a GenType from the pos-th token of the ln-th line into field.

◆ readImplemCond()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::readImplemCond ( ImplemCond field,
unsigned int  ln,
unsigned int  pos 
)

Reads an implementation condition from the pos-th token of the ln-th line into field.

◆ readInterval()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::readInterval ( IntVec B,
IntVec C,
unsigned int &  ln,
int  k 
)

Reads 2k Int tokens into vectors B and C, starting at the ln-th line.

These represent a box \([B_i, C_i]\), \(i = 1, 2, …, k\). The \(B_i, C_i\) must be given in the order \(B_1, C_1, B_2, C_2, …, B_k, C_k\), each on a line of its own. Each coefficient may be given in the form described in readNumber3 above.

◆ readLacunary()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::readLacunary ( int  k,
int  fromDim,
int  toDim,
unsigned int &  ln,
bool &  lacunary,
int &  lacGroupSize,
Int &  lacSpacing,
IntVec Lac,
GenType  genType 
)

Reads the fields, starting at the ln-th line, for a generator of order \(k\) and for a test in dimensions fromDim to toDim, to determine the lacunary indices, which are positive integers that will be read into Lac.

The vector of lacunary indices Lac is created here with the appropriate dimension. If the first two values read are \(s = \) lacGroupSize and \(d = \) lacSpacing and if \(s>0\), then what will be analyzed is the lattice structure of vectors of the form \((u_{i+1}, …, u_{i+s}, u_{i+d+1},…, u_{i+d+s}, u_{i+2d+1},…, u_{i+2d+s}, …)\), formed by groups of \(s\) successive values, taken \(d\) values apart. To analyze lacunary indices that are not evenly spaced, put \(s = -t\) where \(t = \) MaxDim and, on the \(t\) lines that follow, give the \(t\) lacunary indices \(i_1,…,i_t\), which are to be interpreted as in Section. In all these cases, the lacunary flag is set true. To analyze vectors of successive values (the non-lacunary case), take \(s=d=1\) or \(s\ge\) MaxDim. In this case, the lacunary flag is set false.

◆ readLacunaryType()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::readLacunaryType ( LacunaryType lacunaryType,
unsigned int  ln,
unsigned int  pos 
)

Reads the type of lacunary projection used (either NONE, SUBVECTOR, or ARBITRARYINDICES).

◆ readLatticeType()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::readLatticeType ( LatticeType field,
unsigned int  ln,
unsigned int  pos 
)

Reads a lattice type from the pos-th token of the ln-th line into field.

◆ readMMat()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::readMMat ( IntMat fields,
unsigned int &  ln,
unsigned int  pos,
unsigned int  numPos 
)

Reads a IntMat from the pos-th token of the ln-th line into field.

◆ readMMRGLacunary()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::readMMRGLacunary ( int  ordre,
int  fromDim,
int  toDim,
unsigned int &  ln,
bool &  lacunary,
LacunaryType lacunaryType,
int &  m_numberLacIndices,
IntVec Lac,
GenType  genType 
)

Reads the lacunary configuration specified in the input file.

If lacunaryType is NONE, then the projection is done without lacunary indices. If lacunaryType is SUBVECTOR, the projection is performed using only the specified coordinates for each vector (m_numberLacIndices coordinates per vector) until the dimension toDim is reached. Finally, if lacunaryType is ARBITRARYINDICES, the projection is performed using the specified indices (m_numberLacIndices of them).

◆ readOrbit()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::readOrbit ( int  J,
MRGComponent< Int > **  comp,
unsigned int &  ln 
)

Reads the initial state for an orbit of a combined generator with \(J\) components comp, starting at the ln-th line.

Each line must have a set of \(k_j\) numbers which are the seeds of the orbit for each component, where \(k_j\) is the order of the \(j\)-th component. On exiting this method, the line number is reset to ln + \(J\).

◆ readSearchMethod()

template<typename Int , typename Dbl >
void LatMRG::ParamReaderExt< Int, Dbl >::readSearchMethod ( SearchMethod field,
unsigned int  ln,
unsigned int  pos 
)

Reads a search method from the pos-th token of the ln-th line into field.

Member Data Documentation

◆ m_fileName

template<typename Int , typename Dbl >
std::string LatMRG::ParamReaderExt< Int, Dbl >::m_fileName
private

The path of the opened file.

◆ m_lines

template<typename Int , typename Dbl >
std::vector<std::string> LatMRG::ParamReaderExt< Int, Dbl >::m_lines
private

Internal line buffer.

◆ MAX_WORD_SIZE

template<typename Int , typename Dbl >
const int LatMRG::ParamReaderExt< Int, Dbl >::MAX_WORD_SIZE = 64
static

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