Lattice Tester Online Documentation 0.1.0-861
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
|
#include "latticetester/Util.h"
#include <cstdlib>
#include <cmath>
#include <climits>
#include "NTL/ZZ.h"
Namespaces | |
namespace | LatticeTester |
Lattice namespace. | |
Macros | |
#define | GERME 9876543219876543L |
#define | NORM53 1.11022302462515654e-16 |
#define | NORM52 2.22044604925031308e-16 |
Functions | |
std::int64_t | LatticeTester::RandInt (std::int64_t i, std::int64_t j) |
Division and modular arithmetic | |
This module offers function to perform division and find remainders in a standard way. These functions are usefull in the case where one wants to do divisions or find remainders of operations with negative operands. The reason is that NTL and primitive types do not use the same logic when doing calculations on negative numbers. Basically, NTL will always floor a division and C++ will always truncate a division (which effectively means the floor function is replaced by a roof function if the answer is a negative number). When calculating the remainder of x/y, both apply the same logic but get a different result because they do not do the same division. In both representations, we have that \[ y\cdot(x/y) + x%y = x. \] It turns out that, with negative values, NTL will return an integer with the same sign as y where C++ will return an integer of opposite sign (but both will return the same number modulo y). | |
std::int64_t | LatticeTester::gcd (std::int64_t a, std::int64_t b) |
Returns the value of the greatest common divisor of \(a\) and \(b\) by using Stein's binary GCD algorithm. | |
Mathematical functions | |
These are complete reimplementation of certain mathematical functions, or wrappers for standard C/C++ functions. | |
std::int64_t | LatticeTester::Factorial (int64_t t) |
Calculates \(t!\), the factorial of \(t\) and returns it as an std::int64_t. | |
Random numbers | |
All the functions of this module use LFSR258 as an underlying source for pseudo-random numbers. A free (as in freedom) implementation of this generator can be found at http://simul.iro.umontreal.ca/ as well as the article presenting it. All the functions generating some sort of random number will advance an integer version of LFSR258 by one state and output a transformation of the state to give a double, an int64_t or bits. | |
double | LatticeTester::RandU01 () |
Returns a random number in \([0, 1)\). | |
std::uint64_t | LatticeTester::RandBits (int64_t s) |
Returns the first s pseudo-random bits of the underlying RNG in the form of a s-bit integer. | |
void | LatticeTester::SetSeed (std::uint64_t seed) |
Sets the seed of the generator. | |
#define GERME 9876543219876543L |
#define NORM52 2.22044604925031308e-16 |
#define NORM53 1.11022302462515654e-16 |