Lattice Tester Online Documentation 0.1.0-861
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
Loading...
Searching...
No Matches
NTL Namespace Reference

This module extends the Vec and Mat classes of 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...
 

Functions

void ident (Mat_64 &mat, long dim)
 
double determinant (const NTL::matrix< std::int64_t > &mat)
 
Other utilities for compatibility with NTL.

These functions perform conversions between different types.

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

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.
 
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.
 
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 to 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.
 
void clear (double &x)
 Sets x to 0.
 
void clear (std::int64_t &x)
 Sets x to 0.
 
std::int64_t IsOdd (const std::int64_t &x)
 Tests if x is odd.
 
void set (std::int64_t &x)
 Sets x to 1.
 

Mathematical functions

These are complementary overloads to NTL power functions.

typedef NTL::matrix< int64_t > matrix64
 
typedef NTL::vector< int64_t > vector64
 
typedef Mat< std::int64_t > Mat_64
 
typedef Vec< std::int64_t > Vec_64
 
std::int64_t power (std::int64_t p, std::int64_t i)
 Returns \(p^i\).
 
void power2 (std::int64_t &z, std::int64_t i)
 Sets \(z = 2^i\).
 
void power2 (NTL::ZZ &z, std::int64_t i)
 Sets \(z = 2^i\).
 
double inv (const double x)
 
template<typename T >
static void transpose (NTL::Mat< T > &X, const NTL::Mat< T > &A)
 Transposes A into X.
 
template<typename T >
static NTL::Mat< T > transpose (const NTL::Mat< T > &a)
 Another implementation of the transpose function.
 
static void add (int64_t &x, const int64_t a, const int64_t b)
 
static void sub (int64_t &x, const int64_t a, const int64_t b)
 
static void SubPos (int64_t &x, const int64_t a, const int64_t b)
 
static void negate (int64_t &x, const int64_t a)
 
static void mul (int64_t &x, const int64_t a, const int64_t b)
 
static void div (int64_t &x, const int64_t a, const int64_t b)
 
static void rem (int64_t &x, const int64_t a, const int64_t b)
 
static void sqr (int64_t &x, const int64_t a)
 
static void MulAddTo (int64_t &x, const int64_t a, const int64_t b)
 
static void MulSubFrom (int64_t &x, int64_t a, int64_t b)
 
static void LeftShift (int64_t &x, const int64_t a, int64_t k)
 
static void RightShift (int64_t &x, const int64_t a, int64_t k)
 
static void mul (vector64 &x, const vector64 &a, const int64_t b)
 
static void add (vector64 &x, const vector64 &a, const vector64 &b)
 
static void sub (vector64 &x, const vector64 &a, const vector64 &b)
 
Vec_64 operator* (const Vec_64 &vec, std::int64_t a)
 These are operator overloads for Mat_64 and Vec_64 types.
 
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)
 
void ident (Mat_64 &mat, int64_t dim)
 Transforms mat into the identity matrix of dimensions \(\text{dim}\times\text{dim}\).
 
double determinant (const Mat_64 &mat)
 Computes and returns the determinant of ‘mat’.
 

Detailed Description

This module extends the Vec and Mat classes of NTL.

It was previously necessary because NTL and boost (an old dependency) did not use the same function names and indices. Most of the methods below only define alias names for some NTL methods. This was done at the time to have the same names for methods that are in both boost and NTL, allowing LatticeTester to work with either the boost or NTL library, depending on pre-processing statements. These alias could probably be removed because we no longer use boost in LatticeTester. However, they may still be used in LatNet Builder (?) **************

New functions have also 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::int64_t> because some basic utilities that we need for those integers are not offered in NTL.

Typedef Documentation

◆ Mat_64

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

◆ matrix64

typedef NTL::matrix<int64_t> NTL::matrix64

◆ Vec_64

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

◆ vector64

typedef NTL::vector<int64_t> NTL::vector64

Function Documentation

◆ add() [1/2]

static void NTL::add ( int64_t & x,
const int64_t a,
const int64_t b )
inlinestatic

