本文整理汇总了C++中Evaluator::get_max_error_aux方法的典型用法代码示例。如果您正苦于以下问题:C++ Evaluator::get_max_error_aux方法的具体用法?C++ Evaluator::get_max_error_aux怎么用?C++ Evaluator::get_max_error_aux使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Evaluator
的用法示例。
在下文中一共展示了Evaluator::get_max_error_aux方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shortest_vector_ex
static int shortest_vector_ex(IntMatrix &b, IntVect &sol_coord, SVPMethod method,
const vector<double> &pruning, int flags, EvaluatorMode eval_mode,
long long &sol_count, vector<IntVect> *subsol_coord = nullptr,
vector<enumf> *subsol_dist = nullptr)
{
bool findsubsols = (subsol_coord != nullptr) && (subsol_dist != nullptr);
// d = lattice dimension (note that it might decrease during preprocessing)
int d = b.get_rows();
// n = dimension of the space
int n = b.get_cols();
FPLLL_CHECK(d > 0 && n > 0, "shortestVector: empty matrix");
FPLLL_CHECK(d <= n, "shortestVector: number of vectors > size of the vectors");
// Sets the floating-point precision
// Error bounds on GSO are valid if prec >= minprec
double rho;
int min_prec = gso_min_prec(rho, d, LLL_DEF_DELTA, LLL_DEF_ETA);
int prec = max(53, min_prec + 10);
int old_prec = Float::set_prec(prec);
// Allocates space for vectors and matrices in constructors
IntMatrix empty_mat;
MatGSO<Integer, Float> gso(b, empty_mat, empty_mat, GSO_INT_GRAM);
Float max_dist;
Integer int_max_dist;
Integer itmp1;
// Computes the Gram-Schmidt orthogonalization in floating-point
gso.update_gso();
gen_zero_vect(sol_coord, d);
// If the last b_i* are too large, removes them to avoid an underflow
int new_d = last_useful_index(gso.get_r_matrix());
if (new_d < d)
{
// FPLLL_TRACE("Ignoring the last " << d - new_d << " vector(s)");
d = new_d;
}
if (flags & SVP_DUAL)
{
max_dist = 1.0 / gso.get_r_exp(d - 1, d - 1);
if (flags & SVP_VERBOSE)
{
cout << "max_dist = " << max_dist << endl;
}
}
else
{
/* Computes a bound for the enumeration. This bound would work for an
exact algorithm, but we will increase it later to ensure that the fp
algorithm finds a solution */
get_basis_min(int_max_dist, b, 0, d);
max_dist.set_z(int_max_dist, GMP_RNDU);
}
// Initializes the evaluator of solutions
Evaluator<Float> *evaluator;
if (method == SVPM_FAST)
{
evaluator = new FastEvaluator<Float>(d, gso.get_mu_matrix(), gso.get_r_matrix(), eval_mode, 0,
findsubsols);
}
else if (method == SVPM_PROVED)
{
ExactEvaluator *p = new ExactEvaluator(d, b, gso.get_mu_matrix(), gso.get_r_matrix(), eval_mode,
0, findsubsols);
p->int_max_dist = int_max_dist;
evaluator = p;
}
else
{
FPLLL_ABORT("shortestVector: invalid evaluator type");
}
evaluator->init_delta_def(prec, rho, true);
if (!(flags & SVP_OVERRIDE_BND) && (eval_mode == EVALMODE_SV || method == SVPM_PROVED))
{
Float ftmp1;
bool result = evaluator->get_max_error_aux(max_dist, true, ftmp1);
FPLLL_CHECK(result, "shortestVector: cannot compute an initial bound");
max_dist.add(max_dist, ftmp1, GMP_RNDU);
}
// Main loop of the enumeration
enumerate_svp(d, gso, max_dist, *evaluator, pruning, flags);
int result = RED_ENUM_FAILURE;
if (eval_mode != EVALMODE_SV)
{
result = RED_SUCCESS;
sol_count = evaluator->sol_count * 2;
}
else if (!evaluator->sol_coord.empty())
{
/*Float fMaxError;
validMaxError = evaluator->get_max_error(fMaxError);
max_error = fMaxError.get_d(GMP_RNDU);*/
//.........这里部分代码省略.........