# HG changeset patch # User Jaroslav Hajek # Date 1204479144 -3600 # Node ID 7775dab817aa07623fd28ed913828bbeb7735672 # Parent b84c5cbc081243fabec4026636f0c947c587c372 more xGELSD workspace fixes diff -r b84c5cbc0812 -r 7775dab817aa liboctave/CMatrix.cc --- a/liboctave/CMatrix.cc Fri Feb 29 04:09:03 2008 -0500 +++ b/liboctave/CMatrix.cc Sun Mar 02 18:32:24 2008 +0100 @@ -2439,11 +2439,11 @@ ComplexMatrix::lssolve (const ComplexMat double dminmn = static_cast (minmn); double dsmlsizp1 = static_cast (smlsiz+1); #if defined (HAVE_LOG2) - double tmp = log2 (dminmn) / dsmlsizp1 + 1; + double tmp = log2 (dminmn / dsmlsizp1); #else - double tmp = log (dminmn) / dsmlsizp1 / log (2.0) + 1; + double tmp = log (dminmn / dsmlsizp1) / log (2.0); #endif - octave_idx_type nlvl = static_cast (tmp); + octave_idx_type nlvl = static_cast (tmp) + 1; if (nlvl < 0) nlvl = 0; @@ -2620,8 +2620,12 @@ ComplexMatrix::lssolve (const ComplexCol Array work (1); - // FIXME: Can SMLSIZ be other than 25? - octave_idx_type smlsiz = 25; + octave_idx_type smlsiz; + F77_FUNC (xilaenv, XILAENV) (9, F77_CONST_CHAR_ARG2 ("ZGELSD", 6), + F77_CONST_CHAR_ARG2 (" ", 1), + 0, 0, 0, 0, smlsiz + F77_CHAR_ARG_LEN (6) + F77_CHAR_ARG_LEN (1)); // We compute the size of rwork and iwork because ZGELSD in // older versions of LAPACK does not return them on a query @@ -2629,11 +2633,11 @@ ComplexMatrix::lssolve (const ComplexCol double dminmn = static_cast (minmn); double dsmlsizp1 = static_cast (smlsiz+1); #if defined (HAVE_LOG2) - double tmp = log2 (dminmn) / dsmlsizp1 + 1; + double tmp = log2 (dminmn / dsmlsizp1); #else - double tmp = log (dminmn) / dsmlsizp1 / log (2.0) + 1; + double tmp = log (dminmn / dsmlsizp1) / log (2.0); #endif - octave_idx_type nlvl = static_cast (tmp); + octave_idx_type nlvl = static_cast (tmp) + 1; if (nlvl < 0) nlvl = 0; diff -r b84c5cbc0812 -r 7775dab817aa liboctave/dMatrix.cc --- a/liboctave/dMatrix.cc Fri Feb 29 04:09:03 2008 -0500 +++ b/liboctave/dMatrix.cc Sun Mar 02 18:32:24 2008 +0100 @@ -2231,19 +2231,23 @@ Matrix::lssolve (const ColumnVector& b, Array work (1); - // FIXME: Can SMLSIZ be other than 25? - octave_idx_type smlsiz = 25; + octave_idx_type smlsiz; + F77_FUNC (xilaenv, XILAENV) (9, F77_CONST_CHAR_ARG2 ("DGELSD", 6), + F77_CONST_CHAR_ARG2 (" ", 1), + 0, 0, 0, 0, smlsiz + F77_CHAR_ARG_LEN (6) + F77_CHAR_ARG_LEN (1)); // We compute the size of iwork because DGELSD in older versions // of LAPACK does not return it on a query call. double dminmn = static_cast (minmn); double dsmlsizp1 = static_cast (smlsiz+1); #if defined (HAVE_LOG2) - double tmp = log2 (dminmn) / dsmlsizp1 + 1; + double tmp = log2 (dminmn / dsmlsizp1); #else - double tmp = log (dminmn) / dsmlsizp1 / log (2.0) + 1; + double tmp = log (dminmn / dsmlsizp1) / log (2.0); #endif - octave_idx_type nlvl = static_cast (tmp); + octave_idx_type nlvl = static_cast (tmp) + 1; if (nlvl < 0) nlvl = 0;