Skip to main content
. 2022 Oct 8;24(10):1428. doi: 10.3390/e24101428
Algorithm 1 LLL algorithm.
  • Input: 

    lattice basis B=[b1,b2,…,bn]∈Rm×n, a reduction parameter δ.

  • Output: 

    a δ-LLL reduced basis

  •  1:

    Calculate the Gram–Schmidt orthogonalization B∗=[b1∗,b2∗,…,bn∗].

  •  2:

    for i = 2, 3,…, n do

  •  3:

       for j = i − 1, i − 2,…, 1 do

  •  4:

         bi=bi−ci,jbj, where ci,j=⌈〈bi,bj∗〉/〈bj∗,bj∗〉⌋;

  •  5:

       end for

  •  6:

    end for

  •  7:

    if ∃i, s.t.δ∥bi−1∗∥2>∥μi,i−1bi−1∗+bi∗∥2 then

  •  8:

       Swap bi−1 and bi;

  •  9:

       Go to Step 1.

  •  10:

    end if

  •  11:

    return B.