2
6.4
The approximate nearest vector problem
In this section, we use Algorithm 6.3 to produce a reduced basis of a lattice,
and then use this reduced basis to solve approximately the nearest vector
problem in
L
introduced in Eq. (6.2) In particular, let
L
be a lattice and
x
∈
Q
n
not belonging to
L
.
The nearest vector problem is
NP
hard.
Algorithm 6.4 that we present next finds a
b
∗
∈ L
such that
b
∗
−
x
≤
(2
n
−
1)
1
/
2
min
{
b
−
x
:
b
∈ L \ {
0
}}
.
(6.12)
Algorithm 6.4 Approximate nearest vector algorithm
Input
: A reduced basis
b
1
, . . . ,
b
n
of a lattice
L
, the GramSchmidt
orthogonalization
˜
b
1
, . . . ,
˜
b
n
and
x
∈
Q
n
.
Output
: A vector
b
∗
∈ L
satisfying Eq. (6.12) and rational multipliers
λ
i
,
i
= 1
, . . . , n
with

λ
i
 ≤
1
/
2
, such that
b
∗
−
x
=
n
i
=1
λ
i
˜
b
i
.
Algorithm
:
1.
Set
z
n
+1
=
0
and
x
n
+1
=
x
.
2.
For
i
=
n, . . . ,
1
:
(a)
Compute
σ
1
,i
, . . . σ
i,i
∈
Q
such that
x
i
+1
=
i
j
=1
σ
j,i
˜
b
j
.
(b)
Set
λ
i
=
σ
i,i
−
σ
i,i
, where
σ
i,i
denotes the nearest integer
to
σ
i,i
.
(c)
Set
z
i
=
z
i
+1
+
σ
i,i
b
i
.
(d)
Set
x
i
=
x
i
+1
−
σ
i,i
b
i
+
λ
i
˜
b
i
.
3.
Return
b
∗
=
z
1
and
λ
1
, . . . , λ
n
.
Example 6.9
We revisit Example 6.6.
We have seen that the vectors
b
1
=
(1
,
1) ,
b
2
= (2
,
−
1) constitute a reduced basis of the lattice
L
(
b
1
,
b
2
). The cor
responding GramSchmidt orthogonalization is
˜
b
1
= (1
,
1) and
˜
b
2
= (1
.
5
,
−
1
.
5).
Let
x
= (7
.
5
,
3
.
0) . We start the approximate nearest vector algorithm by setting
z
3
=
0
and
x
3
=
x
. We then set
i
= 2 and compute multipliers
σ
1
,
2
, σ
2
,
2
such
that
x
=
σ
1
,
2
˜
b
1
+
σ
2
,
2
˜
b
2
.
This gives
σ
1
,
2
=
x
˜
b
1
˜
b
1
2
= 5
.
25
,
and
σ
2
,
2
=
x
˜
b
2
˜
b
2
2
= 1
.
5
.