10{
11 (void) M;
12 (void) U;
13 (void) strategy;
14#ifndef HAVE_FPLLL
15 ERROR(
"fplll is not available (configure M2 with fplll!)");
16 return 0;
17#else
18 assert(U == NULL);
19 double delta = 0.99;
20 double eta = 0.51;
21 fplll::LLLMethod method = fplll::LM_WRAPPER;
22 fplll::FloatType floatType = fplll::FT_DEFAULT;
23 int precision = 0;
24 int flags = fplll::LLL_DEFAULT;
25
26 int ncols =
static_cast<int>(M->
n_rows());
27 int nrows =
static_cast<int>(M->
n_cols());
28
29 fplll::ZZ_mat<mpz_t> mat(nrows, ncols);
30
31 for (int i = 0; i < nrows; i++)
32 for (int j = 0; j < ncols; j++)
33 {
36 {
37 mpz_set(mat[i][j].get_data(), a.
get_mpz());
38 }
39 }
40
42 lll_reduction(mat, delta, eta, method, floatType, precision, flags);
43
45 {
46 case fplll::RED_SUCCESS:
47 break;
48 case fplll::RED_BABAI_FAILURE:
49 ERROR(
"Error in fpLLL");
50 return 0;
51 case fplll::RED_LLL_FAILURE:
52 ERROR(
"infinite loop in LLL");
53 return 0;
54 default:
55 ERROR(
"unknown error in fpLLL");
56 return 0;
57 }
58
59
60 mpz_t a;
61 mpz_init(a);
62
63 for (int j = 0; j < ncols; j++)
64 for (int i = 0; i < nrows; i++)
65 {
66 mpz_set(a, mat[i][j].get_data());
69 }
70 mpz_clear(a);
71 return true;
72#endif
73}
virtual size_t n_rows() const =0
virtual size_t n_cols() const =0
virtual bool get_entry(size_t r, size_t c, ring_elem &result) const =0
virtual bool set_entry(size_t r, size_t c, const ring_elem a)=0
VALGRIND_MAKE_MEM_DEFINED & result(result)
mpz_srcptr get_mpz() const