- if (norm(g_k) < tolerance)
- % If x_0 is close enough to a solution, there's nothing for us to
- % do! We use g_k (the gradient of f at x_k) instead of d_k because
- % their 2-norms will be the same, and g_k is already stored.
- return;
- end
-
- for k = [1 : max_iterations]