Lattice Tester Guide  1.0-9
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl > Class Template Reference

Objects of this class can perform various tests on lattices. More...

#include <latticetester/LatticeAnalysis.h>

Public Member Functions

 LatticeAnalysis ()
 Base constructor for the case where the data will come from files. More...
 
 LatticeAnalysis (Config< Int, BasIntMat > &config)
 Constructor containing all the fields needed to perform a test. More...
 
 ~LatticeAnalysis ()
 Destructor. More...
 
bool doTest (Config< Int, BasIntMat > &config)
 Launches the computation specified in config. More...
 
void printTestResults (const char *infile)
 This prints the result of the last computation that was asked to this object, as well as the configuration used. More...
 
int doTestFromInputFile (const char *datafile)
 Reads the parameters of the test in input text file datafile; then does the specified computation. More...
 
int doTestFromDirectory (const char *dirname)
 Applies the method doTestFromInputFile to all the files with extension ".dat" in directory named dirname. More...
 

Protected Member Functions

bool performBasis (Config< Int, BasIntMat > &config)
 This will perform a basis construction according to the configuration and the basis of config. More...
 
bool performDual (Config< Int, BasIntMat > &config)
 This will perform a dual construction according to the configuration and the basis of config. More...
 
bool performReduction (Config< Int, BasIntMat > &config)
 This will perform a lattice reduction according to the configuration and the basis of config. More...
 
bool performShortest (Config< Int, BasIntMat > &config)
 This will solve the shortest vector problem according to the configuration and the basis of config. More...
 
bool performMerit (Config< Int, BasIntMat > &config)
 This will compute a figure of merit according to the configuration and the basis of config. More...
 

Protected Attributes

double m_merit
 This contains the last figure of merit computed. More...
 
double m_shortest
 This contains the length of the shortest vector that was last computed. More...
 

Detailed Description

template<typename Int, typename BasInt, typename Dbl, typename RedDbl>
class LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >

Objects of this class can perform various tests on lattices.

There are two intended usages of this class.

  • The first one is the one used in the lattest executable, it is to simply pass a directory name (resp. a file name) to the program to perform the tests specified in the .dat files in the directory (resp. the file itself).
  • The other possibility is to instanciate all the needed fields of the class independently and to call the doTest() method. This approach is more flexible and allows easy implementation of small scripts.

The tests consist on the computation of one of the figures of merit enumerated in CriterionType. If the user intend to simply reduce a lattice basis, he should look into the Reducer module since it offers much more flexibility. This class curently only implements the spectral and the Beyer test.

To use this class it is imperative to instanciate a Reducer object with the basis of the lattice to analyse. After that, you have to pass, either by the constructor or by the various methods available, all the parameters necessary to do a test (these are listed under the empty constructor). Finally, you simply have to call the doTest() method and the m_merit field will contain the figure of merit that was asked for.

Constructor & Destructor Documentation

◆ LatticeAnalysis() [1/2]

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::LatticeAnalysis ( )

Base constructor for the case where the data will come from files.

In that case, the fields of the class will be instanciated when read. This constructor can also be used to create a default object for the class that will be populated one field at a time by the user.

If the user choose to fill by hand the fields that are needed, he needs to fill the following fields:

  • m_reducer with a valid reducer containing a basis.
  • m_criterion with the criterion for the figure of merit he wants
  • m_preRed with one of the pre-reduction strategies.
  • m_norm with one of the norms for which the selected test has been implemented.

◆ LatticeAnalysis() [2/2]

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::LatticeAnalysis ( Config< Int, BasIntMat > &  config)

Constructor containing all the fields needed to perform a test.

  • reducer is the reducer that will be used to perform the tests. It will be stored as a pointer, so the object can be retrieved even after the tests have been done. Also note that the reducer contains the basis and that all interactions with the lattice basis will be done through this object.
  • criterion is the criterion for which the tests will be applied. For the various options, see the CriterionType enum.
  • preRed is the chose of pre-reduction algorithm. See PreReductionType for a list of option.
  • norm is the norm that will be used to compute the different vector lengths in the algorithms. For a list of options, look at NormType.
  • MaxNodesBB is the maximum number of nodes that the program will use when doing the branch-and-bound algorithm to find the shortest vector.
  • normaType is the normalization type to be used. See NormaType for a list of options.
  • alpha is the \(\alpha\) parameter for the \(\mathcal{P}_\alpha\) test. As of now, this test is not implemented.

◆ ~LatticeAnalysis()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::~LatticeAnalysis ( )
inline

Destructor.

This will deallocate memory to m_normalizer if it is not null.

Member Function Documentation

◆ doTest()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
bool LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::doTest ( Config< Int, BasIntMat > &  config)

Launches the computation specified in config.

This will not print the results, but they can be retrieved via the printTestResults() method. This will store the config passed to this object for printing latter.

◆ doTestFromDirectory()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
int LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::doTestFromDirectory ( const char *  dirname)

Applies the method doTestFromInputFile to all the files with extension ".dat" in directory named dirname.

This will print all the results, but will only keep in memory the results of the last computation done.

Returns 0 if all the tests completed successfully; returns a non-zero integer if there was an error. Even if there is an error with one of the files, this method will try to do the tests on all the files.

◆ doTestFromInputFile()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
int LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::doTestFromInputFile ( const char *  datafile)

Reads the parameters of the test in input text file datafile; then does the specified computation.

The format of the data file must be as presented in Usage instructions. This will also print the results of the test in the way specified by the configuration file.

The data file must always have the extension ".dat", but must be given as argument here without extension. For example, if the data file is named myLattice.dat, then the method must be called as doTestFromInputFile("myLattice").

This method returns 0 if the test completed successfully and returns a negative integer if there was an error.

◆ performBasis()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
bool LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::performBasis ( Config< Int, BasIntMat > &  config)
protected

This will perform a basis construction according to the configuration and the basis of config.

◆ performDual()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
bool LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::performDual ( Config< Int, BasIntMat > &  config)
protected

This will perform a dual construction according to the configuration and the basis of config.

config is stored in this object so that the results can be printed with printTestResults().

◆ performMerit()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
bool LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::performMerit ( Config< Int, BasIntMat > &  config)
protected

This will compute a figure of merit according to the configuration and the basis of config.

config is stored in this object so that the results can be printed with printTestResults().

◆ performReduction()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
bool LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::performReduction ( Config< Int, BasIntMat > &  config)
protected

This will perform a lattice reduction according to the configuration and the basis of config.

config is stored in this object so that the results can be printed with printTestResults().

◆ performShortest()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
bool LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::performShortest ( Config< Int, BasIntMat > &  config)
protected

This will solve the shortest vector problem according to the configuration and the basis of config.

config is stored in this object so that the results can be printed with printTestResults().

◆ printTestResults()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
void LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::printTestResults ( const char *  infile)

This prints the result of the last computation that was asked to this object, as well as the configuration used.

Member Data Documentation

◆ m_merit

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
double LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::m_merit
protected

This contains the last figure of merit computed.

This is not erased when a new computation not requiring a figure of merit is done.

◆ m_shortest

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
double LatticeTester::LatticeAnalysis< Int, BasInt, Dbl, RedDbl >::m_shortest
protected

This contains the length of the shortest vector that was last computed.

This is not erased when a new computation not requiring the shortest vector is done.


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