| Algorithm 2: The LLL reduction with pivoted reflection |
| Set and |
| For i = 1 to m − 1 (Pivoted Householder Reflection) |
| Find the shortest vector in |
| Swap(, ) of |
| Calculate for |
| Set and |
| End |
| Set k = 2 |
| While |
| For j = k-1 down to 1 |
| Set = (Size reduction) |
| End |
| If then (Lovász condition) |
| Swap (,) (Swap process) |
| Calculate for |
| Set and |
| Set k = max(k − 1, 2) |
| Else |
| Set k = k + 1 |
| End |
| End |