LatNet Builder Manual 2.1.3-6
Software Package for Constructing Highly Uniform Point Sets
|
This class implements a general rank 1 lattice. More...
#include <Rank1Lattice.h>
Inherits LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >.
Public Member Functions | |
Rank1Lattice (const Int &m, const IntVec &a, int maxDim, LatticeTester::NormType norm=LatticeTester::L2NORM) | |
Full constructor. | |
Rank1Lattice (const Rank1Lattice< Int, BasInt, Dbl, RedDbl > &Lat) | |
Copy constructor. | |
Rank1Lattice & | operator= (const Rank1Lattice< Int, BasInt, Dbl, RedDbl > &Lat) |
Assigns Lat to this object. | |
~Rank1Lattice () | |
Destructor. | |
std::string | toStringCoef () const |
Returns the firsts components of the vector of multipliers \(a\) as a string. | |
void | buildBasis (long d) |
Builds the basis in dimension d. | |
void | dualize () |
Dualize the matrix. | |
void | incDim () |
Increases the dimension by 1. | |
Public Member Functions inherited from 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. | |
IntLattice (const IntLattice< Int, BasInt, Dbl, RedDbl > &Lat) | |
Copy constructor that makes a copy of Lat. | |
void | copy (const IntLattice< Int, BasInt, Dbl, RedDbl > &lattice) |
Copies lattice into this object. | |
virtual | ~IntLattice () |
Destructor. | |
void | init () |
Allocates space to vectors used internally. | |
int | getOrder () const |
This returns the rank of the lattice. | |
void | calcLgVolDual2 (double lgm2) |
Computes the logarithm of the normalization factor (m_lgVolDual2) in all dimensions \(\leq\) MaxDim for the lattice. | |
double | getLgVolDual2 (int i) const |
Gives the log of m^(2*i) if i < order, else gives the log of m^(2*i) | |
void | dualize () |
Exchange the primal basis and the dual basis. | |
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. | |
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. | |
virtual void | buildBasis (int d) |
Builds the basis for the lattice in dimension d. | |
LatticeTester::Normalizer< RedDbl > * | getNormalizer (NormaType norma, int alpha, bool dualF) |
Creates and returns the normalizer corresponding to criterion norma. | |
virtual void | setLac (const Lacunary< BasInt > &) |
A utility method to store a vector of indices with lacunary values in subclasses of this one. | |
virtual std::string | toString () const |
Returns a string describing the lattice. | |
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. | |
IntLatticeBasis (const BasIntMat basis, const int dim, NormType norm=L2NORM) | |
Constructor taking all three needed component of an IntLatticeBasis. | |
IntLatticeBasis (const BasIntMat primalbasis, const BasIntMat dualbasis, const Int modulo, const int dim, NormType norm=L2NORM) | |
Complete constructor. | |
IntLatticeBasis (const IntLatticeBasis< Int, BasInt, Dbl, RedDbl > &Lat) | |
Copy constructor. | |
~IntLatticeBasis () | |
Destructor. | |
void | kill () |
Cleans and releases all the memory allocated to this lattice. | |
void | copyBasis (const IntLatticeBasis< Int, BasInt, Dbl, RedDbl > &lat) |
Copy the lattice lat, except it's NormType and dimension, into this object. | |
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. | |
void | initVecNorm () |
Initializes a vector containing the norms of the basis vectors to -1 at all components. | |
BasIntMat & | getBasis () |
Returns the basis represented in a matrix. | |
BasIntMat & | getDualBasis () |
Returns the dual basis represented in a matrix. | |
int | getDim () const |
Returns the dimension of the lattice. | |
NormType | getNorm () const |
Returns the NormType used by this lattice. | |
Dbl | getVecNorm (const int &i) |
Returns the norm of the i-th vector of the basis. | |
DblVec | getVecNorm () const |
Returns the norm of each vector of the basis in a vector. | |
Dbl | getDualVecNorm (const int &i) |
Returns the norm of the i-th vector of the dual basis. | |
DblVec | getDualVecNorm () const |
Returns the norm of each vector of the dual basis in a vector. | |
Int | getModulo () const |
Returns the m used for rescaling if it has been defined. | |
void | setDim (const int &d) |
Sets the dimension of the basis to d. | |
void | setNorm (const NormType &norm) |
Sets the NormType used by this lattice to norm. | |
void | setVecNorm (const Dbl &value, const int &i) |
Sets the norm of the i-th component of the basis to value. | |
void | setDualVecNorm (const Dbl &value, const int &i) |
Sets the norm of the i-th component of the dual basis to value. | |
bool | withDual () const |
Returns true if a dual has been defined and false otherwise. | |
void | setDualFlag (bool flag) |
Sets the withDual flag to flag. | |
void | setNegativeNorm () |
Sets all the values in the array containing the norms of the basis vectors to -1. | |
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. | |
void | setDualNegativeNorm () |
Sets all the values in the array containing the norms of the dual basis vectors to -1. | |
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. | |
void | updateVecNorm () |
Updates the array containing the basis vectors norms by recomputing them. | |
void | updateVecNorm (const int &d) |
Updates the array containing the basis vectors norms from the d-th component to the last by recomputing them. | |
void | updateDualVecNorm () |
Updates the array containing the dual basis vectors norms by recomputing them. | |
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. | |
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. | |
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. | |
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. | |
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. | |
void | permute (int i, int j) |
Exchanges vectors i and j in the basis. | |
void | permuteNoDual (int i, int j) |
Exchanges vectors i and j in the basis without changing the dual. | |
bool | checkDuality () |
Returns true if the dual basis contained in the object really is the dual of the basis, and false otherwise. | |
void | sort (int d) |
Sorts the basis vectors with indices greater of equal to \(d\) by increasing length. | |
void | sortNoDual (int d) |
Sorts the basis vectors with indices greater of equal to \(d\) by increasing length. | |
std::string | toStringBasis () const |
Returns a string with the primal basis and its norms. | |
std::string | toStringDualBasis () const |
Returns a string with the dual basis and its norms. | |
void | write () const |
Writes the lattice and its parameters on standard output. |
Protected Member Functions | |
void | init () |
Initializes the rank 1 lattice. | |
Protected Member Functions inherited from LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl > | |
virtual void | kill () |
Cleans and releases all the memory allocated to this lattice. |
Protected Attributes | |
IntVec | m_a |
The multipliers of the rank 1 lattice rule. | |
Protected Attributes inherited from LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl > | |
int | m_order |
The order of the basis. | |
int | m_maxDim |
double * | m_lgVolDual2 |
Represente sur dual along the diagonal? | |
double | m_lgm2 |
The logarithm \(\log (m^2)\). | |
BasIntMat | m_wSI |
The dual basis of the current projection. | |
BasIntMat | m_vSI |
The primal basis of the current projection. | |
Int | m_t1 |
Working Variables used in MRGLattice.h. | |
Int | m_t2 |
Int | m_t3 |
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. | |
BasIntMat | m_dualbasis |
Each row of this matrix represents a vector in the dual basis of the lattice. | |
int | m_dim |
The dimension of the lattice. | |
NormType | m_norm |
The NormType used in the reduction and for this lattice. | |
DblVec | m_vecNorm |
The norm of each vector in the basis. | |
DblVec | m_dualvecNorm |
The norm of each vector in the dual basis. | |
BasInt | m_modulo |
The m used for rescaling the lattice. | |
bool | m_withDual |
If m_withDual is true a dual basis has been specified, otherwise it is false. |
This class implements a general rank 1 lattice.
A rank 1 lattice is the lattice \(\mathbb{Z}_m^d\) generated by a recurrence of the form
\begin{equation} u_i = (i \mathbf{a} \mod m), \end{equation}
where \(\mathbf{a} \in \mathbb{Z}_m^d\). It can also be seen as a lattice in \([0,1)^d\) by dividing the coordinates of all the points by \(m\). Given \(\mathbf{a}\), the basis of such a lattice is given, quite simply, by
\begin{align*} \mathbf{v}_1 & = a \\ \mathbf{v}_2 & = m \mathbf{e}_2 \\ \vdots & \\ \mathbf{v}_d & = m \mathbf{e}_v \\ \end{align*}
where \(\mathbf{e}_i\) is a vector of 0 with a 1 at the \(i^\text{th}\) coordinate.
A condition that is most wanted when building a rank 1 lattice is that \(\gcd(a_i, m) = 1,\ \forall 1\leq i \leq d\). If this condition is verified, the lattice covers the same number of points, \(m\), in all its projections. Note that if one searches for such a lattice, it is possible, without loss of generality generality, to assume that \(a_1 = 1\).
This class implements or reuses the methods of IntLattice, as well as some new methods to build a basis from a generator.
LatticeTester::Rank1Lattice< Int, BasInt, Dbl, RedDbl >::Rank1Lattice | ( | const Int & | m, |
const IntVec & | a, | ||
int | maxDim, | ||
LatticeTester::NormType | norm = LatticeTester::L2NORM ) |
Full constructor.
The lattice can be completely described by the generating vector a, the dimension maxDim, and the modulo m since all the points of the lattice can be obtained by taking
\[ u_i = (i \mathbf{a} \mod m), \]
with \(\mathbf{a}\) being an assortment of the first components of a (a being a vector of dimension maxDim).
This initializes all needed internal components (see IntLattice). In particular, this sets maximal dimension for this object to maxDim. This means that when creating an object of this class, it is important that \(\text{maxDim} \leq \dim(a)\) and ideal that the equality holds. This constructor does not build the basis to allow for more flexibility in the dimension when doing so.
References init(), LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >::IntLattice(), and m_a.
Referenced by operator=(), and Rank1Lattice().
void LatticeTester::Rank1Lattice< Int, BasInt, Dbl, RedDbl >::buildBasis | ( | long | d | ) |
Builds the basis in dimension d.
d has to be smaller or equal than this->maxDim()
References LatticeTester::CalcDual(), dualize(), m_a, LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >::m_basis, LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >::m_dualbasis, LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >::m_modulo, LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >::setDim(), LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >::setDualNegativeNorm(), LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >::setNegativeNorm(), and LatticeTester::Triangularization().
Referenced by incDim().
void LatticeTester::Rank1Lattice< Int, BasInt, Dbl, RedDbl >::dualize | ( | ) |
Dualize the matrix.
The matrix entered need to have the particular shape describe ERWAN
References LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >::m_basis, and LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >::m_dualbasis.
Referenced by buildBasis().
|
virtual |
Increases the dimension by 1.
Reimplemented from LatticeTester::IntLattice< Int, BasInt, Dbl, RedDbl >.
References buildBasis(), LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >::getDim(), LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >::setDualNegativeNorm(), and LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >::setNegativeNorm().
std::string LatticeTester::Rank1Lattice< Int, BasInt, Dbl, RedDbl >::toStringCoef | ( | ) | const |
Returns the firsts components of the vector of multipliers \(a\) as a string.
This will print only the a number of components of a corresponding to the current dimension of the lattice.
References LatticeTester::IntLatticeBasis< Int, BasInt, Dbl, RedDbl >::getDim(), m_a, and LatticeTester::toString().