Skip to content

Commit

Permalink
Merge pull request #123 from fplll/update_pruner
Browse files Browse the repository at this point in the history
Update to new Pruner API
  • Loading branch information
malb committed Jul 3, 2018
2 parents a555c16 + 8e5aa91 commit 211e8ad
Show file tree
Hide file tree
Showing 3 changed files with 425 additions and 96 deletions.
2 changes: 1 addition & 1 deletion src/fpylll/fplll/enumeration.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ cdef class Enumeration:
>>> _ = LLL.reduction(A)
>>> M = GSO.Mat(A)
>>> _ = M.update_gso()
>>> pruning = Pruning.run(M.get_r(0, 0), 2**40, M.r()[:30], 0.2)
>>> pruning = Pruning.run(M.get_r(0, 0), 2**40, M.r()[:30], 0.8)
>>> enum = Enumeration(M, strategy=EvaluatorStrategy.BEST_N_SOLUTIONS, sub_solutions=True)
>>> _ = enum.enumerate(0, 30, 0.999*M.get_r(0, 0), 0, pruning=pruning.coefficients)
>>> [int(a) for a,b in enum.sub_solutions[:5]]
Expand Down
8 changes: 7 additions & 1 deletion src/fpylll/fplll/fplll.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -837,14 +837,16 @@ cdef extern from "fplll/util.h" namespace "fplll":

# Pruner

cdef extern from "fplll/pruner.h" namespace "fplll":
cdef extern from "fplll/pruner/pruner.h" namespace "fplll":

cdef enum PrunerFlags:
PRUNER_CVP
PRUNER_START_FROM_INPUT
PRUNER_GRADIENT
PRUNER_NELDER_MEAD
PRUNER_VERBOSE
PRUNER_SINGLE
PRUNER_HALF

cdef enum PrunerMetric:
PRUNER_METRIC_PROBABILITY_OF_SHORTEST
Expand All @@ -864,6 +866,10 @@ cdef extern from "fplll/pruner.h" namespace "fplll":
const FT target, const PrunerMetric metric, int flags)

void optimize_coefficients(vector[double] &pr)
void optimize_coefficients_cost_vary_prob(vector[double] &pr)
void optimize_coefficients_cost_fixed_prob(vector[double] &pr)
void optimize_coefficients_evec(vector[double] &pr)
void optimize_coefficients_full(vector[double] &pr)

double single_enum_cost(const vector[double] &pr, vector[double] *detailed_cost)
double single_enum_cost(const vector[double] &pr)
Expand Down

0 comments on commit 211e8ad

Please sign in to comment.