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

This class is a skeleton for the implementation of different types of lattices. More...

#include <latticetester/IntLattice.h>

Inherits LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >.

Inherited by LatticeTester::Rank1Lattice< Int, BasInt, Dbl, RedDbl >.

Public Member Functions

 IntLattice (Int modulo, int k, int maxDim, bool withDual, NormType norm=L2NORM)
 Constructor initializing the primal and the dual basis with the identity matrix. More...
 
 IntLattice (const IntLattice< Int, BasInt, Dbl, RedDbl > &Lat)
 Copy constructor that makes a copy of Lat. More...
 
void copy (const IntLattice< Int, BasInt, Dbl, RedDbl > &lattice)
 Copies lattice into this object. More...
 
virtual ~IntLattice ()
 Destructor. More...
 
void init ()
 Allocates space to vectors used internally. More...
 
int getOrder () const
 This returns the rank of the lattice. More...
 
virtual void incDim ()
 Increments the dimension of the basis and dual basis vectors by one. More...
 
void calcLgVolDual2 (double lgm2)
 Computes the logarithm of the normalization factor (m_lgVolDual2) in all dimensions \(\leq\) MaxDim for the lattice. More...
 
double getLgVolDual2 (int i) const
 Gives the log of m^(2*i) if i < order, else gives the log of m^(2*i) More...
 
void dualize ()
 Exchange the primal basis and the dual basis. More...
 
void fixLatticeNormalization (bool dualF)
 This function is called to fix the normalization constants to get the normalized merit from the shortest distance in the lattice. More...
 
virtual void buildProjection (IntLattice< Int, BasInt, Dbl, RedDbl > *lattice, const Coordinates &proj)
 Builds the basis (and dual basis) of the projection proj for this lattice. More...
 
virtual void buildBasis (int d)
 Builds the basis for the lattice in dimension d. More...
 
LatticeTester::Normalizer< RedDbl > * getNormalizer (NormaType norma, int alpha, bool dualF)
 Creates and returns the normalizer corresponding to criterion norma. More...
 
virtual void setLac (const Lacunary< BasInt > &)
 A utility method to store a vector of indices with lacunary values in subclasses of this one. More...
 
virtual std::string toString () const
 Returns a string describing the lattice. More...
 
- Public Member Functions inherited from LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >
 IntLatticeBasis (const int dim, NormType norm=L2NORM)
 Constructor initializing the primal basis with the identity matrix. More...
 
 IntLatticeBasis (const BasIntMat basis, const int dim, NormType norm=L2NORM)
 Constructor taking all three needed component of an IntLatticeBasis. More...
 
 IntLatticeBasis (const BasIntMat primalbasis, const BasIntMat dualbasis, const Int modulo, const int dim, NormType norm=L2NORM)
 Complete constructor. More...
 
 IntLatticeBasis (const IntLatticeBasis< Int, BasInt, Dbl, RedDbl > &Lat)
 Copy constructor. More...
 
 ~IntLatticeBasis ()
 Destructor. More...
 
void kill ()
 Cleans and releases all the memory allocated to this lattice. More...
 
void copyBasis (const IntLatticeBasis< Int, BasInt, Dbl, RedDbl > &lat)
 Copy the lattice lat, except it's NormType and dimension, into this object. More...
 
void copyBasis (const IntLatticeBasis< Int, BasInt, Dbl, RedDbl > &lat, long n)
 Copy the n first elements of the basis of the lattice lat into this object. More...
 
void initVecNorm ()
 Initializes a vector containing the norms of the basis vectors to -1 at all components. More...
 
BasIntMatgetBasis ()
 Returns the basis represented in a matrix. More...
 
BasIntMatgetDualBasis ()
 Returns the dual basis represented in a matrix. More...
 
int getDim () const
 Returns the dimension of the lattice. More...
 
NormType getNorm () const
 Returns the NormType used by this lattice. More...
 
Dbl getVecNorm (const int &i)
 Returns the norm of the i-th vector of the basis. More...
 
DblVec getVecNorm () const
 Returns the norm of each vector of the basis in a vector. More...
 
Dbl getDualVecNorm (const int &i)
 Returns the norm of the i-th vector of the dual basis. More...
 
DblVec getDualVecNorm () const
 Returns the norm of each vector of the dual basis in a vector. More...
 
Int getModulo () const
 Returns the m used for rescaling if it has been defined. More...
 
void setDim (const int &d)
 Sets the dimension of the basis to d. More...
 
void setNorm (const NormType &norm)
 Sets the NormType used by this lattice to norm. More...
 
void setVecNorm (const Dbl &value, const int &i)
 Sets the norm of the i-th component of the basis to value. More...
 
void setDualVecNorm (const Dbl &value, const int &i)
 Sets the norm of the i-th component of the dual basis to value. More...
 
