Lattice Tester Guide  1.0-9
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
NTL Namespace Reference

This module contains extensions of certain classes in NTL. More...

Classes

class  matrix
 A subclass of the NTL::Mat<T> class. More...
 
class  matrix_row
 An extension of NTL::vector<T> implemented in this module to be used as a matrix row. More...
 
class  vector
 A subclass of the NTL::Vec<T> class. More...
 

Typedefs

typedef Mat< std::int64_t > Mat_64
 Renaming this supported type for convenience. More...
 
typedef Vec< std::int64_t > Vec_64
 Renaming this supported type for convenience. More...
 

Functions

void ident (Mat_64 &mat, long dim)
 Transforms mat into the identity matrix of dimensions \(\text{dim}\times\text{dim}\). More...
 
template<typename T >
void transpose (NTL::Mat< T > &X, const NTL::Mat< T > &A)
 Transposes A into X. More...
 
template<typename T >
NTL::Mat< T > transpose (const NTL::Mat< T > &a)
 Other programming style to the NTL::transpose function. More...
 
Operator overloads

These are operator overloads for Mat_64 and Vec_64 types.

Only the overloads we currently use are defined.

Vec_64 operator * (const Vec_64 &vec, std::int64_t a)
 
Vec_64 operator * (std::int64_t a, const Vec_64 &vec)
 
std::int64_t operator * (const Vec_64 &vec1, const Vec_64 &vec2)
 
Vec_64operator+= (Vec_64 &vec1, const Vec_64 &vec2)
 
Vec_64operator-= (Vec_64 &vec1, const Vec_64 &vec2)
 
Vec_64operator *= (Vec_64 &vec, std::int64_t a)
 
Mat_64operator *= (Mat_64 &mat, std::int64_t a)
 
Mat_64 operator * (const Mat_64 &mat1, const Mat_64 &mat2)
 
Some other compatibility utilities

These functions perform convertions between different types.

Most of them do not really need explainations, but sometimes a specific logic is used when doing the convertion.

void conv (std::int64_t &l, const char *c)
 Converts the array of characters (string) c into an std::int64_t l using the strtol() function of cstdlib.h. More...
 
void conv (double &r, const char *c)
 Converts the array of characters (string) c into a double r using the strtod() function of cstdlib.h. More...
 
void conv (double &x, long long a)
 Converts a long long to a double. More...
 
void conv (long long &x, double a)
 Converts a double to a long long. More...
 
void conv (ZZ &x, long long a)
 Converts a long long to a NTL::ZZ. More...
 
void conv (long long &x, ZZ a)
 Converts a NTL::ZZ to a long long. More...
 
void conv (long &x, long long a)
 Converts a long long to a long. More...
 
void conv (long long &x, long a)
 Converts a long to a long long. More...
 
void conv (long long &x, long long a)
 Since both are of the same type, this assigns a to x. More...
 
Function overloads

These functions are already implemented in NTL for NTL::ZZ or NTL::RR types, but not for the other standard types we use.

These overloads allow us to make a simple call the the function in the NTL namespace without worrying about types and still have working algorithms.

bool IsZero (const std::int64_t &x)
 Returns the bool resulting of the statement x == 0. More...
 
void clear (double &x)
 Sets x to 0. More...
 
void clear (std::int64_t &x)
 Sets x to 0. More...
 
std::int64_t IsOdd (const std::int64_t &x)
 Tests if x is odd. More...
 
void set (std::int64_t &x)
 Sets x to 1. More...
 
Mathematical functions

These are complementary overloads to NTL power functions.

std::int64_t power (std::int64_t p, std::int64_t i)
 Returns \(p^i\). More...
 
void power2 (std::int64_t &z, std::int64_t i)
 Sets \(z = 2^i\). More...
 
void power2 (NTL::ZZ &z, std::int64_t i)
 Sets \(z = 2^i\). More...
 
double sqrt (const double &a)
 
double log (const double x)
 
double inv (const double x)
 

Detailed Description

This module contains extensions of certain classes in NTL.

