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

This subclass of IntLatticeExt defines a general rank-1 lattice rule in \(t\) dimensions, whose \(m\) points are \( \mathbf{u}_i = (i \mathbf{a} \bmod m)/m \) for \(i = 0,\dots,m-1\), where \(\mathbf{a} = (a_1,a_2,\dots,a_t) \in \mathbb{Z}_m^t\) is the generating vector, \(a_1 = 1\), and \(\gcd(a_j, m) = 1\) for \(j =2, \dots,t\). More...

Inheritance diagram for LatticeTester::Rank1Lattice< Int, Real >:

Public Member Functions

 Rank1Lattice (const Int &m, const IntVec &aa, int64_t maxDim, NormType norm=L2NORM)
 This constructor takes as input the modulus m, the generating vector \(\mathbf{a} = \)aa, and the norm used to measure the vector lengths.
 Rank1Lattice (const Int &m, const IntVec &aa, NormType norm=L2NORM)
 In this version, the maximal dimension maxDim is set to the length of the vector aa.
 Rank1Lattice (const Int &m, const Int &a, int64_t maxDim, int64_t dimaa, NormType norm=L2NORM)
 Constructor for the special case of a Korobov lattice.
 Rank1Lattice (const Int &m, int64_t maxDim, int64_t dimaa, NormType norm=L2NORM)
 This version assumes that dimaa = maxDim.
 Rank1Lattice (const Int &m, int64_t maxDim, NormType norm=L2NORM)
 This version assumes that dimaa = maxDim.
 ~Rank1Lattice ()
 Destructor.
void setaa (const IntVec &aa)
 Sets the generating vector to aa.
void seta (const Int &a, int64_t dimaa)
 Sets this lattice to a Korobov lattice with multiplier a and sets the length of the generating vector to dimaa.
void seta (const Int &a)
 Sets this lattice to a Korobov lattice with multiplier a.
IntVec getaa ()
 Returns the generating vector aa.
void buildBasis (int64_t dim)
 Builds an upper-triangular primal basis in dim dimensions.
void buildDualBasis (int64_t dim)
 Builds a lower-triangular m-dual basis (and not the primal) directly in dim dimensions.
void incDimBasis ()
 Increases the current dimension of the primal basis by 1 and updates the basis.
void incDimDualBasis ()
 Increases the current dimension of only the m-dual basis by 1.
void buildProjection (IntLattice< Int, Real > &projLattice, const Coordinates &coordSet) override
 Builds a basis for the projection of this Rank1Lattice onto the coordinates in coordSet and puts it as the m_basis in projLattice.
void buildProjectionDual (IntLattice< Int, Real > &projLattice, const Coordinates &coordSet) override
 Similar to buildProjection, but builds a basis for the m-dual of the projection.
std::string toStringCoef () const
 Returns the first dim components of the generating vector \(\mathbf{a}\) as a string, where dim is the current lattice basis dimension.
Public Member Functions inherited from LatticeTester::IntLatticeExt< Int, Real >
 IntLatticeExt (int64_t maxDim, NormType norm=L2NORM)
 A constructor that reserves the space for the primal and m-dual bases and vector lengths, but does not initialize them.
 IntLatticeExt (Int m, int64_t maxDim, NormType norm=L2NORM)
virtual ~IntLatticeExt ()
 Destructor.
Public Member Functions inherited from LatticeTester::IntLattice< Int, Real >
 IntLattice (const int64_t maxDim, NormType norm=L2NORM)
 Constructs an IntLattice object that can hold a basis in up to maxDim dimensions, with the specified norm type.
 IntLattice (const Int m, const int64_t maxDim, NormType norm=L2NORM)
 Constructs a lattice whose basis is uninitialized, in maxDim dimensions, with the scaling factor m and specified norm type.
 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.
virtual ~IntLattice ()
 Destructor.
void setModulus (const Int m)
 Sets the scaling factor m.
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'.
void setDualBasis (const IntMat dualbasis, const int64_t dimdual)
 Changes only the dual basis to dualbasis and its current dimension to 'dimdual'.
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 m-dual 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.
Int getModulus () const
 Returns the scaling factor m.
int64_t getMaxDim () const
 Returns the maximal dimension for this lattice.
IntMatgetBasis ()
 Returns the IntMat object that contains the basis of this lattice.
IntMatgetDualBasis ()
 Returns the m-dual basis represented in a matrix.
