Lattice Tester Guide  1.0-9
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
Usage instructions
Todo:
Reread this

Compiling the Library

Software Dependencies

If you intend on building LatticeTester from scratch, the following software will need to be installed on the system:

  • NTL 10.4.0 or later
  • GMP compatible version with your NTL installation
  • Python (Needed by waf to build the program)
  • Git (optional for downloading the source code)
  • Doxygen (optional for generating the documentation)

You will also need a compiler compliant with the C++14 standard.

Acquiring/Building/Installing the program

This section won't go in depth and explain all the particularities of the build process. If you are a developper and wish to participate to this project, please look at the README for more details about the build system.

The prefered way of getting this software is by downloading it on github (either via git clone or with a .zip) and to compile it yourself (for now). The build process uses the waf metabuild system that greatly streamlines the process.

To build the project, you simply need to be in the root folder of LatticeTester and call:

./waf configure build install

or, on Windows,

python waf configure build install

If the build process fails, the README might offer you some insight as to what went wrong. Note that for the installation process to work, you will need the have administrative rights on the installation folder.

The previous command will fetch the environment variables specific to your system to prepare the compilation, compile the program in a local folder and place the binaries and header files in a default location depending on your OS. Depending on your installation path, you might need to specify a path to you compilier when using the LatticeTester library. After that, the library will be available under the lib folder in the installation path and the executable program under the bin folder as LatticeTester(.exe on Windows).

Types and representations

LatticeTester uses NTL's types and implementations of a few algorithms. If you ever happen to browse the code of LatticeTester, you will notice that many of the classes use templates. This is because the library is compiled to work on a variety of types with the same code. These types provide a variable precision in the representation of both integer numbers and floating point numbers.

It is possible to use integers represented as both ‘std::int64_t’ (integers of exactly 64 bits) and NTL::ZZ (NTL implementation of exact arbitrary length integers) and floating points as double and NTL::RR (NTL implementation of arbitrary precision floating point numbers). Obviously, standard types provide better performance, but can lead to errors in a few algorithms.

When using the library, you will have to consider which types you will want to use to represent numbers. While it is quite safe to assume floating point arithmetic should not cause problems and that doubles should be fine, this is not true for integers. This is because the computations performed on lattices basis need to be done exactly on integers. Using arbitrary precision integers is necessary when working with matrix entries that can get close to \(2^{63}\). This is the case, for example, in LatMRG when working with generators with modulus close to \(2^{64}\).

Using the executable

LatticeTester is built in order to analyse a Lattice based on a set of vectors called basis therefore it provides an executable that can be used directly to do so at a small scale. This executable is a small program that can read data from a file to perform tests as specified by the user. Through this program, all the problems LatticeTester aims at solving can be addressed, as well as the computation of figures of merit. Although, concerns for the efficiency of object instanciation when using LatticeTester are not needed (since it should not take a large proportion of the execution time), it is recommended that, if you want to perform tests or algorithms on numerous lattices, you make a C++ program using the library instead of sending multiple files to the executable.

Once the program is compiled, to use it, you simply have to call it from a command line with a filename argument. That file name must have a .dat extension that should not be included when calling the program like

./TestLattice <LLDD,ZZDD,ZZRR> filename

in a POSIX shell. You can specify a directory relative to your current working directory for either of the program and the executable. LLDD, ZZDD and ZZRR are integer type specifiers. For more information on the type usage, please look into Types. For most use cases, ZZDD should do the trick, or will be needed since a few functions only need with ZZ integers.

The file must contain, in order:

  • A test or computation to be performed
  • Parameters for that test/computation
  • A matrix that generates or is a basis of that lattice to work on. Each line of this matrix must be a vector of the lattice.

The file format depends on the work you ask from LatticeTester. There is an example available for each case in the folder inputTestFiles in the repository. There are 5 computations possible when calling LatticeTester. In what follows, we present them and explain what each parameter is. Parameters are written in the format parameter <option1, option2, ...> if you need to choose from multiple options or in the format parameter [type] if it is a basic type. When writing a parameter, you just have to write the choosen option and not the parameter name.

Basis Construction

This is the simplest case, where the file looks like this.

BASIS
Method <LLL, GCD>
Output <RES, TERM>
NumRows [int] NumCols [int]
Matrix [NumRows*NumCols int type array]
  • BASIS is the first line indicating the computation to be done. In that case, it means basis construction.
  • Method is the construction method.
    • LLL performs LLL reduction and removes dependent vectors as the basis is constructed. This is the recommanded method.
    • GCD transforms the matrix in a triangular one while removing unwanted vectors. This method can be unstable on large matrices.
  • Output is the output wanted.
    • RES means results file. The results will be printed in a file with the same name as the input file with a .res extension.
    • TERM means terminal. The results will be printed on the command line
  • NumRows and NumCols are integers representing the dimensions of the input matrix
  • Matrix is a NumRows \(\times\)NumCols matrix where each line represents a vector of the lattice. This matrix does not need to be non-singular or have full rank.

Dual Construction

In that case, the file will look like this :

