How to implement LLL Lattice Reduction in NTL using c++?

764 Views Asked by At

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?

1

There are 1 best solutions below

0
Ivan Feng On

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);