This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Compute an LLL-reduced basis of a lattice

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.




lllint(A) applies the LLL algorithm to the list of integer vectors A.

lllint applies the LLL algorithm to the entries of the list A. The entries of A must be lists of integers, all of the same length; the number of lists need not equal that length.

The return value of lllint has the same form.

The computations are done entirely with integers and are both accurate and quite fast.


Example 1

We apply the LLL algorithm to a list of two vectors of length three:

A := [[1, 2, 3], [4, 5, 6]]:

The result is to be interpreted as follows: the two vectors in the output form an LLL-reduced basis of the lattice genberated by the two vectors in the input.

Example 2

If the input vectors are not linearly independent, FAIL is returned:

lllint([[1, 2], [2, 4]])



A list of vectors, each being a list of integers

Return Values

list of lists is returned whose entries form an LLL-reduced basis of the lattice spanned by the entries of A. If the entries of A are not linearly independent, FAIL is returned.


A. K. Lenstra, H. W. Lenstra Jr., and L. Lovasz, Factoring polynomials with rational coefficients. Math. Ann. 261, 1982, pp. 515–534.

Joachim von zur Gathen and Jürgen Gerhard, Modern Computer Algebra. Cambridge University Press, 1999, Chapter 16.

George L. Nemhauser and Laurence A. Wolsey, Integer and Combinatorial Optimization. New York, Wiley, 1988.

A. Schrijver, Theory of Linear and Integer Programming. New York, Wiley, 1986.

Was this topic helpful?