Lattice Tester Online Documentation 0.1.0-861
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
Loading...
Searching...
No Matches
LatticeTester::IntLatticeExt< Int, Real > Class Template Reference

This abstract class extends IntLattice and is a skeleton for the specialized subclasses that define specific types of lattices. More...

#include <latticetester/IntLatticeExt.h>

+ Inheritance diagram for LatticeTester::IntLatticeExt< Int, Real >:

Public Member Functions

 IntLatticeExt (Int m, int64_t maxDim, NormType norm=L2NORM)
 A constructor that initializes the primal and dual bases with the identity matrix.
 
 IntLatticeExt (const IntLatticeExt< Int, Real > &lat)
 Copy constructor that makes a copy of lat.
 
void copy (const IntLatticeExt< Int, Real > &lat)
 Makes a copy of lattice into this object.
 
virtual ~IntLatticeExt ()
 Destructor.
 
virtual void buildBasis (int64_t dim)
 This returns the rank (order) of the lattice.
 
virtual void buildDualBasis (int64_t dim)
 Similar to buildBasis, but builds only the m-dual basis, in dim dimensions.
 
virtual void incDimBasis ()
 Increments the dimension dim of the basis by one.
 
virtual void incDimDualBasis ()
 Similar to incDimBasis.
 
virtual std::string toString () const
 Returns a string describing this lattice.
 
- Public Member Functions inherited from LatticeTester::IntLattice< Int, Real >
 IntLattice (const Int m, const int64_t maxDim, NormType norm=L2NORM)
 Constructs a lattice whose basis is the identity, in maxDim dimensions, with the specified norm type, and the scaling factor m.
 
 IntLattice (const IntMat basis, const Int m, const int64_t maxDim, NormType norm=L2NORM)
 Similar to the previous constructor, except that the primal basis is given in basis, which must be an IntMat object of size maxDim by maxDim.
 
 IntLattice (const IntMat primalbasis, const IntMat dualbasis, const Int m, const int64_t maxDim, NormType norm=L2NORM)
 Constructs a lattice with the given basis and given m-dual basis for the given m, in maxDim dimensions, and with the specified norm type.
 
 IntLattice (const IntLattice< Int, Real > &lat)
 Copy constructor.
 
virtual ~IntLattice ()
 Destructor.
 
void copyLattice (const IntLattice< Int, Real > &lat)
 Makes a deep copy of the lattice lat into this (existing) object.
 
void overwriteLattice (const IntLattice< Int, Real > &lat, long dim, long dimdual)
 
virtual void buildProjectionLLL (IntLattice< Int, Real > &projLattice, const Coordinates &proj, double delta=0.5)
 Constructs a set of generating vectors for the projection of the present lattice, over the set of coordinates determined by proj, and builds a basis for that projection using an LLL procedure from BasisConstruction.
 
virtual void buildProjection (IntLattice< Int, Real > &projLattice, const Coordinates &proj)
 Builds a basis for the projection of the present lattice over the set of coordinates determined by proj.
 
virtual void buildProjectionDual (IntLattice< Int, Real > &projLattice, const Coordinates &proj)
 Similar to buildProjection, except that it builds an upper-triangular basis for the primal and a lower-triangular basis for the $m$-dual of the projection, both in projLattice.
 
IntMatgetBasis ()
 Returns the IntMat object that contains the basis of this lattice.
 
void setBasis (const IntMat basis, const Int m, const int64_t dim, NormType norm=L2NORM)
 Changes the basis to 'basis', the modulus to 'm', and the current dimension to 'dim'.
 
void setBasis (const IntMat basis, const int64_t dim)
 Changes only the 'basis' and the current dimension to 'dim'.
 
IntMatgetDualBasis ()
 Returns the m-dual basis represented in a matrix.
 
int64_t getMaxDim () const
 Returns the maximal dimension for this lattice.
 
int64_t getDim () const
 Returns the current dimension of the primal lattice, which is the dimension of the basis vectors, and also usually the number of independent vectors in the basis.
 
int64_t getDimDual () const
 Returns the current dimension of the m-dual lattice.
 
NormType getNormType () const
 Returns the NormType used by this lattice.
 
Real getVecNorm (const int64_t &i)
 Returns the norm (squared in case of the L^2 norm) of the i-th vector of the basis, with the index i starting at 0.
 
RealVec getVecNorm () const
 Returns the norm (squared in case of the L^2 norm) of each basis vector, in a vector.
 
Real getDualVecNorm (const int64_t &i)
 Returns the norm (squared in case of the L^2 norm) of the i-th vector of the m-dual basis.
 
RealVec getDualVecNorm () const
 Returns the norm (squared in case of the L^2 norm) of each vector of the m-dual basis, in a vector.
 
Int getModulus () const
 Returns the scaling factor m.
 
void setDim (const int64_t dim)
 Sets the dimension of the primal basis to dim.
 
