Permalink
Browse files

Merge branch 'master' into hlll

  • Loading branch information...
lgremy committed Jul 9, 2018
2 parents 6257d31 + 2219652 commit cff081017bdefc1332a1396dc2659153012f119f
@@ -69,3 +69,4 @@ doc/html/
/tests/test_gso
/tests/test_lll_gram
/tests/test_hlll
/fplll/pruner/*.o
@@ -341,7 +341,7 @@ This library does not currently use multiple cores and running multiple threads
fplll is currently maintained by:
- Martin Albrecht, <martinralbrecht@googlemail.com>
- Shi Bai, <shi.bai@gmail.com>
- Shi Bai, <shih.bai@gmail.com>
## Contributors ##
@@ -36,7 +36,7 @@ nobase_include_fplll_HEADERS=defs.h fplll.h \
bkz_param.h \
enum/enumerate.h enum/enumerate_base.h enum/enumerate_ext.h \
sieve/sieve_gauss.h sieve/sieve_common.h sieve/sieve_gauss_str.h sieve/sampler_basic.h \
pruner.h \
pruner/pruner.h pruner/pruner_simplex.h \
householder.h hlll.h
bin_PROGRAMS=fplll latticegen latsieve
@@ -82,7 +82,15 @@ libfplll_la_SOURCES=fplll.cpp fplll.h \
bkz.cpp bkz.h \
bkz_param.cpp bkz_param.h \
gso_interface.cpp gso_interface.h gso_gram.cpp gso_gram.h gso.cpp gso.h \
pruner.cpp pruner.h \
pruner/pruner.cpp \
pruner/pruner.h \
pruner/pruner_simplex.h \
pruner/pruner_cost.cpp \
pruner/pruner_optimize.cpp \
pruner/pruner_optimize_tc.cpp \
pruner/pruner_optimize_tp.cpp \
pruner/pruner_prob.cpp \
pruner/pruner_util.cpp \
sieve/sieve_gauss.cpp \
sieve/sieve_gauss.h \
sieve/sieve_common.h\
@@ -120,6 +128,7 @@ install-data-hook:
uninstall-hook:
if test -d "${DESTDIR}$(includedir)/fplll/enum"; then rmdir "${DESTDIR}$(includedir)/fplll/enum"; fi
if test -d "${DESTDIR}$(includedir)/fplll/nr"; then rmdir "${DESTDIR}$(includedir)/fplll/nr"; fi
if test -d "${DESTDIR}$(includedir)/fplll/pruner"; then rmdir "${DESTDIR}$(includedir)/fplll/pruner"; fi
(test -d "${DESTDIR}$(includedir)/fplll" && rmdir "${DESTDIR}$(includedir)/fplll") || true
rm -f "${DESTDIR}$(includedir)/fplll.h"
@@ -21,7 +21,7 @@
*/
#include "defs.h"
#include "pruner.h"
#include "pruner/pruner.h"
#include <string>
#include <vector>
@@ -292,6 +292,12 @@ enum PrunerFlags
PRUNER_NELDER_MEAD = 0x8,
// Verbosity
PRUNER_VERBOSE = 0x10,
// Optimize w.r.t to half of the coefficients (those of even indices)
// (by default this is not enabled)
PRUNER_HALF = 0x20,
// Optimize goal set to single enumeration cost while fixing the probability ~ target. Note that
// flags PRUNER_HALF and PRUNER_SINGLE are mutually exclusive.
PRUNER_SINGLE = 0x40
};
#define PRUNER_ZEALOUS (PRUNER_GRADIENT | PRUNER_NELDER_MEAD)
@@ -30,6 +30,7 @@ class Enumerator
double max_volume = ENUM_MAX_VOLUME, int min_level = ENUM_MIN_LEVEL);
bool enum_next(const FP_NR<mpfr_t> &max_sqr_length);
inline const vector<enumxt> &get_sub_tree() { return sub_tree; }
private:
const Matrix<FP_NR<mpfr_t>> &mu;
const Matrix<FP_NR<mpfr_t>> &r;
@@ -24,7 +24,7 @@
#include "bkz.h"
#include "bkz_param.h"
#include "pruner.h"
#include "pruner/pruner.h"
#include "svpcvp.h"
#include "util.h"
#include "wrapper.h"
@@ -381,6 +381,39 @@ template <class ZT> int hlll(Options &o, ZZ_mat<ZT> &b)
return status;
}
template <class ZT> int prune(Options &, ZZ_mat<ZT> &) { ABORT_MSG("mpz required for pruner"); }
template <> int prune(Options &o, ZZ_mat<mpz_t> &b)
{
int status, prune_start = 0, prune_end = b.get_rows();
double gh_factor = 1.0, prune_pre_nodes = 1e6, prune_min_prob = -1.0;
if (o.bkz_flags & BKZ_GH_BND)
gh_factor = o.bkz_gh_factor;
if (o.prune_start)
prune_start = o.prune_start;
if (o.prune_end)
prune_end = o.prune_end;
if (o.prune_pre_nodes)
prune_pre_nodes = o.prune_pre_nodes;
if (o.prune_min_prob)
prune_min_prob = o.prune_min_prob;
status = run_pruner(b, o.float_type, o.precision, prune_start, prune_end, prune_pre_nodes,
prune_min_prob, gh_factor);
if (status != RED_SUCCESS)
{
cerr << "Failure: " << get_red_status_str(status) << endl;
}
return status;
}
template <class ZT> int run_action(Options &o)
{
istream *is;
@@ -423,6 +456,9 @@ template <class ZT> int run_action(Options &o)
case ACTION_HLLL:
result = hlll(o, m);
break;
case ACTION_PRU:
result = prune(o, m);
break;
default:
ABORT_MSG("unimplemented action");
break;
@@ -462,6 +498,8 @@ void read_options(int argc, char **argv, Options &o)
}
else if (strcmp(argv[ac], "hlll") == 0)
o.action = ACTION_HLLL;
else if (strcmp(argv[ac], "pru") == 0)
o.action = ACTION_PRU;
else
ABORT_MSG("parse error in -a switch: lll or svp expected");
}
@@ -471,6 +509,30 @@ void read_options(int argc, char **argv, Options &o)
CHECK(ac < argc, "missing value after -b switch");
o.block_size = atoi(argv[ac]);
}
else if (strcmp(argv[ac], "-prustart") == 0)
{
++ac;
CHECK(ac < argc, "missing value after -prustart switch");
o.prune_start = atoi(argv[ac]);
}
else if (strcmp(argv[ac], "-pruend") == 0)
{
++ac;
CHECK(ac < argc, "missing value after -pruend switch");
o.prune_end = atoi(argv[ac]);
}
else if (strcmp(argv[ac], "-pruprenodes") == 0)
{
++ac;
CHECK(ac < argc, "missing value after '-pruprenodes'");
o.prune_pre_nodes = atof(argv[ac]);
}
else if (strcmp(argv[ac], "-pruminprob") == 0)
{
++ac;
CHECK(ac < argc, "missing value after '-pruminprob'");
o.prune_min_prob = atof(argv[ac]);
}
else if (strcmp(argv[ac], "-bkzboundedlll") == 0)
{
o.bkz_flags |= BKZ_BOUNDED_LLL;
@@ -40,7 +40,8 @@ enum Action
ACTION_BKZ,
ACTION_SVP,
ACTION_CVP,
ACTION_HLLL
ACTION_HLLL,
ACTION_PRU
};
struct Options
@@ -70,6 +71,10 @@ struct Options
int block_size;
int bkz_flags;
int bkz_max_loops;
int prune_start;
int prune_end;
double prune_pre_nodes;
double prune_min_prob;
double bkz_max_time;
string bkz_dump_gso_filename;
double bkz_gh_factor;
Oops, something went wrong.

0 comments on commit cff0810

Please sign in to comment.