Macaulay2 Engine
Loading...
Searching...
No Matches
LLL.hpp
Go to the documentation of this file.
1// Copyright 1998 Michael E. Stillman
2
3#ifndef _LLL_hpp_
4#define _LLL_hpp_
5
37
38#include "mat.hpp"
39#include "relem.hpp"
40
54{
55 static bool checkThreshold(ring_elem num, ring_elem den);
56
57 static bool Lovasz(MutableMatrix *lambda,
58 int k,
59 ring_elem alphaTop,
60 ring_elem alphaBottom);
61
62 static void REDI(
63 int k,
64 int ell,
66 MutableMatrix *Achange, // if non-NULL, should have same ncols as A
67 MutableMatrix *lambda);
68 static void SWAPI(
69 int k,
70 int kmax,
72 MutableMatrix *Achange, // if non-NULL, should have same ncols as A
73 MutableMatrix *lambda);
74
75 static bool initializeLLL(const MutableMatrix *A,
76 gmp_QQ threshold,
77 MutableMatrix *&LLLstate);
78 // Returns false if there is an error, and sets gError.
79
80 static int doLLL(MutableMatrix *A,
81 MutableMatrix *Achange,
82 MutableMatrix *LLLstate,
83 int nsteps = -1);
84 // Return values: COMP_DONE, COMP_DONE_STEPS, COMP_INTERRUPTED
85 public:
87 // packaged LLL routines //
89
90 // This routine return false if the computation is interrupted
91 static bool LLL(MutableMatrix *M, MutableMatrix *U, gmp_QQ threshold);
92 // M is replaced with the LLL basis. false is returned if there was an
93 // error or an interrupt.
94 // U is either NULL, or an m by m matrix over ZZ (m = numrows M), which will
95 // be made into the transform matrix.
96};
97#endif
98
99// Local Variables:
100// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
101// indent-tabs-mode: nil
102// End:
static void SWAPI(int k, int kmax, MutableMatrix *A, MutableMatrix *Achange, MutableMatrix *lambda)
Definition LLL.cpp:143
static bool LLL(MutableMatrix *M, MutableMatrix *U, gmp_QQ threshold)
Definition LLL.cpp:356
static int doLLL(MutableMatrix *A, MutableMatrix *Achange, MutableMatrix *LLLstate, int nsteps=-1)
Definition LLL.cpp:241
static bool checkThreshold(ring_elem num, ring_elem den)
Definition LLL.cpp:10
static bool Lovasz(MutableMatrix *lambda, int k, ring_elem alphaTop, ring_elem alphaBottom)
Definition LLL.cpp:72
static bool initializeLLL(const MutableMatrix *A, gmp_QQ threshold, MutableMatrix *&LLLstate)
Definition LLL.cpp:28
static void REDI(int k, int ell, MutableMatrix *A, MutableMatrix *Achange, MutableMatrix *lambda)
Definition LLL.cpp:108
Static-method namespace for the LLL lattice-basis reduction algorithm operating on a MutableMatrix.
Definition LLL.hpp:54
Abstract base class for mutable matrices over an arbitrary engine Ring, the in-place counterpart of t...
Definition mat.hpp:79
mpq_srcptr gmp_QQ
Definition m2-types.h:145
MutableMatrix — abstract base of every mutable matrix the engine hands across the boundary.
RingElement — tagged (Ring*, ring_elem) pair, the engine's universal element type.