Lattice Tester Online Documentation 0.1.0-861
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
|
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <cstdlib>
#include <cstdint>
#include <type_traits>
#include <NTL/tools.h>
#include <NTL/fileio.h>
#include <NTL/vector.h>
#include <NTL/matrix.h>
#include <NTL/vec_double.h>
#include <NTL/ZZ.h>
#include <NTL/LLL.h>
#include <latticetester/Util.h>
Macros | |
#define | TR_BND (NTL_FDOUBLE_PRECISION/2.0) |
Typedefs | |
typedef NTL::vector< int64_t > | vector64 |
This module contains a modified version of the LLL_FP module of NTL. | |
Functions | |
template<typename Int , typename IntMat > | |
NTL_OPEN_NNS long | LLL_FPInt (IntMat &B, const double delta=0.99, long r=0, long c=0, NTL::vector< double > *sqlen=0) |
This function is similar to LLL_FP in NTL, but only the first r rows and first c columns of the matrix B are considered, and a basis is built for the lattice generated by these (partial) rows. | |
template<typename Int , typename IntMat > | |
long | BKZ_FPInt (IntMat &BB, const double delta=0.99, long blocksize=10, long prune=0, long r=0, long c=0, NTL::vector< double > *sqlen=0) |
This function is similar to BKZ_FP in NTL, with the same modifications as in LLL_FPInt above. | |
NTL_CLOSE_NNS static NTL_START_IMPL void | CheckFinite (double *p) |
static double | max_abs (double *v, long n) |
static double | InnerProductD (double *a, double *b, long n) |
template<typename Int , typename IntVec > | |
static void | InnerProductV (Int &prod, const IntVec &a, const IntVec &b, long n) |
template<typename Int , typename IntVec > | |
void | InnerProductV (Int &prod, const IntVec &a, const IntVec &b, long n) |
template<> | |
void | InnerProductV (int64_t &prod, const NTL::Vec< int64_t > &a, const NTL::Vec< int64_t > &b, long n) |
template<> | |
void | InnerProductV (ZZ &prod, const NTL::Vec< ZZ > &a, const NTL::Vec< ZZ > &b, long n) |
static void | InnerProductR (RR &xx, const vec_RR &a, const vec_RR &b, long n) |
static void | RowTransformStartInt (double *a, long *in_a, long &in_float, long n) |
template<typename IntVec > | |
static void | RowTransformFinishInt (IntVec &A, double *a, long *in_a, long n) |
template<typename Int , typename IntVec > | |
static void | RowTransformInt (IntVec &A, IntVec &B, const Int &MU1, long n) |
template<> | |
void | RowTransformInt (vec_ZZ &A, vec_ZZ &B, const ZZ &MU1, long n) |
template<typename Int , typename IntVec > | |
static void | RowTransformInt (IntVec &A, IntVec &B, const Int &MU1, long n, double *a, double *b, long *in_a, double &max_a, double max_b, long &in_float) |
template<> | |
void | RowTransformInt (NTL::Vec< long > &A, NTL::Vec< long > &B, const int64_t &MU1, long n, double *a, double *b, long *in_a, double &max_a, double max_b, int64_t &in_float) |
template<> | |
void | RowTransformInt (NTL::Vec< ZZ > &A, NTL::Vec< ZZ > &B, const NTL::ZZ &MU1, long n, double *a, double *b, long *in_a, double &max_a, double max_b, long &in_float) |
template<typename Int , typename IntVec > | |
static void | RowTransformAdd (IntVec &A, IntVec &B, const Int &MU1, long n) |
template<> | |
void | RowTransformAdd (NTL::Vec< int64_t > &A, NTL::Vec< int64_t > &B, const int64_t &MU1, long n) |
template<> | |
void | RowTransformAdd (vec_ZZ &A, vec_ZZ &B, const ZZ &MU1, long n) |
template<typename Int , typename IntMat > | |
static void | ComputeGSInt (IntMat &B, double **B1, double **mu, double *b, double *c, long k, long n, double bound, long st, double *buf) |
static void | init_red_fudge () |
static void | inc_red_fudge () |
template<typename IntMat > | |
void | printBB1 (IntMat &B, double **B1, long m) |
void | ComputeGSInt (const mat_ZZ &B, mat_RR &B1, mat_RR &mu, vec_RR &b, vec_RR &c, long k, long n, const RR &bound, long st, vec_RR &buf, const RR &bound2) |
template<typename Int , typename IntMat > | |
static void | RR_GSInt (IntMat &B, double **B1, double **mu, double *b, double *c, double *buf, long prec, long rr_st, long k, long m_orig, long n, mat_RR &rr_B1, mat_RR &rr_mu, vec_RR &rr_b, vec_RR &rr_c) |
template<> | |
void | RR_GSInt< long, NTL::matrix< long > > (NTL::matrix< long > &B, double **B1, double **mu, double *b, double *c, double *buf, long prec, long rr_st, long k, long m_orig, long n, mat_RR &rr_B1, mat_RR &rr_mu, vec_RR &rr_b, vec_RR &rr_c) |
template<> | |
void | RR_GSInt< NTL::ZZ, mat_ZZ > (mat_ZZ &B, double **B1, double **mu, double *b, double *c, double *buf, long prec, long rr_st, long k, long m_orig, long n, mat_RR &rr_B1, mat_RR &rr_mu, vec_RR &rr_b, vec_RR &rr_c) |
void | ComputeGSInt (const mat_ZZ &B, mat_RR &mu, vec_RR &c, long m, long n) |
template<typename Int , typename IntMat > | |
static long | ll_LLL_FPInt (IntMat &B, double delta, double **B1, double **mu, double *b, double *c, long m, long n, long init_k, long quit) |
template<> | |
int64_t | ll_LLL_FPInt< long, matrix< long > > (matrix< int64_t > &B, double delta, double **B1, double **mu, double *b, double *c, int64_t m, int64_t n, int64_t init_k, long quit) |
template<typename Int , typename IntMat > | |
long | ll_LLL_FPInt (IntMat &B, double delta, double **B1, double **mu, double *b, double *c, long m, long n, long init_k, long quit) |
template<typename Int , typename IntMat > | |
long | LLL_FPInt (IntMat &B, double delta, long m, long n, NTL::vector< double > *sqlen) |
This function is similar to LLL_FP in NTL, but only the first r rows and first c columns of the matrix B are considered, and a basis is built for the lattice generated by these (partial) rows. | |
static void | ComputeBKZConstant (long beta, long p) |
static void | ComputeBKZThresh (double *c, long beta) |
template<typename Int , typename IntMat > | |
long | BKZ_FPInt (IntMat &BB, double delta, long beta, long prune, long m, long n, vector< double > *sqlen) |
Variables | |
static NTL_CHEAP_THREAD_LOCAL double | red_fudge = 0 |
static NTL_CHEAP_THREAD_LOCAL long | log_red = 0 |
static NTL_CHEAP_THREAD_LOCAL unsigned long | NumSwaps = 0 |
static vec_double | BKZConstant |
static vec_double | BKZThresh |
#define TR_BND (NTL_FDOUBLE_PRECISION/2.0) |
typedef NTL::vector<int64_t> vector64 |
This module contains a modified version of the LLL_FP
module of NTL.
With the modified functions, the basis entries are in Int
, which can be either int64_t
or ZZ
. We can also apply LLL or BKZ only to a submatrix (first r
rows and c
columns) of the matrix B
that is passed in and returned. The returned basis will have c
columns and at most max(r,c)
rows (the rank of the basis matrix), so it may not occupy the entire space in B
. With this flexibility, we can reserve a large block of memory for the matrix B
and reuse this same block (the same object B
) for thousands or millions of lattices that we want to analyze, even if the bases have different dimensions.
Another addition is the possibility to recover an array sqlen
that gives the square Euclidean lengths of the basis vectors, in double
. This array is maintained in the LLL_FP
functions of NTL, but it is hidden in the implementation and not accessible from outside. In IntLattice
, these lengths are maintained in a RealVec
object. In this module, we assume that Real = double
.
Each function returns the dimension of the computed basis (number of independent rows). This basis is always returned in the upper-left corner of the matrix B
. This differs from the LLL_FP
functions, which returns the zero vectors at the top.
long BKZ_FPInt | ( | IntMat & | BB, |
const double | delta = 0.99, | ||
long | blocksize = 10, | ||
long | prune = 0, | ||
long | r = 0, | ||
long | c = 0, | ||
NTL::vector< double > * | sqlen = 0 ) |
This function is similar to BKZ_FP
in NTL, with the same modifications as in LLL_FPInt above.
long BKZ_FPInt | ( | IntMat & | BB, |
double | delta, | ||
long | beta, | ||
long | prune, | ||
long | m, | ||
long | n, | ||
vector< double > * | sqlen ) |
|
inlinestatic |
|
static |
|
static |
void ComputeGSInt | ( | const mat_ZZ & | B, |
mat_RR & | B1, | ||
mat_RR & | mu, | ||
vec_RR & | b, | ||
vec_RR & | c, | ||
long | k, | ||
long | n, | ||
const RR & | bound, | ||
long | st, | ||
vec_RR & | buf, | ||
const RR & | bound2 ) |
void ComputeGSInt | ( | const mat_ZZ & | B, |
mat_RR & | mu, | ||
vec_RR & | c, | ||
long | m, | ||
long | n ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
void InnerProductV | ( | Int & | prod, |
const IntVec & | a, | ||
const IntVec & | b, | ||
long | n ) |
void InnerProductV | ( | int64_t & | prod, |
const NTL::Vec< int64_t > & | a, | ||
const NTL::Vec< int64_t > & | b, | ||
long | n ) |
void InnerProductV | ( | ZZ & | prod, |
const NTL::Vec< ZZ > & | a, | ||
const NTL::Vec< ZZ > & | b, | ||
long | n ) |
|
static |
long ll_LLL_FPInt | ( | IntMat & | B, |
double | delta, | ||
double ** | B1, | ||
double ** | mu, | ||
double * | b, | ||
double * | c, | ||
long | m, | ||
long | n, | ||
long | init_k, | ||
long | quit ) |
int64_t ll_LLL_FPInt< long, matrix< long > > | ( | matrix< int64_t > & | B, |
double | delta, | ||
double ** | B1, | ||
double ** | mu, | ||
double * | b, | ||
double * | c, | ||
int64_t | m, | ||
int64_t | n, | ||
int64_t | init_k, | ||
long | quit ) |
NTL_OPEN_NNS long LLL_FPInt | ( | IntMat & | B, |
const double | delta = 0.99, | ||
long | r = 0, | ||
long | c = 0, | ||
NTL::vector< double > * | sqlen = 0 ) |
This function is similar to LLL_FP
in NTL, but only the first r
rows and first c
columns of the matrix B
are considered, and a basis is built for the lattice generated by these (partial) rows.
The other elements of B
are ignored. The basis is returned in the upper left corner of B
, with the shortest basis vector always in the first row. If r=0
, then all the rows of the IntMat
object are taken. If c=0
, then all the columns are taken. The square lengths of the returned basis vectors are also returned in the double
vector sqlen
, in sqlen[0],..., sqlen[d-1]
, if this vector given. The indices of B
and sqlen
start at 0. The function returns the dimension of the computed basis (the number of independent rows).
long LLL_FPInt | ( | IntMat & | B, |
const double | delta = 0.99, | ||
long | r = 0, | ||
long | c = 0, | ||
NTL::vector< double > * | sqlen = 0 ) |
This function is similar to LLL_FP
in NTL, but only the first r
rows and first c
columns of the matrix B
are considered, and a basis is built for the lattice generated by these (partial) rows.
The other elements of B
are ignored. The basis is returned in the upper left corner of B
, with the shortest basis vector always in the first row. If r=0
, then all the rows of the IntMat
object are taken. If c=0
, then all the columns are taken. The square lengths of the returned basis vectors are also returned in the double
vector sqlen
, in sqlen[0],..., sqlen[d-1]
, if this vector given. The indices of B
and sqlen
start at 0. The function returns the dimension of the computed basis (the number of independent rows).
|
static |
void printBB1 | ( | IntMat & | B, |
double ** | B1, | ||
long | m ) |
|
static |
void RowTransformAdd | ( | NTL::Vec< int64_t > & | A, |
NTL::Vec< int64_t > & | B, | ||
const int64_t & | MU1, | ||
long | n ) |
void RowTransformAdd | ( | vec_ZZ & | A, |
vec_ZZ & | B, | ||
const ZZ & | MU1, | ||
long | n ) |
|
static |
|
static |
|
static |
void RowTransformInt | ( | NTL::Vec< long > & | A, |
NTL::Vec< long > & | B, | ||
const int64_t & | MU1, | ||
long | n, | ||
double * | a, | ||
double * | b, | ||
long * | in_a, | ||
double & | max_a, | ||
double | max_b, | ||
int64_t & | in_float ) |
void RowTransformInt | ( | NTL::Vec< ZZ > & | A, |
NTL::Vec< ZZ > & | B, | ||
const NTL::ZZ & | MU1, | ||
long | n, | ||
double * | a, | ||
double * | b, | ||
long * | in_a, | ||
double & | max_a, | ||
double | max_b, | ||
long & | in_float ) |
void RowTransformInt | ( | vec_ZZ & | A, |
vec_ZZ & | B, | ||
const ZZ & | MU1, | ||
long | n ) |
|
static |
|
static |
void RR_GSInt< long, NTL::matrix< long > > | ( | NTL::matrix< long > & | B, |
double ** | B1, | ||
double ** | mu, | ||
double * | b, | ||
double * | c, | ||
double * | buf, | ||
long | prec, | ||
long | rr_st, | ||
long | k, | ||
long | m_orig, | ||
long | n, | ||
mat_RR & | rr_B1, | ||
mat_RR & | rr_mu, | ||
vec_RR & | rr_b, | ||
vec_RR & | rr_c ) |
void RR_GSInt< NTL::ZZ, mat_ZZ > | ( | mat_ZZ & | B, |
double ** | B1, | ||
double ** | mu, | ||
double * | b, | ||
double * | c, | ||
double * | buf, | ||
long | prec, | ||
long | rr_st, | ||
long | k, | ||
long | m_orig, | ||
long | n, | ||
mat_RR & | rr_B1, | ||
mat_RR & | rr_mu, | ||
vec_RR & | rr_b, | ||
vec_RR & | rr_c ) |
|
static |
|
static |
|
static |
|
static |
|
static |