Lattice Tester Guide
1.0-9
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
|
Utility class that can be used to read different kind of data from a file. More...
#include <latticetester/ParamReader.h>
Public Member Functions | |
ParamReader () | |
Empty constructor. More... | |
ParamReader (std::string fileName) | |
Constructor. More... | |
~ParamReader () | |
Destructor. More... | |
void | getLines () |
Reads all the lines from the file and stores them into this object’s buffer. More... | |
void | readString (std::string &field, unsigned int ln, unsigned int pos) |
Reads a string from the pos -th token of the ln -th line into field . More... | |
void | readBool (bool &field, unsigned int ln, unsigned int pos) |
Reads a boolean from the pos -th token of the ln -th line into field . More... | |
void | readChar (char &field, unsigned int ln, unsigned int pos) |
Reads a character from the pos -th token of the ln -th line into field . More... | |
void | readInt (int &field, unsigned int ln, unsigned int pos) |
Reads an integer from the pos -th token of the ln -th line into field . More... | |
void | readLong (std::int64_t &field, unsigned int ln, unsigned int pos) |
Reads a std::int64_t from the pos -th token of the ln -th line into field . More... | |
void | readZZ (NTL::ZZ &field, unsigned int ln, int pos) |
Reads a large integer from the pos -th token of the ln -th line into field . More... | |
void | readDouble (double &field, unsigned int ln, unsigned int pos) |
Reads a double from the pos -th token of the ln -th line into field . More... | |
void | readNumber3 (Int &r, std::int64_t &b, std::int64_t &e, std::int64_t &c, unsigned int ln, unsigned int pos) |
Reads \(b\), \(e\) and \(c\), starting at the pos -th token of the ln -th line and uses them to define \(r\). More... | |
void | readBScal (BasInt &field, unsigned int ln, int pos) |
Reads a BScal from the pos -th token of the ln -th line into field . More... | |
void | readBMat (BasIntMat &fields, unsigned int &ln, unsigned int pos, unsigned int numPos, unsigned int numCols) |
Reads a square BMat of size numPos*numPos from the pos -th token of the ln -th line into field . More... | |
void | readBMat (BasIntMat &fields, unsigned int &ln, unsigned int pos, unsigned int numPos) |
Reads a square BMat of size numPos*numPos from the pos -th token of the ln -th line into field . More... | |
void | readMScal (Int &field, unsigned int ln, unsigned int pos) |
Reads a Int from the pos -th token of the ln -th line into field . More... | |
void | readRedDbl (RedDbl &field, unsigned int ln, unsigned int pos) |
Reads a RedDbl from the pos -th token of the ln -th line into field . More... | |
void | readMVect (IntVec &field, unsigned int &ln, unsigned int pos, unsigned int num, int j) |
Reads num tokens (from the pos -th token of the ln -th line) into field , starting at index \(j\) of field . More... | |
void | readIntVect (int *field, unsigned int ln, unsigned int pos, unsigned int num, int j) |
Reads num tokens (from the pos -th token of the ln -th line) into field , starting at index \(j\) of field . More... | |
void | readDoubleVect (double *field, unsigned int ln, unsigned int pos, unsigned int num, int j) |
Reads num tokens (from the pos -th token of the ln -th line) into field , starting at index \(j\) of field . More... | |
void | readNormType (NormType &field, unsigned int ln, unsigned int pos) |
Reads 2k MScal tokens into vectors B and C , starting at the ln -th line. More... | |
void | readProblemType (ProblemType &field, unsigned int ln, unsigned int pos) |
Reads a problem type from the pos -th token of the ln -th line into field . More... | |
void | readCriterionType (CriterionType &field, unsigned int ln, unsigned int pos) |
Reads a test type from the pos -th token of the ln -th line into field . More... | |
void | readNormaType (NormaType &field, unsigned int ln, unsigned int pos) |
Reads a type of normalization from the pos -th token of the ln -th line into field . More... | |
void | readPrecisionType (PrecisionType &field, unsigned int ln, unsigned int pos) |
Reads a type of precision from the pos -th token of the ln -th line into field . More... | |
void | readPreRed (PreReductionType &field, unsigned int ln, unsigned int pos) |
Reads a type of PreReduction from the pos -th token of the ln -th line into field . More... | |
void | readOutputType (OutputType &field, unsigned int ln, unsigned int pos) |
Reads an output form from the pos -th token of the ln -th line into field . More... | |
void | read (Config< Int, BasIntMat > &config) |
Reads the configuration file into config . More... | |
Protected Member Functions | |
void | getToken (std::string &field, unsigned int ln, unsigned int pos) |
Puts into field the pos -th string token from line ln . More... | |
void | readBasisConfig (Config< Int, BasIntMat > &config, unsigned int &ln) |
This can be called to read a basis construction configuration from the file starting from ln (without the BASIS line). More... | |
void | readDualConfig (Config< Int, BasIntMat > &config, unsigned int &ln) |
This can be called to read a dual computation configuration from the file starting from ln (without the DUAL line). More... | |
void | readReductionConfig (Config< Int, BasIntMat > &config, unsigned int &ln) |
This can be called to read a reduction problem configuration from the file starting from ln (without the REDUCT line). More... | |
void | readShortestConfig (Config< Int, BasIntMat > &config, unsigned int &ln) |
This can be called to read a shortest vector problem configuration from the file starting from ln (without the SHORTEST line). More... | |
void | readMeritConfig (Config< Int, BasIntMat > &config, unsigned int &ln) |
This can be called to read a figure of merit computation configuration from the file starting from ln (without the MERIT line). More... | |
Utility class that can be used to read different kind of data from a file.
This class has to be initialized with a fileName
to be used. After the object is initialized, it is then necessary to read the entire file with getLines
. This will make a vector containing all the lines of the file, removing those with a #
at the start. There then are many methods allowing the conversion of string tokens to various data types by specifying a line and a token number. In every line, a token is a string delimited by any of these caracters: (blank), ?
, !
, ,
, \t
, and \n
. For example, ReadString(string, 2, 3)
will put the 4th token (numerotation starts at 0) of the 3rd line in string. The user of this class has to be aware of the format of the file that will be read.
GetToken
method because the program curently simply crashes without explanation if this class is misued. LatticeTester::ParamReader< Int, BasInt, RedDbl >::ParamReader | ( | ) |
Empty constructor.
Allocates space for a word.
LatticeTester::ParamReader< Int, BasInt, RedDbl >::ParamReader | ( | std::string | fileName | ) |
Constructor.
Opens the file fileName
.
LatticeTester::ParamReader< Int, BasInt, RedDbl >::~ParamReader | ( | ) |
Destructor.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::getLines | ( | ) |
Reads all the lines from the file and stores them into this object’s buffer.
Lines whose first non-blank character is a #
are considered as comments and discarded. Empty lines are also discarded.
|
protected |
Puts into field
the pos
-th string token from line ln
.
This is intended to be used by other methods the get a specific string token that can then be converted. This method uses tokenize
to split the line it has to operate on.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::read | ( | Config< Int, BasIntMat > & | config | ) |
Reads the configuration file into config
.
This reads the file, looking for information in a specific order, to populate config
with enough information to exectute a LatticeAnalysis
test. The standard format is described in Using the executable.
|
protected |
This can be called to read a basis construction configuration from the file starting from ln
(without the BASIS
line).
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readBMat | ( | BasIntMat & | fields, |
unsigned int & | ln, | ||
unsigned int | pos, | ||
unsigned int | numPos, | ||
unsigned int | numCols | ||
) |
Reads a square BMat
of size numPos*numPos
from the pos
-th token of the ln
-th line into field
.
The lines in the matrix will be read from the subsequent lines in the file, starting from token at the position pos
. fields
has to be initialized to the right size.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readBMat | ( | BasIntMat & | fields, |
unsigned int & | ln, | ||
unsigned int | pos, | ||
unsigned int | numPos | ||
) |
Reads a square BMat
of size numPos*numPos
from the pos
-th token of the ln
-th line into field
.
The lines in the matrix will be read from the subsequent lines in the file, starting from token at the position pos
. fields
has to be initialized to the right size.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readBool | ( | bool & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads a boolean from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readBScal | ( | BasInt & | field, |
unsigned int | ln, | ||
int | pos | ||
) |
Reads a BScal
from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readChar | ( | char & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads a character from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readCriterionType | ( | CriterionType & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads a test type from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readDouble | ( | double & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads a double from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readDoubleVect | ( | double * | field, |
unsigned int | ln, | ||
unsigned int | pos, | ||
unsigned int | num, | ||
int | j | ||
) |
Reads num
tokens (from the pos
-th token of the ln
-th line) into field
, starting at index \(j\) of field
.
|
protected |
This can be called to read a dual computation configuration from the file starting from ln
(without the DUAL
line).
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readInt | ( | int & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads an integer from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readIntVect | ( | int * | field, |
unsigned int | ln, | ||
unsigned int | pos, | ||
unsigned int | num, | ||
int | j | ||
) |
Reads num
tokens (from the pos
-th token of the ln
-th line) into field
, starting at index \(j\) of field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readLong | ( | std::int64_t & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads a std::int64_t from the pos
-th token of the ln
-th line into field
.
|
protected |
This can be called to read a figure of merit computation configuration from the file starting from ln
(without the MERIT
line).
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readMScal | ( | Int & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads a Int
from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readMVect | ( | IntVec & | field, |
unsigned int & | ln, | ||
unsigned int | pos, | ||
unsigned int | num, | ||
int | j | ||
) |
Reads num
tokens (from the pos
-th token of the ln
-th line) into field
, starting at index \(j\) of field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readNormaType | ( | NormaType & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads a type of normalization from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readNormType | ( | NormType & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads 2k MScal
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.Reads a norm from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readNumber3 | ( | Int & | r, |
std::int64_t & | b, | ||
std::int64_t & | e, | ||
std::int64_t & | c, | ||
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads \(b\), \(e\) and \(c\), starting at the pos
-th token of the ln
-th line and uses them to define \(r\).
The numbers in the data file may be given in one of the two following formats:
\(\bullet\) A single integer giving the value of \(r=b\) directly on a line. In that case, one sets \(e=c=0\).
\(\bullet\) Three integers \(b\), \(e\), \(c\) on the same line, separated by at least one blank. The \(r\) value will be set as \(r=b^e+c\) if \(b>0\), and \(r= -(|b|^e+c)\) if \(b<0\). One must have \(e\ge0\). For example, \((b, e, c) = (2, 5, -1)\) will give \(r=31\), while \((b, e, c) = (-2, 5, -1)\) will give \(r=-31\).
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readOutputType | ( | OutputType & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads an output form from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readPrecisionType | ( | PrecisionType & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads a type of precision from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readPreRed | ( | PreReductionType & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads a type of PreReduction from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readProblemType | ( | ProblemType & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads a problem type from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readRedDbl | ( | RedDbl & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads a RedDbl
from the pos
-th token of the ln
-th line into field
.
|
protected |
This can be called to read a reduction problem configuration from the file starting from ln
(without the REDUCT
line).
|
protected |
This can be called to read a shortest vector problem configuration from the file starting from ln
(without the SHORTEST
line).
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readString | ( | std::string & | field, |
unsigned int | ln, | ||
unsigned int | pos | ||
) |
Reads a string from the pos
-th token of the ln
-th line into field
.
void LatticeTester::ParamReader< Int, BasInt, RedDbl >::readZZ | ( | NTL::ZZ & | field, |
unsigned int | ln, | ||
int | pos | ||
) |
Reads a large integer from the pos
-th token of the ln
-th line into field
.