void setDimDual (const int64_t dim)
 Sets the dimension of the primal basis to dim.
 
void setNormType (const NormType &norm)
 Sets the NormType used by this lattice to norm.
 
void setVecNorm (const Real &value, const int64_t &i)
 Sets the norm of the i-th component of the basis to value, which is assumed to be the correct value.
 
void setDualVecNorm (const Real &value, const int64_t &i)
 Sets the norm of the i-th component of the m-dual basis to value, which is assumed to be the correct value.
 
void setNegativeNorm ()
 Sets to -1 the first dim values in the array containing the norms of the basis vectors, where dim is the current dimension of the lattice.
 
void setNegativeNorm (const int64_t &i)
 Sets the value of the i-th component in the array containing the norms of the basis vectors to -1.
 
void setDualNegativeNorm ()
 Sets all the values in the array containing the norms of the dual basis vectors to -1, to indicate that these norms are no longer up to date.
 
void setDualNegativeNorm (const int64_t &i)
 Sets the value of the i-th component in the array containing the norms of the m-dual basis vectors to -1.
 
void updateVecNorm ()
 Updates the array containing the norms of the basis vectors by recomputing them.
 
void updateVecNorm (const int64_t &d)
 Updates the array containing the norm of the basis vectors from the d-th component to the last, by recomputing them.
 
void updateSingleVecNorm (const int64_t &d, const int64_t &c)
 Updates the 'd'-th entry of the array containing the basis vectors norms.
 
void updateDualVecNorm ()
 Updates the array containing the m-dual basis vectors norms by recomputing them.
 
void updateSingleDualVecNorm (const int64_t &d, const int64_t &c)
 Updates the 'd'-th entry of the array containing the m-dual basis vectors norms.
 
void updateDualVecNorm (const int64_t &d)
 Updates the array containing the m-dual basis vectors norms from the d-th component to the last by recomputing them.
 
void updateDualVecNorm (const int64_t &d, const int64_t &c)
 Updates the array containing the m-dual basis vectors norms from the d-th component to the last by recomputing them.
 
void updateScalL2Norm (const int64_t i)
 Updates the i-th value of the array containing the square norms of the basis vectors by recomputing it using the L2NORM.
 
void updateScalL2Norm (const int64_t k1, const int64_t k2)
 Updates the k1-th to the k2-1-th values of the array containing the square norms of the basis vectors by recomputing them using the L2NORM.
 
void updateDualScalL2Norm (const int64_t i)
 Updates the i-th value of the array containing the square norms of the m-dual basis vectors by recomputing it using the L2NORM.
 
void updateDualScalL2Norm (const int64_t k1, const int64_t k2)
 Updates the k1-th to the k2-1-th values of the array containing the square norms of the m-dual basis vectors by recomputing them using the L2NORM.
 
void permute (int64_t i, int64_t j)
 Exchanges vectors i and j in the basis.
 
void permuteDual (int64_t i, int64_t j)
 Exchanges vectors i and j in the m-dual basis without changing the primal.
 
void dualize ()
 Exchanges the primal and m-dual bases, their dimensions, and vector norms.
 
bool checkDuality ()
 Returns true iff the m-dual basis contained in the object really is the m-dual of the current primal basis.
 
void sortBasis (int64_t d)
 Sorts the primal basis vectors with indices greater of equal to d by increasing length.
 
void sortDualBasis (int64_t d)
 Sorts the m-dual basis vectors with indices greater of equal to d by increasing length.
 
std::string toStringBasis () const
 Returns a string that contains the primal basis vectors and their norms.
 
std::string toStringDualBasis () const
 Returns a string with the m-dual basis vectors and their norms.
 
std::string toString () const
 Returns a string that represents this lattice and its parameters.
 
void write () const
 Writes on standard output the string returned by toString.
 

Protected Member Functions

virtual void kill ()
 

Additional Inherited Members

- Protected Attributes inherited from LatticeTester::IntLattice< Int, Real >
Int m_modulo
 The scaling factor m used for rescaling the lattice.
 
int64_t m_maxDim
 The maximal dimension for this lattice.
 
int64_t m_dim
 The current dimension of the primal basis, which is the number of (independent) vectors in it.
 
int64_t m_dimdual
 The current dimension of the m-dual basis, which is the number of (independent) vectors in its basis.
 
IntMat m_basis
 The rows of the m_dim x m_dim upper left corner of this matrix are the primal basis vectors.
 
IntMat m_dualbasis
 The rows of the m_dim x m_dim upper left corner this matrix are the m-dual basis vectors.
 
NormType m_norm
 The NormType used to measure the vector lengths for this lattice.
 
RealVec m_vecNorm
 A vector that stores the norm of each basis vector.
 
RealVec m_dualvecNorm
 Similar to vecNorm, but for the m-dual basis.
 

