Lattice Builder Manual
Software Package for Constructing Rank-1 Lattices
|
This class offers tools to manipulate lattice bases. More...
#include <IntLattice.h>
Inherited by LatCommon::KorobovLattice, and LatCommon::Rank1Lattice.
Public Member Functions | |
IntLattice (const MScal &m, int k, int maxDim, NormType norm=L2NORM) | |
Constructor. More... | |
IntLattice (const IntLattice &Lat) | |
Copy constructor. More... | |
IntLattice & | operator= (const IntLattice &Lat) |
Assigns Lat to this object. More... | |
virtual | ~IntLattice () |
Destructor. | |
void | copy (const IntLattice &lattice) |
Same as assignment operator above. | |
int | getDim () const |
Returns actual dimension Dim . | |
void | setDim (int d) |
Sets actual dimension to \(d\). | |
int | getMaxDim () const |
Returns the maximal dimension of the lattice. | |
virtual void | incDim () |
Increases dimension Dim by 1. | |
virtual void | buildBasis (int d) |
Builds the basis for the lattice in dimension d . | |
NormType | getNorm () const |
Returns the norm used by the lattice. | |
MScal | getM () const |
Returns the value of the modulus \(m\) of the recurrence (the number of points of the lattice). | |
NScal | getM2 () const |
Returns the square number of points in the lattice. | |
int | getOrder () const |
Returns the order. | |
Normalizer * | getNormalizer (NormaType norma, int alpha) |
Creates and returns the normalizer corresponding to criterion norma . More... | |
virtual std::string | toStringCoef () const |
Returns the vector of multipliers (or coefficients) \(A\) as a string. | |
Base & | getPrimalBasis () |
Returns the primal basis V . | |
Base & | getDualBasis () |
Returns the dual basis W . | |
void | calcLgVolDual2 (bool dualF) |
Computes the logarithm of the normalization factor m_lgVolDual2 for the merit in all dimensions % \(\le \) maxDim for the dual lattice if dualF is true , and for the primal lattice if dualF is false . | |
double | getLgVolDual2 (int i) const |
bool | getXX (int i) const |
void | setXX (bool val, int i) |
void | sort (int d) |
Sorts the basis vectors with indices from \(d+1\) to the dimension of the basis by increasing length. More... | |
void | permute (int i, int j) |
Exchanges vectors \(i\) and \(j\) in the basis and in the dual basis. | |
void | write (const char *filename) const |
Writes this basis in file named filename . | |
void | trace (char *msg) |
For debugging purposes. | |
void | write (int flag) |
Writes this basis on standard output. More... | |
void | dualize () |
Exchanges basis \(V\) and its dual \(W\). | |
bool | checkDuality () |
Checks that the bases satisfy the duality relation \(V[i]\cdot W[j] = m\,\delta_{ij}\). More... | |
bool | baseEquivalence (IntLattice &Lat) |
Checks that Lat's basis and this basis are equivalent. More... | |
void | buildProjection (IntLattice *lattice, const Coordinates &proj) |
Builds the basis (and dual basis) of the projection proj for this lattice. More... | |
Protected Member Functions | |
void | init () |
void | kill () |
Cleans and releases all the memory allocated for this lattice. | |
Protected Attributes | |
int | m_order |
The order of the basis. | |
MScal | m_m |
Number of points per unit volume (m_m ) and its square (m_m2 ). | |
NScal | m_m2 |
double | m_lgm2 |
The logarithm \(\log_2 (m^2)\). | |
Base | m_v |
Primal basis of the lattice. | |
Base | m_w |
Dual basis of the lattice. | |
double * | m_lgVolDual2 |
bool * | m_xx |
Work variables. | |
MScal | m_t1 |
MScal | m_t2 |
MScal | m_t3 |
BMat | m_vSI |
Base | m_vTemp |
This class offers tools to manipulate lattice bases.
Each lattice is represented by a basis \(V\) and its dual \(W\). It is sometimes possible, as in the case of lattices associated with LCGs (linear congruential generators) or MRGs (multiple recursive generators), to multiply a lattice (and its dual) by a constant factor \(m\) in such a way that they are included in \(\mathbb{Z}^t\), allowing exact representation of basis vector coordinates. The duality relation will then read \(V_i\cdot W_j = m\delta_{ij}\) for some integer constant { \(m\)}.
LatCommon::IntLattice::IntLattice | ( | const MScal & | m, |
int | k, | ||
int | maxDim, | ||
NormType | norm = L2NORM |
||
) |
Constructor.
The modulus is initialized to \(m\), the maximal dimension of the bases is set to maxDim
, and the order is set to \(k\).
LatCommon::IntLattice::IntLattice | ( | const IntLattice & | Lat | ) |
Copy constructor.
The maximal dimension of the created basis is set equal to Lat's
current dimension.
bool LatCommon::IntLattice::baseEquivalence | ( | IntLattice & | Lat | ) |
Checks that Lat's
basis and this basis are equivalent.
If so, returns true
, otherwise returns false
.
void LatCommon::IntLattice::buildProjection | ( | IntLattice * | lattice, |
const Coordinates & | proj | ||
) |
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.
bool LatCommon::IntLattice::checkDuality | ( | ) |
Checks that the bases satisfy the duality relation \(V[i]\cdot W[j] = m\,\delta_{ij}\).
If so, returns true
, otherwise returns false
.
Normalizer* LatCommon::IntLattice::getNormalizer | ( | NormaType | norma, |
int | alpha | ||
) |
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.
IntLattice& LatCommon::IntLattice::operator= | ( | const IntLattice & | Lat | ) |
Assigns Lat
to this object.
The maximal dimension of this basis is set equal to Lat's
current dimension.
void LatCommon::IntLattice::sort | ( | int | d | ) |
Sorts the basis vectors with indices from \(d+1\) to the dimension of the basis by increasing length.
The dual vectors are permuted accordingly. Assumes that the lengths of the corresponding basis vectors % VV
and WW
are up to date.
void LatCommon::IntLattice::write | ( | int | flag | ) |
Writes this basis on standard output.
If flag
\( > 0\), the norm of the basis vectors will be recomputed; otherwise not.