bool withDual () const
 Returns true if a dual has been defined and false otherwise. More...
 
void setDualFlag (bool flag)
 Sets the withDual flag to flag. More...
 
void setNegativeNorm ()
 Sets all the values in the array containing the norms of the basis vectors to -1. More...
 
void setNegativeNorm (const int &i)
 Sets the value of the i-th component in the array containing the norms of the basis vectors to -1. More...
 
void setDualNegativeNorm ()
 Sets all the values in the array containing the norms of the dual basis vectors to -1. More...
 
void setDualNegativeNorm (const int &i)
 Sets the value of the i-th component in the array containing the norms of the dual basis vectors to -1. More...
 
void updateVecNorm ()
 Updates the array containing the basis vectors norms by recomputing them. More...
 
void updateVecNorm (const int &d)
 Updates the array containing the basis vectors norms from the d-th component to the last by recomputing them. More...
 
void updateDualVecNorm ()
 Updates the array containing the dual basis vectors norms by recomputing them. More...
 
void updateDualVecNorm (const int &d)
 Updates the array containing the dual basis vectors norms from the d-th component to the last by recomputing them. More...
 
void updateScalL2Norm (const int i)
 Updates the i-th value of the array containing the norms of the basis vectors by recomputing it using the L2NORM. More...
 
void updateScalL2Norm (const int k1, const int k2)
 Updates the k1-th to the k2-1-th values of the array containing the norms of the basis vectors by recomputing them using the L2NORM. More...
 
void updateDualScalL2Norm (const int i)
 Updates the i-th value of the array containing the norms of the dual basis vectors by recomputing it using the L2NORM. More...
 
void updateDualScalL2Norm (const int k1, const int k2)
 Updates the k1-th to the k2-1-th values of the array containing the norms of the dual basis vectors by recomputing them using the L2NORM. More...
 
void permute (int i, int j)
 Exchanges vectors i and j in the basis. More...
 
void permuteNoDual (int i, int j)
 Exchanges vectors i and j in the basis without changing the dual. More...
 
bool checkDuality ()
 Returns true if the dual basis contained in the object really is the dual of the basis, and false otherwise. More...
 
void sort (int d)
 Sorts the basis vectors with indices greater of equal to \(d\) by increasing length. More...
 
void sortNoDual (int d)
 Sorts the basis vectors with indices greater of equal to \(d\) by increasing length. More...
 
std::string toStringBasis () const
 Returns a string with the primal basis and its norms. More...
 
std::string toStringDualBasis () const
 Returns a string with the dual basis and its norms. More...
 
void write () const
 Writes the lattice and its parameters on standard output. More...
 

Protected Member Functions

virtual void kill ()
 Cleans and releases all the memory allocated to this lattice. More...
 

Protected Attributes

int m_order
 The order of the basis. More...
 
double * m_lgVolDual2
 Represente sur dual along the diagonal?? ERWAN. More...
 
double m_lgm2
 The logarithm \(\log (m^2)\). More...
 
BasIntMat m_wSI
 The dual basis of the current projection. More...
 
BasIntMat m_vSI
 The primal basis of the current projection. More...
 
Int m_t1
 Working Variables used in MRGLattice.h. More...
 
- Protected Attributes inherited from LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >
BasIntMat m_basis
 Each row of this matrix represents a vector in the basis of the lattice. More...
 
BasIntMat m_dualbasis
 Each row of this matrix represents a vector in the dual basis of the lattice. More...
 
int m_dim
 The dimension of the lattice. More...
 
NormType m_norm
 The NormType used in the reduction and for this lattice. More...
 
DblVec m_vecNorm
 The norm of each vector in the basis. More...
 
DblVec m_dualvecNorm
 The norm of each vector in the dual basis. More...
 
BasInt m_modulo
 The m used for rescaling the lattice. More...
 
bool m_withDual
 If m_withDual is true a dual basis has been specified, otherwise it is false. More...
 

Detailed Description

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

This class is a skeleton for the implementation of different types of lattices.

This class is not really intended to be used directly, hence the lack of constructor allowing the specification of a basis.

This class can store a lattice with or without dual and contains a few virtual methods to perform common computations on lattices. This class contains a method to compute lattices of projections of \(\{x_i\}_{ 0 \leq i}\), a method to exchange the basis and the dual basis, and a virtual method that can be implemented in subclasses to recompute the basis for different dimensions.

A lattice of rank \(k\) with integer vectors modulo \(m\) contains \(m^k\) distinct vectors. This number, the density, can then be used to compute bounds on the spectral test. This class implements methods to compute \( \log_2(m^{2i}) \) for \( 1 \leq i \leq k \) to help with the computation of such bounds.

