%
% We use this in the inner loop.
- sqrt_n = floor(sqrt(length(x0)));
+ n = length(x0);
+ sqrt_n = floor(sqrt(n));
% Set k=0 first, that way the references to xk,rk,zk,dk which
% immediately follow correspond (semantically) to x0,r0,z0,d0.
% So if it's too close to zero, we replace it with something
% comparable but non-zero.
- if (abs(dkQdk) < eps)
- dkQdk = sign(dkQdk)*eps;
+ if (dkQdk < eps)
+ dkQdk = eps;
end
alpha_k = rkzk/dkQdk;