From 92116b34e755b3ef5de14a1777676bc09180f007 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 25 Mar 2013 18:48:14 -0400 Subject: [PATCH 1/1] Tiny refactoring in the PCGM. --- optimization/preconditioned_conjugate_gradient_method.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/optimization/preconditioned_conjugate_gradient_method.m b/optimization/preconditioned_conjugate_gradient_method.m index dec2eee..e2f841a 100644 --- a/optimization/preconditioned_conjugate_gradient_method.m +++ b/optimization/preconditioned_conjugate_gradient_method.m @@ -66,7 +66,8 @@ function [x, k] = preconditioned_conjugate_gradient_method(Q, ... % % 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. -- 2.43.2