It was previously necessary because NTL and boost (an old dependency) did not use the same function names and indices.

This name conversion was meant to have the same function names in boost and NTL and allows us to have LatticeTester work with either boost library or NTL library depending on preprocessing statements.

New functions have been implemented in this module as a way to overload a few operators and methods of NTL (especially on matrix and vector types) to the usage of NTL::Mat<std::uint64_t> because some basic utilies do not exist in NTL and we want to support these use cases.

Typedef Documentation

◆ Mat_64

typedef Mat<std::int64_t> NTL::Mat_64

Renaming this supported type for convenience.

◆ Vec_64

typedef Vec<std::int64_t> NTL::Vec_64

Renaming this supported type for convenience.

Function Documentation

◆ clear() [1/2]

void NTL::clear ( double &  x)
inline

Sets x to 0.

◆ clear() [2/2]

void NTL::clear ( std::int64_t &  x)
inline

Sets x to 0.

◆ conv() [1/9]

void NTL::conv ( std::int64_t &  l,
const char *  c 
)
inline

Converts the array of characters (string) c into an std::int64_t l using the strtol() function of cstdlib.h.

◆ conv() [2/9]

void NTL::conv ( double &  r,
const char *  c 
)
inline

Converts the array of characters (string) c into a double r using the strtod() function of cstdlib.h.

◆ conv() [3/9]

void NTL::conv ( double &  x,
long long  a 
)
inline

Converts a long long to a double.

◆ conv() [4/9]

void NTL::conv ( long long &  x,
double  a 
)
inline

Converts a double to a long long.

This truncates the decimals of a.

◆ conv() [5/9]

void NTL::conv ( ZZ &  x,
long long  a 
)
inline

Converts a long long to a NTL::ZZ.

◆ conv() [6/9]

void NTL::conv ( long long &  x,
ZZ  a 
)
inline

Converts a NTL::ZZ to a long long.

This will truncate a if it has to many digits.

◆ conv() [7/9]

void NTL::conv ( long &  x,
long long  a 
)
inline

Converts a long long to a long.

This will truncate a if it has to many digits.

◆ conv() [8/9]

void NTL::conv ( long long &  x,
long  a 
)
inline

Converts a long to a long long.

◆ conv() [9/9]

void NTL::conv ( long long &  x,
long long  a 
)
inline

Since both are of the same type, this assigns a to x.

◆ ident()

void NTL::ident ( Mat_64 mat,
long  dim 
)

Transforms mat into the identity matrix of dimensions \(\text{dim}\times\text{dim}\).

◆ IsOdd()

std::int64_t NTL::IsOdd ( const std::int64_t &  x)
inline

Tests if x is odd.

Returns 1 if it is odd, and 0 if it is even.

◆ IsZero()

bool NTL::IsZero ( const std::int64_t &  x)
inline

Returns the bool resulting of the statement x == 0.

IsZero is already defined for the type NTL::ZZ in NTL, but not for std::int64_t.

◆ power()

std::int64_t NTL::power ( std::int64_t  p,
std::int64_t  i 
)
inline

Returns \(p^i\).

◆ power2() [1/2]

void NTL::power2 ( std::int64_t &  z,
std::int64_t  i 
)
inline

Sets \(z = 2^i\).

◆ power2() [2/2]

void NTL::power2 ( NTL::ZZ &  z,
std::int64_t  i 
)
inline

Sets \(z = 2^i\).

◆ set()

void NTL::set ( std::int64_t &  x)
inline

Sets x to 1.

◆ transpose() [1/2]

template<typename T >
void NTL::transpose ( NTL::Mat< T > &  X,
const NTL::Mat< T > &  A 
)

Transposes A into X.

This is a template overload of the transpose function of NTL. This does basically the same thing as the implementation NTL uses. It might be necessary to implement the swap function for the type T for this to work.

◆ transpose() [2/2]

template<typename T >
NTL::Mat<T> NTL::transpose ( const NTL::Mat< T > &  a)
inline

Other programming style to the NTL::transpose function.