changeset 7532:493bb0de3199

avoid another xGELSD workspace query bug
author John W. Eaton <jwe@octave.org>
date Tue, 26 Feb 2008 02:47:56 -0500
parents c9a476b1e664
children ff52243af934
files liboctave/CMatrix.cc liboctave/ChangeLog liboctave/dMatrix.cc
diffstat 3 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/CMatrix.cc	Tue Feb 26 02:16:32 2008 -0500
+++ b/liboctave/CMatrix.cc	Tue Feb 26 02:47:56 2008 -0500
@@ -2486,6 +2486,13 @@
 	  if (std::real (work(0)) < lworkaround)
 	    work(0) = lworkaround;
 	}
+      else if (m >= n)
+	{
+	  octave_idx_type lworkaround = 2*m + m*nrhs;
+
+	  if (std::real (work(0)) < lworkaround)
+	    work(0) = lworkaround;
+	}
 
       lwork = static_cast<octave_idx_type> (std::real (work(0)));
       work.resize (lwork);
--- a/liboctave/ChangeLog	Tue Feb 26 02:16:32 2008 -0500
+++ b/liboctave/ChangeLog	Tue Feb 26 02:47:56 2008 -0500
@@ -1,3 +1,8 @@
+2008-02-26  John W. Eaton  <jwe@octave.org>
+
+	* dMatrix.cc (Matrix::lssolve): Avoid another dgelsd lwork query bug.
+	* CMatrix.cc (ComplexMatrix::lssolve): Likewise, for zgelsd
+
 2008-02-24  John W. Eaton  <jwe@octave.org>
 
 	* oct-inttypes.h (octave_int_helper): New class.  Provide
--- a/liboctave/dMatrix.cc	Tue Feb 26 02:16:32 2008 -0500
+++ b/liboctave/dMatrix.cc	Tue Feb 26 02:47:56 2008 -0500
@@ -2095,6 +2095,14 @@
 	  if (work(0) < lworkaround)
 	    work(0) = lworkaround;
 	}
+      else if (m >= n)
+	{
+	  octave_idx_type lworkaround
+	    = 12*n + 2*n*smlsiz + 8*n*nlvl + n*nrhs + (smlsiz+1)*(smlsiz+1);
+
+	  if (work(0) < lworkaround)
+	    work(0) = lworkaround;
+	}
 
       lwork = static_cast<octave_idx_type> (work(0));
       work.resize (lwork);