Remove useless abs() in the PCGM.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 25 Mar 2013 21:38:41 +0000 (17:38 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 25 Mar 2013 21:38:41 +0000 (17:38 -0400)
optimization/preconditioned_conjugate_gradient_method.m

index cd886084a9766e1d785df59185c358ae69d75cc7..dec2eeed97418094671d0db34e327e1351820415 100644 (file)
@@ -90,8 +90,8 @@ function [x, k] = preconditioned_conjugate_gradient_method(Q, ...
 
     % 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;