- while (k <= max_iterations)
- if (norm(rk) < tolerance)
- % Success.
- x = xk;
- return;
- end
-
- alpha_k = step_length_cgm(rk, A, pk);
+ while (k <= max_iterations && norm(rk, 'inf') > tolerance)
+ alpha_k = step_length_positive_definite(rk, A, pk);