0

I am using C++ to do a research. And I am interested to know how to use the LLL function in NTL to find the shortest vector. My code is as follow;

#include <NTL/ZZ.h>
#include <NTL/matrix.h>
#include <NTL/mat_ZZ.h>
#include <NTL/vector.h>

using namespace std;
using namespace NTL;

int main()
{
    Mat<ZZ> B;
    cin >> B;
    cout << B << "\n";
    long LLL(ZZ& det2, mat_ZZ& B, long verbose = 0);
    cout << B << "\n";
}

However, the matrix I enter into B is not reduced. What is wrong?

Ivan Feng
  • 1
  • 2
  • This was the second Google result for me, does this help? http://www.shoup.net/ntl/doc/LLL.cpp.html – Morpheu5 Nov 14 '17 at 15:58
  • Thank you. I found it too. It is a documentation, but it does not have a sample of how to implement LLL Algorithm correctly. – Ivan Feng Nov 14 '17 at 17:34
  • Just as a side note: LLL does not find the shortest lattice vector. It computes only a better lattice basis consisting of short vectors and often containing a shortest vector. But this is not guaranteed. To be sure you need to search for the shortest vector using Enum oder NewEnum algorithm but I think both are not implemented in NTL. – AbcAeffchen Apr 01 '23 at 20:47

1 Answers1

0

I realise I have forgotten to include the correct library and implementation of LLL is not correct.

This is the library that I have forgotten to include.

#include <NTL/LLL/h>

To execute LLL algorithm, do as follow

LLL_XD(B);
Ivan Feng
  • 1
  • 2