Detailed Description

template<typename Int, typename Real>
class LatticeTester::IntLatticeExt< Int, Real >

This abstract class extends IntLattice and is a skeleton for the specialized subclasses that define specific types of lattices.

It is not intended to be used directly, but only via subclasses. An IntLatticeExt object is an IntLattice with additional (virtual) methods that must be implemented in subclasses.

There are virtual methods to construct a basis and/or an m-dual basis of the full lattice and to extend the current basis and/or its m-dual by one coordinate. These methods must be implemented in the subclasses. The IntLattice base class already implements methods to construct a basis and/or an m-dual basis for the projection of the full lattice on a subset of coordinates indices specified by a Coordinates object. These general default implementation can often be overridden by faster specialized implementations in the subclasses.

Recall that the lattices in IntLattice (and here) have dim < maxDim dimensions and the bases are stored in IntMat objects of dimensions maxDim x maxDim.

Constructor & Destructor Documentation

◆ IntLatticeExt() [1/2]

template<typename Int , typename Real >
LatticeTester::IntLatticeExt< Int, Real >::IntLatticeExt ( Int m,
int64_t maxDim,
NormType norm = L2NORM )

A constructor that initializes the primal and dual bases with the identity matrix.

The dimension of the lattice is set to maxDim and the norm type is set to norm.

Parameters
mThe scaling factor m for the integer coordinates
maxDimThe maximal dimension for which this lattice can be expanded/tested
withDualSpecifies whether this object contains a dual or not
normThe norm type to measure the vector lengths.

◆ IntLatticeExt() [2/2]

template<typename Int , typename Real >
LatticeTester::IntLatticeExt< Int, Real >::IntLatticeExt ( const IntLatticeExt< Int, Real > & lat)

Copy constructor that makes a copy of lat.

The maximal dimension of the created basis is set equal to the current maximal dimension in lat.

◆ ~IntLatticeExt()

template<typename Int , typename Real >
LatticeTester::IntLatticeExt< Int, Real >::~IntLatticeExt ( )
virtual

Destructor.

Depends on the specific subclass.

Member Function Documentation

◆ buildBasis()

template<typename Int , typename Real >
virtual void LatticeTester::IntLatticeExt< Int, Real >::buildBasis ( int64_t dim)
inlinevirtual

This returns the rank (order) of the lattice.

Needed? This virtual method builds a basis for the lattice in dim dimensions, and store it in the upper-left part of the internal m_basis variable, which is assumed to be an IntMat object of dimensions maxDim x maxDim. The parameter dim must not exceed maxDim. If withDual is true, it also builds an m-dual basis.

Reimplemented in LatticeTester::MRGLattice< Int, Real >, and LatticeTester::Rank1Lattice< Int, Real >.

◆ buildDualBasis()

template<typename Int , typename Real >
virtual void LatticeTester::IntLatticeExt< Int, Real >::buildDualBasis ( int64_t dim)
inlinevirtual

Similar to buildBasis, but builds only the m-dual basis, in dim dimensions.

This dim must not exceed maxDim. The flag withDual is assumed to be true.

Reimplemented in LatticeTester::MRGLattice< Int, Real >, and LatticeTester::Rank1Lattice< Int, Real >.

◆ copy()

template<typename Int , typename Real >
void LatticeTester::IntLatticeExt< Int, Real >::copy ( const IntLatticeExt< Int, Real > & lat)

Makes a copy of lattice into this object.

It copies the internal vectors and matrices using the NTL assign operator = (see https://libntl.org/doc/matrix.cpp.html).

◆ incDimBasis()

template<typename Int , typename Real >
virtual void LatticeTester::IntLatticeExt< Int, Real >::incDimBasis ( )
inlinevirtual

Increments the dimension dim of the basis by one.

One coordinate is added to each basis vector and one new basis vector is added as well. Usually, the other coordinates are left unchanged. If withDual is true, then the dimension of the m-dual is also increased by 1.

Reimplemented in LatticeTester::MRGLattice< Int, Real >, and LatticeTester::Rank1Lattice< Int, Real >.

◆ incDimDualBasis()

template<typename Int , typename Real >
virtual void LatticeTester::IntLatticeExt< Int, Real >::incDimDualBasis ( )
inlinevirtual

Similar to incDimBasis.

Increments the dimension dim by 1, but only for the dual basis.

Reimplemented in LatticeTester::MRGLattice< Int, Real >, and LatticeTester::Rank1Lattice< Int, Real >.

◆ kill()

template<typename Int , typename Real >
void LatticeTester::IntLatticeExt< Int, Real >::kill ( )
protectedvirtual

** USEFUL ? **

◆ toString()

template<typename Int , typename Real >
virtual std::string LatticeTester::IntLatticeExt< Int, Real >::toString ( ) const
inlinevirtual

Returns a string describing this lattice.


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