changeset 14341:71efccec5936 stable

* ols.m: Compute rank if needed.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Tue, 07 Feb 2012 11:34:55 -0500
parents de99dde50ee1
children 2cd56a5e3a66
files scripts/statistics/base/ols.m
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/statistics/base/ols.m	Tue Feb 07 11:20:29 2012 -0500
+++ b/scripts/statistics/base/ols.m	Tue Feb 07 11:34:55 2012 -0500
@@ -121,6 +121,14 @@
     r = y - x * beta;
   endif
   if (isargout (2))
+
+    ## z is of full rank, avoid the SVD in rnk
+    if (p == 0)
+      rnk = columns (z);
+    else
+      rnk = rank (z);
+    endif
+
     sigma = r' * r / (nr - rnk);
   endif