Constructor & Destructor Documentation

◆ IntLattice() [1/2]

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::IntLattice ( Int  modulo,
int  k,
int  maxDim,
bool  withDual,
NormType  norm = L2NORM 
)

Constructor initializing the primal and the dual basis with the identity matrix.

The dimension of the lattice is set to maxDim and the norm used for reduction to norm.

Parameters
moduloThe modulo of the integer coordinates
kThe rank of the lattice to be constructed
maxDimThe maximal dimension for which this lattice can be expanded/tested (?)
withDualSpecifies wether this object contains a dual or not
normThe norm to use in for reduction

◆ IntLattice() [2/2]

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::IntLattice ( const IntLattice< Int, BasInt, Dbl, RedDbl > &  Lat)

Copy constructor that makes a copy of Lat.

The maximal dimension of the created basis is set equal to Lat’s current dimension.

◆ ~IntLattice()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::~IntLattice ( )
virtual

Destructor.

Member Function Documentation

◆ buildBasis()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
void LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::buildBasis ( int  d)
virtual

Builds the basis for the lattice in dimension d.

This function is not implemented for this class. The general basis construction for a lattice such as this one is located in BasisConstruction.

◆ buildProjection()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
void LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::buildProjection ( IntLattice< Int, BasInt, Dbl, RedDbl > *  lattice,
const Coordinates proj 
)
virtual

Builds the basis (and dual basis) of the projection proj for this lattice.

The result is placed in the lattice lattice. The basis is triangularized to form a proper basis.

◆ calcLgVolDual2()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
void LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::calcLgVolDual2 ( double  lgm2)

Computes the logarithm of the normalization factor (m_lgVolDual2) in all dimensions \(\leq\) MaxDim for the lattice.

lgm2 is the logarithm in base 2 of \(m^2\).

◆ copy()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
void LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::copy ( const IntLattice< Int, BasInt, Dbl, RedDbl > &  lattice)

Copies lattice into this object.

This should be equivalent to the creation of a new IntLattice using the copy constructor with lattice as an argument.

◆ dualize()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
void LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::dualize ( )

Exchange the primal basis and the dual basis.

◆ fixLatticeNormalization()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
void LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::fixLatticeNormalization ( bool  dualF)

This function is called to fix the normalization constants to get the normalized merit from the shortest distance in the lattice.

If dualF is true, the normalization constant is reset for the dual lattice, otherwise it is reset for the primal lattice.

◆ getLgVolDual2()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
double LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::getLgVolDual2 ( int  i) const
inline

Gives the log of m^(2*i) if i < order, else gives the log of m^(2*i)

◆ getNormalizer()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
Normalizer< RedDbl > * LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::getNormalizer ( NormaType  norma,
int  alpha,
bool  dualF 
)

Creates and returns the normalizer corresponding to criterion norma.

In the case of the \(P_{\alpha}\) test, the argument alpha = \(\alpha\). In all other cases, it is unused.

◆ getOrder()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
int LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::getOrder ( ) const
inline

This returns the rank of the lattice.

◆ incDim()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
void LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::incDim ( )
virtual

Increments the dimension of the basis and dual basis vectors by one.

This initializes the added components to 0 and does not compute the value taken by the added components and vector. It also resets vectors containing the norms. The implementation in this class is meant to be overriden by subclasses and probably should not be used.

Reimplemented in LatticeTester::Rank1Lattice< Int, BasInt, Dbl, RedDbl >.

◆ init()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
void LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::init ( )

Allocates space to vectors used internally.

This should probably be private or protected because it should not be needed to call it directly (the constructors and copy already call it).

◆ kill()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
void LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::kill ( )
protectedvirtual

Cleans and releases all the memory allocated to this lattice.

◆ setLac()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
virtual void LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::setLac ( const Lacunary< BasInt > &  )
inlinevirtual

A utility method to store a vector of indices with lacunary values in subclasses of this one.

This method has no implementation in this base class.

◆ toString()

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
std::string LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::toString ( ) const
virtual

Returns a string describing the lattice.

Member Data Documentation

◆ m_lgm2

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
double LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::m_lgm2
protected

The logarithm \(\log (m^2)\).

◆ m_lgVolDual2

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
double* LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::m_lgVolDual2
protected

Represente sur dual along the diagonal?? ERWAN.

◆ m_order

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
int LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::m_order
protected

The order of the basis.

◆ m_t1

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
Int LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::m_t1
protected

Working Variables used in MRGLattice.h.

◆ m_vSI

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
BasIntMat LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::m_vSI
protected

The primal basis of the current projection.

◆ m_wSI

template<typename Int , typename BasInt , typename Dbl , typename RedDbl >
BasIntMat LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::m_wSI
protected

The dual basis of the current projection.


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