In grid method, we basically update the following:
![]()
In matrix, it is equivalent to

Since the maximization is performed column by column, we can calculate
from j=1 to
n
Here,
is calculated
from
and
.
All we have to keep is vector v as well as vector k. We do not have to keep n x n matrix
in the calculation.