245{
248
249
250 int k, kmax;
251 ring_elem a, alphaTop, alphaBottom;
252 buffer o;
253
255 {
257 assert(res.first);
258 k = static_cast<int>(res.second);
259 }
260 else
261 k = 0;
262
264 {
266 assert(res.first);
267 kmax = static_cast<int>(res.second);
268 }
269 else
270 kmax = 0;
271
273 LLLstate->
get_entry(0, n + 3, alphaBottom);
274
276 {
278 {
280 o << ".";
282 if (nsteps % 20 == 0) o <<
newline;
284 }
285 nsteps--;
286
287 if (k > kmax)
288 {
290 {
292 o << "." << k;
293 if (nsteps % 20 == 0) o <<
newline;
295 }
296
297 kmax = k;
298 for (int j = 0; j <= k; j++)
299 {
300 ring_elem u;
302 for (int i = 0; i <= j - 1; i++)
303 {
304
305 ring_elem Di, mki, mji, Di1;
310 {
313 }
314 if (i > 0)
315 {
317 i - 1, i - 1, Di1);
320 u = t1;
321 }
322 }
323
326 {
327 ERROR(
"LLL vectors not independent");
329 }
330 }
331 }
332 REDI(k, k - 1, A, Achange, LLLstate);
333 if (
Lovasz(LLLstate, k, alphaTop, alphaBottom))
334 {
335 SWAPI(k, kmax, A, Achange, LLLstate);
336 k--;
337 if (k == 0) k = 1;
338 }
339 else
340 {
341 for (int ell = k - 2; ell >= 0; ell--)
342 REDI(k, ell, A, Achange, LLLstate);
343 k++;
344 }
345 }
346
347
350
354}
static void SWAPI(int k, int kmax, MutableMatrix *A, MutableMatrix *Achange, MutableMatrix *lambda)
static bool Lovasz(MutableMatrix *lambda, int k, ring_elem alphaTop, ring_elem alphaBottom)
static void REDI(int k, int ell, MutableMatrix *A, MutableMatrix *Achange, MutableMatrix *lambda)
virtual bool dot_product(size_t i, size_t j, ring_elem &result) 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
void subtract_to(ring_elem &f, const ring_elem &g) const
void mult_to(ring_elem &f, const ring_elem g) const
virtual bool is_zero(const ring_elem f) const
virtual ring_elem from_long(long n) const
virtual void remove(ring_elem &f) const
virtual ring_elem divide(const ring_elem f, const ring_elem g) const
virtual ring_elem mult(const ring_elem f, const ring_elem g) const
virtual std::pair< bool, long > coerceToLongInteger(ring_elem a) const
bool system_interrupted()