%
denom = (p' * Q * p);
- if (abs(denom) > eps)
+ % denom is non-negative, since it's a Q-norm. No need to abs() it.
+ if (denom < eps)
% Catch divide-by-zeros. If denom is effectively zero, set it to
% something tiny instead. This trick is also used in the PCGM.
- denom = sign(denom)*eps;
+ denom = eps;
end
alpha = -(g' * p)/denom;