◆ add() [2/2]

static void NTL::add ( vector64 & x,
const vector64 & a,
const vector64 & b )
static

◆ 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/2]

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() [2/2]

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.

◆ determinant() [1/2]

double NTL::determinant ( const Mat_64 & mat)

Computes and returns the determinant of ‘mat’.

◆ determinant() [2/2]

double NTL::determinant ( const NTL::matrix< std::int64_t > & mat)

◆ div()

static void NTL::div ( int64_t & x,
const int64_t a,
const int64_t b )
inlinestatic

◆ ident() [1/2]

void NTL::ident ( Mat_64 & mat,
int64_t dim )

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

◆ ident() [2/2]

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

◆ inv()

double NTL::inv ( const double x)
inline

◆ 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.

◆ LeftShift()

static void NTL::LeftShift ( int64_t & x,
const int64_t a,
int64_t k )
inlinestatic

◆ mul() [1/2]

static void NTL::mul ( int64_t & x,
const int64_t a,
const int64_t b )
inlinestatic

◆ mul() [2/2]

static void NTL::mul ( vector64 & x,
const vector64 & a,
const int64_t b )
static

◆ MulAddTo()

static void NTL::MulAddTo ( int64_t & x,
const int64_t a,
const int64_t b )
inlinestatic

◆ MulSubFrom()

static void NTL::MulSubFrom ( int64_t & x,
int64_t a,
int64_t b )
inlinestatic

◆ negate()

static void NTL::negate ( int64_t & x,
const int64_t a )
inlinestatic

◆ operator*() [1/4]

Mat_64 NTL::operator* ( const Mat_64 & mat1,
const Mat_64 & mat2 )

◆ operator*() [2/4]

Vec_64 NTL::operator* ( const Vec_64 & vec,
std::int64_t a )

These are operator overloads for Mat_64 and Vec_64 types.

Only the overloads we currently use are defined.

◆ operator*() [3/4]

std::int64_t NTL::operator* ( const Vec_64 & vec1,
const Vec_64 & vec2 )

◆ operator*() [4/4]

Vec_64 NTL::operator* ( std::int64_t a,
const Vec_64 & vec )

◆ operator*=() [1/2]

Mat_64 & NTL::operator*= ( Mat_64 & mat,
std::int64_t a )

◆ operator*=() [2/2]

Vec_64 & NTL::operator*= ( Vec_64 & vec,
std::int64_t a )

◆ operator+=()

Vec_64 & NTL::operator+= ( Vec_64 & vec1,
const Vec_64 & vec2 )

◆ operator-=()

Vec_64 & NTL::operator-= ( Vec_64 & vec1,
const Vec_64 & vec2 )

◆ power()

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

Returns \(p^i\).

◆ power2() [1/2]

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

Sets \(z = 2^i\).

◆ power2() [2/2]

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

Sets \(z = 2^i\).

◆ rem()

static void NTL::rem ( int64_t & x,
const int64_t a,
const int64_t b )
inlinestatic

◆ RightShift()

static void NTL::RightShift ( int64_t & x,
const int64_t a,
int64_t k )
inlinestatic

◆ set()

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

Sets x to 1.

◆ sqr()

static void NTL::sqr ( int64_t & x,
const int64_t a )
inlinestatic

◆ sub() [1/2]

static void NTL::sub ( int64_t & x,
const int64_t a,
const int64_t b )
inlinestatic

◆ sub() [2/2]

static void NTL::sub ( vector64 & x,
const vector64 & a,
const vector64 & b )
static

◆ SubPos()

static void NTL::SubPos ( int64_t & x,
const int64_t a,
const int64_t b )
inlinestatic

◆ transpose() [1/2]

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

Another implementation of the transpose function.

Returns the transpose of a.

No need for this: Just call NTL::transpose(x, a) directly! *********

◆ transpose() [2/2]

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

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.

This is bad because it has the same signature as the NTL method, and it is probably slower. Remove? !!!!! ***** We can replace this by a method that transposes X in place, with a single parameter.