Lattice Tester Online Documentation 0.1.0-861
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
|
This subclass of IntLatticeExt
defines an MRG lattice and is similar to Rank1Lattice, but constructs lattices associated with multiple recursive generators (MRGs) with modulus m, order k, and vector of multipliers a = (a_1, .
More...
#include <latticetester/MRGLattice.h>
Public Member Functions | |
MRGLattice (const Int &m, const IntVec &aa, int64_t maxDim, NormType norm=L2NORM) | |
This constructor takes as input the modulus m , the vector of multipliers aa , and the norm used to measure the vector lengths. | |
MRGLattice (const MRGLattice< Int, Real > &Lat) | |
MRGLattice & | operator= (const MRGLattice< Int, Real > &Lat) |
Assigns Lat to this object. | |
~MRGLattice () | |
Destructor. | |
void | setaa (const IntVec &aa) |
Sets the vector of multipliers. | |
void | buildBasis (int64_t dim) |
Builds a basis in dim dimensions. | |
void | buildDualBasis (int64_t dim) |
Builds both the primal and an m-dual lower triangular basis 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 both the primal and m-dual basis by 1. | |
void | buildProjection (IntLattice< Int, Real > &projLattice, const Coordinates &proj) override |
This method overrides its namesake in IntLattice . | |
void | buildProjectionDual (IntLattice< Int, Real > &projLattice, const Coordinates &proj) override |
Overrides the same function from IntLattice . | |
std::string | toStringCoef () const |
Returns the first dim components of the generating vector \(\ba\) as a string, where dim is the current lattice dimension. | |
Public Member Functions inherited from 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. | |
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 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 . | |
IntMat & | getBasis () |
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'. | |
IntMat & | getDualBasis () |
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 . | |
Public Attributes | |
int | m_order |
IntVec | m_aCoeff |
The coefficients \(a_1, ..., a_k\) of the MRG recurrence, a_j stored in m_aCoeff[j] . | |
Protected Member Functions | |
void | buildBasis0 (IntMat &basis, int64_t d) |
The following protected functions take the basis as a parameter for more flexibility. | |
void | incDimBasis0 (IntMat &basis, int64_t d) |
bool | buildProjection0 (IntMat &basis, int64_t dimbasis, IntMat &pbasis, const Coordinates &proj) |
Protected Member Functions inherited from LatticeTester::IntLatticeExt< Int, Real > | |
virtual void | kill () |
Protected Attributes | |
IntMat | m_basis0 |
This matrix contains the initial basis V for the MRG lattice as defined in Section 4.1 of the LatMRG guide. | |
int64_t | m_dim0 = 0 |
The current dimension of m_basis0 . | |
IntVec | m_y |
A vector to store \(y_0, y_1, ..., y_{t+k-2}\) used in the matrix V^{(p)}. | |
IntMat | m_genTemp |
This auxiliary matrix is used to store the generating vectors of a projections before reducing them into a triangular basis. | |
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. | |
This subclass of IntLatticeExt
defines an MRG lattice and is similar to Rank1Lattice, but constructs lattices associated with multiple recursive generators (MRGs) with modulus m, order k, and vector of multipliers a = (a_1, .
. . , a_k).
The functions buildBasis
and incDimBasis
always build and update the primal basis. To build the m-dual, use buildDualBasis
.
LatticeTester::MRGLattice< Int, Real >::MRGLattice | ( | const Int & | m, |
const IntVec & | aa, | ||
int64_t | maxDim, | ||
NormType | norm = L2NORM ) |
This constructor takes as input the modulus m
, the vector of multipliers aa
, and the norm used to measure the vector lengths.
The vector aa
must have length k+1
, with \(a_j\) in aa[j]
. The maximal dimension maxDim
will be the maximal dimension of the basis. This constructor does not build the basis, so we can build it for a smaller number of dimensions or only for selected projections.
LatticeTester::MRGLattice< Int, Real >::MRGLattice | ( | const MRGLattice< Int, Real > & | Lat | ) |
LatticeTester::MRGLattice< Int, Real >::~MRGLattice | ( | ) |
Destructor.
|
virtual |
Builds a basis in dim
dimensions.
This dim
must not exceed this->maxDim()
. This initial primal basis will be upper triangular.
Reimplemented from LatticeTester::IntLatticeExt< Int, Real >.
|
protected |
The following protected functions take the basis as a parameter for more flexibility.
They are used inside buildBasis, buildBasisDual, incDimBasis, etc., with either m_basis
or m_basis0
.
|
virtual |
Builds both the primal and an m-dual lower triangular basis directly in dim
dimensions.
This dim
must not exceed maxDim
.
Reimplemented from LatticeTester::IntLatticeExt< Int, Real >.
|
overridevirtual |
This method overrides its namesake in IntLattice
.
A basis for the projection of this MRGLattice
over the coordinates in proj
is returned in projLattice
. The implementation used here exploits the rank-k lattice structure and it is faster than the general one. See Section 5.5 of the LatMRG guide.
Reimplemented from LatticeTester::IntLattice< Int, Real >.
|
protected |
|
overridevirtual |
Overrides the same function from IntLattice
.
When all the first k coordinates {1,...,k} belong to the projection, both the primal and m-dual constructions are direct, just by selecting the rows and columns whose indices are in proj
. Otherwise an upper triangular basis is constructed for the basis and a lower-triangular basis for the m-dual.
Reimplemented from LatticeTester::IntLattice< Int, Real >.
|
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 >.
|
protected |
|
virtual |
Increases the current dimension of both the primal and m-dual basis by 1.
The new increased dimension must not exceed maxDim
. This function uses the simplified method for MRG lattices given in the lattice tester guide. It requires the original primal basis to update the m-dual.
Reimplemented from LatticeTester::IntLatticeExt< Int, Real >.
MRGLattice< Int, Real > & LatticeTester::MRGLattice< Int, Real >::operator= | ( | const MRGLattice< Int, Real > & | Lat | ) |
Assigns Lat
to this object.
void LatticeTester::MRGLattice< Int, Real >::setaa | ( | const IntVec & | aa | ) |
Sets the vector of multipliers.
Sets the generating vector to aa
.
The order k
of the lattice is set equal to the length of this vector, minus 1. aa[j]
must contain \(a_j\) for j=1,...,k.
std::string LatticeTester::MRGLattice< Int, Real >::toStringCoef | ( | ) | const |
Returns the first dim
components of the generating vector \(\ba\) as a string, where dim
is the current lattice dimension.
IntVec LatticeTester::MRGLattice< Int, Real >::m_aCoeff |
The coefficients \(a_1, ..., a_k\) of the MRG recurrence, a_j stored in m_aCoeff[j]
.
|
protected |
This matrix contains the initial basis V for the MRG lattice as defined in Section 4.1 of the LatMRG guide.
It is used only to calculate or update the m-dual basis. Its dimension is enlarged whenever needed and never reduced.
|
protected |
The current dimension of m_basis0
.
|
protected |
This auxiliary matrix is used to store the generating vectors of a projections before reducing them into a triangular basis.
int LatticeTester::MRGLattice< Int, Real >::m_order |
|
protected |
A vector to store \(y_0, y_1, ..., y_{t+k-2}\) used in the matrix V^{(p)}.