int64_t getDim () const
 Returns the current dimension of the primal lattice, which should be the dimension of the basis vectors and also 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.
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 references to the primal and m-dual bases, the references to their vectors of norms, and their dimensions.
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.
virtual void buildProjectionLLL (IntLattice< Int, Real > &projLattice, const Coordinates &coordSet, double delta=0.5)
 Constructs a set of generating vectors for the projection of the present lattice, over the set of coordinates determined by coordSet, and builds a basis for that projection using an LLL procedure from BasisConstruction.
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.

Protected Attributes

IntVec m_aa
 Vector of multipliers (generating vector) of the rank 1 lattice rule.
int64_t m_dimaa
 Maximal (and current) dimension of the vector of coefficients m_aa.
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.

Additional Inherited Members

Protected Member Functions inherited from LatticeTester::IntLatticeExt< Int, Real >
virtual void kill ()

Detailed Description

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

This subclass of IntLatticeExt defines a general rank-1 lattice rule in \(t\) dimensions, whose \(m\) points are \( \mathbf{u}_i = (i \mathbf{a} \bmod m)/m \) for \(i = 0,\dots,m-1\), where \(\mathbf{a} = (a_1,a_2,\dots,a_t) \in \mathbb{Z}_m^t\) is the generating vector, \(a_1 = 1\), and \(\gcd(a_j, m) = 1\) for \(j =2, \dots,t\).

The lattice is rescaled simply by removing the division by \(m\). A simple upper-triangular basis for the rescaled lattice is given by \(\mathbf{v}_1 = \mathbf{a},\ \mathbf{v}_2 = m \mathbf{e}_2, \dots, \mathbf{v}_t = m \mathbf{e}_t \), where \(\mathbf{e}_j\) is the \(j^\text{th}\) unit vector. The above conditions ensure that each lower-dimensional projection of \(\Lambda_t \cap [0,m)^t\) contains exactly \(m\) distinct points. Under these conditions, it is also straightforward to construct a basis for any projection of \(\Lambda_t\) and for its \(m\)-dual, as explained in Section 5.4 of the guide. We exploit these properties. The functions buildBasis and incDimBasis always build and update only the rescaled primal basis. To build only an \(m\)-dual basis, use buildDualBasis.

