dk = -gk;
alpha_k = step_size(xk);
- xk = xk + (alpha_k * dk);
- gk = g(xk);
+ x_next = xk + (alpha_k * dk);
% We potentially just performed one more iteration than necessary
% in order to simplify the loop. Note that due to the structure of
% our loop, we will have k > max_iterations when we fail to
% converge.
k = k + 1;
+ xk = x_next;
+ gk = g(x_next);
end
x = xk;