# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1320447327 14400 # Node ID 94a37dae80a94b0f5f26234c11a4e60b7e48bed2 # Parent 38e3bfc4e076c24c481ac383c2d7e09fc40cacef Use a cheaper Cholesky decomposition than a rank() svd in ols.m diff -r 38e3bfc4e076 -r 94a37dae80a9 scripts/statistics/base/ols.m --- a/scripts/statistics/base/ols.m Fri Nov 04 16:40:07 2011 -0400 +++ b/scripts/statistics/base/ols.m Fri Nov 04 18:55:27 2011 -0400 @@ -109,12 +109,12 @@ ## Start of algorithm z = x' * x; - rnk = rank (z); + [u, p] = chol (z); - if (rnk == nc) - beta = inv (z) * x' * y; + if (p) + beta = pinv (x) * y; else - beta = pinv (x) * y; + beta = u \ (u' \ x' * y); endif if (isargout (2) || isargout (3))