The dimension \(t\) of the generating vector \(\mathbf{a}\) may differ from the maximal dimension maxDim of a lattice basis. For this reason, it is specified separately either via the parameter dimaa or as the length of the given vector `aa. For example, if we want to examine only pairs and triples of coordinates taken from coordinates 1 to 32, the generating vector must have 32 dimensions, but the maximum dimension of a basis can be only 3.

Constructor & Destructor Documentation

◆ Rank1Lattice() [1/5]

template<typename Int, typename Real>
LatticeTester::Rank1Lattice< Int, Real >::Rank1Lattice ( const Int & m,
const IntVec & aa,
int64_t maxDim,
NormType norm = L2NORM )

This constructor takes as input the modulus m, the generating vector \(\mathbf{a} = \)aa, and the norm used to measure the vector lengths.

The parameter maxDim gives the maximal dimension of a basis. The constructor allocates space for that dimension, but it does not build the basis. The current basis dimension is initially 0. The maximal length of the generating vector will be the length t of the given vector aa. The coefficient \(a_j\) will be aa[j-1]. One must have aa[0] = 1.

◆ Rank1Lattice() [2/5]

template<typename Int, typename Real>
LatticeTester::Rank1Lattice< Int, Real >::Rank1Lattice ( const Int & m,
const IntVec & aa,
NormType norm = L2NORM )

In this version, the maximal dimension maxDim is set to the length of the vector aa.

◆ Rank1Lattice() [3/5]

template<typename Int, typename Real>
LatticeTester::Rank1Lattice< Int, Real >::Rank1Lattice ( const Int & m,
const Int & a,
int64_t maxDim,
int64_t dimaa,
NormType norm = L2NORM )

Constructor for the special case of a Korobov lattice.

Here the generating vector has the form \(\mathbf{a} = (1, a, a^2 \bmod m, a^3 \bmod m, ...)\) where \(a\) is an integer such that \(1 < a < m\) and \(\gcd(a, m) = 1\). The maximal dimension of a basis will be maxDim and the maximal length of the generating vector will be dimaa. The basis is not initialized, so its current dimension is initially set to 0.

◆ Rank1Lattice() [4/5]

template<typename Int, typename Real>
LatticeTester::Rank1Lattice< Int, Real >::Rank1Lattice ( const Int & m,
int64_t maxDim,
int64_t dimaa,
NormType norm = L2NORM )

This version assumes that dimaa = maxDim.

This constructor does not specify the generating vector but reserves space for it.

◆ Rank1Lattice() [5/5]

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

This version assumes that dimaa = maxDim.

◆ ~Rank1Lattice()

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

Destructor.

Member Function Documentation

◆ setaa()

template<typename Int, typename Real>
void LatticeTester::Rank1Lattice< Int, Real >::setaa ( const IntVec & aa)

Sets the generating vector to aa.

Its maximum dimension (value of t) will be set to the length of aa.

◆ seta() [1/2]

template<typename Int, typename Real>
void LatticeTester::Rank1Lattice< Int, Real >::seta ( const Int & a,
int64_t dimaa )

Sets this lattice to a Korobov lattice with multiplier a and sets the length of the generating vector to dimaa.

◆ seta() [2/2]

template<typename Int, typename Real>
void LatticeTester::Rank1Lattice< Int, Real >::seta ( const Int & a)

Sets this lattice to a Korobov lattice with multiplier a.

The maximum dimension of the generating vector is unchanged.

◆ getaa()

template<typename Int, typename Real>
IntVec LatticeTester::Rank1Lattice< Int, Real >::getaa ( )

Returns the generating vector aa.

◆ buildBasis()

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

Builds an upper-triangular primal basis in dim dimensions.

This dim must not exceed this->maxDim().

Reimplemented from LatticeTester::IntLatticeExt< Int, Real >.

◆ buildDualBasis()

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

Builds a lower-triangular m-dual basis (and not the primal) directly in dim dimensions.

This dim must not exceed this->maxDim().

Reimplemented from LatticeTester::IntLatticeExt< Int, Real >.

◆ incDimBasis()

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

Increases the current dimension of the primal basis by 1 and updates the basis.

The new increased dimension must not exceed maxDim().

Reimplemented from LatticeTester::IntLatticeExt< Int, Real >.

◆ incDimDualBasis()

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

Increases the current dimension of only the m-dual basis by 1.

The primal basis is left unchanged (not updated). The new increased dimension must not exceed maxDim(). This method uses the simplified method given in the lattice tester guide: the new m-dual basis vector is simply \(\mathbf{w}_s = (-a_s, 0, ..., 0, 1)\).

Reimplemented from LatticeTester::IntLatticeExt< Int, Real >.

◆ buildProjection()

template<typename Int, typename Real>
void LatticeTester::Rank1Lattice< Int, Real >::buildProjection ( IntLattice< Int, Real > & projLattice,
const Coordinates & coordSet )
overridevirtual

Builds a basis for the projection of this Rank1Lattice onto the coordinates in coordSet and puts it as the m_basis in projLattice.

The construction is direct, just by selecting the rows and columns whose indices are in coordSet, and using the vector aa. See Section 5.4 of the guide. The implementation is simpler and faster than the general one. The dimension coordSet.size() must not exceed the maxDim of projLattice. Note that projLattice is allowed to be the same as the current IntLattice object, in which case the projection basis will be built into the current m_basis.

Reimplemented from LatticeTester::IntLattice< Int, Real >.

◆ buildProjectionDual()

template<typename Int, typename Real>
void LatticeTester::Rank1Lattice< Int, Real >::buildProjectionDual ( IntLattice< Int, Real > & projLattice,
const Coordinates & coordSet )
overridevirtual

Similar to buildProjection, but builds a basis for the m-dual of the projection.

Reimplemented from LatticeTester::IntLattice< Int, Real >.

◆ toStringCoef()

template<typename Int, typename Real>
std::string LatticeTester::Rank1Lattice< Int, Real >::toStringCoef ( ) const

Returns the first dim components of the generating vector \(\mathbf{a}\) as a string, where dim is the current lattice basis dimension.

Member Data Documentation

◆ m_aa

template<typename Int, typename Real>
IntVec LatticeTester::Rank1Lattice< Int, Real >::m_aa
protected

Vector of multipliers (generating vector) of the rank 1 lattice rule.

They are stored for up to m_dimaa dimensions. The first coordinate has index 0.

◆ m_dimaa

template<typename Int, typename Real>
int64_t LatticeTester::Rank1Lattice< Int, Real >::m_dimaa
protected

Maximal (and current) dimension of the vector of coefficients m_aa.


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