Lattice Builder Manual
Software Package for Constructing Rank-1 Lattices
|
This module describes various useful functions as well as functions interfacing with NTL. More...
Functions | |
NTL compatibility utilities | |
long | IsOdd (const long &x) |
Returns 1 if \(x\) is odd, and 0 otherwise. | |
Mathematical functions | |
long | power (long p, long i) |
Returns \(p^i\). | |
void | power2 (long &z, long i) |
Sets \(z = 2^i\). | |
double | mysqrt (double x) |
Returns \(\sqrt{x}\) for \(x\ge 0\), and \(-1\) for \(x < 0\). | |
double | SqrRoot (double x) |
Returns \(\sqrt{x}\). More... | |
template<typename T > | |
double | Log2 (const T &x) |
Logarithm of \(x\) in base 2. | |
double | Log2 (long x) |
Logarithm of \(x\) in base 2. | |
template<typename T > | |
long | sign (const T &x) |
Returns 1, 0 or \(-1\) depending on whether \(x> 0\), \(x= 0\) or \(x< 0\) respectively. More... | |
Division and remainder | |
For negative operands, the The negative quotient differs by 1 and the remainder also differs. Thus the following small
| |
void | div (long &a, const long &b, const long &d) |
Integer division: \(a = b/d\). | |
Vectors | |
template<typename Real > | |
void | CreateVect (Real *&A, int d) |
Allocates memory for the vector \(A\) of dimensions \(d+1\) and initializes its elements to 0. | |
template<typename Real > | |
void | DeleteVect (Real *&A) |
Frees the memory used by the vector \(A\). | |
template<typename Vect > | |
void | CreateVect (Vect &A, int d) |
Creates the vector \(A\) of dimensions \(d+1\) and initializes its elements to 0. | |
template<typename Vect > | |
void | DeleteVect (Vect &A) |
Frees the memory used by the vector \(A\). | |
template<typename Real > | |
void | SetZero (Real *A, int d) |
Sets components \([0..d]\) of \(A\) to 0. | |
template<typename Real > | |
void | SetValue (Real *A, int d, const Real &x) |
Sets all components \([0..d]\) of \(A\) to the value \(x\). | |
void | Invert (const MVect &A, MVect &B, int n) |
Transforms the polynomial \(A_0 + A_1x^1 + \cdots + A_nx^n\) into \(x^n - A_1x^{n-1} - \cdots - A_n\). More... | |
template<typename Vect > | |
void | CopyVect (const Vect &A, Vect &B, int n) |
Copies vector \(A\) into vector \(B\) using components \([0..n]\). | |
template<typename Xcal , typename Scal > | |
void | ModifVect (Xcal *A, const Xcal *B, Scal x, int n) |
Adds vector \(B\) multiplied by \(x\) to vector \(A\) using components \([1..n]\), and puts the result in \(A\). | |
Matrices | |
template<typename Real > | |
void | CreateMatr (Real **&A, int d) |
Allocates memory for the square matrix \(A\) of dimensions \((d+1)\times(d+1)\). More... | |
template<typename Real > | |
void | DeleteMatr (Real **&A, int d) |
Frees the memory used by the \((d+1)\times(d+1)\) matrix \(A\). | |
template<typename Real > | |
void | CreateMatr (Real **&A, int line, int col) |
Allocates memory for the matrix \(A\) of dimensions (line + 1) \(\times\) (col + 1). More... | |
template<typename Real > | |
void | DeleteMatr (Real **&A, int line, int col) |
Frees the memory used by the matrix \(A\). | |
void | CreateMatr (MMat &A, int d) |
Creates the square matrix \(A\) of dimensions \((d+1)\times(d+1)\) and initializes its elements to 0. | |
void | CreateMatr (MMatP &A, int d) |
As above. | |
void | CreateMatr (MMat &A, int line, int col) |
Creates the matrix \(A\) of dimensions (line + 1) \(\times\) (col + 1). More... | |
void | CreateMatr (MMatP &A, int line, int col) |
As above. | |
void | DeleteMatr (MMat &A) |
Deletes the matrix \(A\). | |
void | DeleteMatr (MMatP &A) |
As above. | |
template<typename Matr > | |
void | CopyMatr (const Matr &A, Matr &B, int n) |
Copies matrix \(A\) into matrix \(B\). | |
template<typename Matr > | |
void | CopyMatr (const Matr &A, Matr &B, int line, int col) |
As above. | |
template<typename MatT > | |
std::string | toStr (const MatT &mat, int d1, int d2) |
Transforms mat into a string. More... | |
Variables | |
const double | MAX_LONG_DOUBLE = 9007199254740992.0 |
Maximum integer that can be represented exactly as a double: \(2^{53}\). | |
This module describes various useful functions as well as functions interfacing with NTL.
|
inline |
Allocates memory for the square matrix \(A\) of dimensions \((d+1)\times(d+1)\).
Initializes its elements to 0.
|
inline |
Allocates memory for the matrix \(A\) of dimensions (line
+ 1) \(\times\) (col
+ 1).
Initializes its elements to 0.
|
inline |
Creates the matrix \(A\) of dimensions (line
+ 1) \(\times\) (col
+ 1).
Initializes its elements to 0.
|
inline |
Transforms the polynomial \(A_0 + A_1x^1 + \cdots + A_nx^n\) into \(x^n - A_1x^{n-1} - \cdots - A_n\).
The result is put in \(B\).
|
inline |
Returns 1, 0 or \(-1\) depending on whether \(x> 0\), \(x= 0\) or \(x< 0\) respectively.
%
|
inline |
Returns \(\sqrt{x}\).
std::string LatMRG::toStr | ( | const MatT & | mat, |
int | d1, | ||
int | d2 | ||
) |
Transforms mat
into a string.
Prints the first \(d1\) rows and \(d2\) columns. Indices start at 1. Elements with index 0 are not printed.