DUAL
Output <RES, TERM>
Dim [int]
Matrix [Dim*Dim int type array]
  • DUAL is the first line indicating the computation to be done. In that case, it means dual construction.
  • Output is the output wanted.
    • RES means results file. The results will be printed in a file with the same name as the input file with a .res extension.
    • TERM means terminal. The results will be printed on the command line
  • Dim is the dimension of the input matrix. To build the dual, this matrix has to be square.
  • Matrix is a Dim \(\times\)Dim matrix where each line represents a vector of the lattice. This matrix must be invertible.

Lattice Reduction

In that case, the file will look like this :

REDUCTION
Method <Dieter, LLL, BKZ>
Output <RES, TERM>
Dim [int]
Matrix [Dim*Dim int type array]
  • REDUCTION is the first line indicating the computation to be done. In that case, it means lattice reduction.
  • Method is the method of lattice reduction to use. All the reductions will be performed with the default parameters. If the results are not conclusive because of that, it will be needed to write a short program to change them. For more detail than below on the methods look at the Reducer class.
    • DIETER is the pairwise reduction proposed by Dieter. It is the least strong reduction.
    • LLL is the classic Lenstra-Lenstra-Lovasz reduction. It is fast and efficient. It is a good starting point for most applications needing reduction
    • BKZ is the block Korkine-Zolotarev reduction. It is a bit stronger than LLL reduction but more costly. It is recommended on applications for which the reduction is critical.
  • Output is the output wanted.
    • RES means results file. The results will be printed in a file with the same name as the input file with a .res extension.
    • TERM means terminal. The results will be printed on the command line
  • Dim is the dimension of the input matrix. In theory, it is not necessary that this matrix be square, but LatticeTester will not reduce a non-square matrix.
  • Matrix is a Dim \(\times\)Dim matrix where each line represents a vector of the lattice. This matrix must be invertible.

Shortest Vector Research

In that case, the file will look like this :

SHORTEST
Reduction [bool] Type <Dieter, LLL, BKZ>
Output <RES, TERM>
Dim [int]
Matrix [Dim*Dim int type array]
  • SHORTEST is the first line indicating the computation to be done. In that case, it means finding the shortest vector
  • Reduction allows the user to perform a lattice basis reduction prior to the shortest vector research. It is recommended that this flag be set to true.
  • Type is the type of reduction to use if Reduction is set to true. This field is not needed if Reduction is false. Look at Lattice Reduction for more details.
  • Error is a factor indicating the tolerance for error. If error is set to \(\alpha\), the shortest vector returned by this algorithm will have a length that is at most \(1 + \alpha\) times the length of the true shortest vector. This can be set to 0 to obtain the true shortest vector. If this is non-zero, the program will be slower because of the checks that will occur.
  • Output is the output wanted.
    • RES means results file. The results will be printed in a file with the same name as the input file with a .res extension.
    • TERM means terminal. The results will be printed on the command line
  • Dim is the dimension of the input matrix. In theory, it is not necessary that this matrix be square, but LatticeTester will not accept a non-square matrix for this problem.
  • Matrix is a Dim \(\times\)Dim matrix where each line represents a vector of the lattice. This matrix must be invertible.

Figure of Merit Computation

In that case, the file will look like this :

MERIT
Figure <SPECTRAL, BEYER>
Normalizer <NONE, BESTBOUND, BESTLAT, LAMINATED, MINK>
Reduction [bool] Type <Dieter, LLL, BKZ>
Output <RES, TERM>
Dim [int]
Matrix [Dim*Dim int type array]
  • MERIT is the first line indicating the computation to be done. In that case, it means computing a figure of merit.
  • Figure is the figure of merit to compute.
    • SPECTRAL stands for spectral test. This will compute the shortest vector in the lattice and return a normalized value depending on its length.
    • BEYER stands for Beyer quotient. This will find a Minkowski reduced basis and compute the ratio between the longest and the shortest vector in this basis.
  • Normalizer is an option to allow the normalization of the figure of merit so that it can be compared with the value from other lattices.
    • NONE no normalization is done. This will return the length of the shortest vector for the spectral test. This is what should be used for the Beyer quotient.
    • BESTBOUND is the best upper bound for the length of the shortest vector in a lattice based on what is in the litterature.
    • BESTLAT is an "upper" bound on the length of the shortest vector in a lattice based on the densest lattice known. This is the recommended option.
    • LAMINATED is an upper bound on the length of the shortest vector in a lattice based on the densest laminated lattice known.
    • MINK is Minkowski's LOWER bound on the shortest vector in a lattice.
  • Reduction allows the user to perform a lattice basis reduction prior to other computations. It is recommended that this flag be set to true.
  • Type is the type of reduction to use if Reduction is set to true. This field is not needed if Reduction is false. Look at Lattice Reduction for more details.
  • Output is the output wanted.
    • RES means results file. The results will be printed in a file with the same name as the input file with a .res extension.
    • TERM means terminal. The results will be printed on the command line
  • Dim is the dimension of the input matrix. In theory, it is not necessary that this matrix be square, but LatticeTester will not reduce a non-square matrix.
  • Matrix is a Dim \(\times\)Dim matrix where each line represents a vector of the lattice. This matrix must be invertible.