Mercurial > octave-nkf
diff scripts/optimization/lsqnonneg.m @ 8507:cadc73247d65
style fixes
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 13 Jan 2009 14:08:36 -0500 |
parents | 096c22ce2b0b |
children | a6c1aa6f5915 |
line wrap: on
line diff
--- a/scripts/optimization/lsqnonneg.m Tue Jan 13 11:56:00 2009 -0500 +++ b/scripts/optimization/lsqnonneg.m Tue Jan 13 14:08:36 2009 -0500 @@ -69,11 +69,11 @@ endif - MaxIter = optimget (options, "MaxIter", 1e5); + max_iter = optimget (options, "MaxIter", 1e5); ## Initialize the values. p = false (1, numel (x)); - z = ~p; + z = !p; ## If the problem is significantly over-determined, preprocess it using a ## QR factorization first. if (rows (c) >= 1.5 * columns (c)) @@ -89,7 +89,7 @@ iter = 0; ## LH3: test for completion. - while (any (z) && any (w(z) > 0) && iter < MaxIter) + while (any (z) && any (w(z) > 0) && iter < max_iter) ## LH4: find the maximum gradient. idx = find (w == max (w)); if (numel (idx) > 1) @@ -102,7 +102,7 @@ p(idx) = true; newx = false; - while (! newx && iter < MaxIter) + while (! newx && iter < max_iter) iter++; ## LH6: compute the positive matrix and find the min norm solution @@ -122,7 +122,7 @@ x = x + alpha*(xtmp - x); ## LH11: move from P to Z all X == 0. z |= (x == 0); - p = ~z; + p = !z; endif endwhile w = c'*(d - c*x); @@ -137,7 +137,7 @@ residual = d - c*x; endif exitflag = iter; - if (nargout > 3 && iter >= MaxIter) + if (nargout > 3 && iter >= max_iter) exitflag = 0; endif if (nargout > 4)