|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58862 - in sandbox/numeric_bindings: boost/numeric/bindings/lapack/driver libs/numeric/bindings/tools/templates/driver
From: rutger_at_[hidden]
Date: 2010-01-10 08:15:31
Author: rutger
Date: 2010-01-10 08:15:30 EST (Sun, 10 Jan 2010)
New Revision: 58862
URL: http://svn.boost.org/trac/boost/changeset/58862
Log:
Audited the nlvl computation in gelsd; should be better now. Gelsd still fails in the complex case for minimum size of work, could be a problem in the documentation of e.g. zgelsd, minimum LWORK doesn't seem to be correctly describer (vs. the Fortran code).
Text files modified:
sandbox/numeric_bindings/boost/numeric/bindings/lapack/driver/gelsd.hpp | 20 ++++++++++++--------
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gelsd.hpp | 2 +-
2 files changed, 13 insertions(+), 9 deletions(-)
Modified: sandbox/numeric_bindings/boost/numeric/bindings/lapack/driver/gelsd.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/lapack/driver/gelsd.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/lapack/driver/gelsd.hpp 2010-01-10 08:15:30 EST (Sun, 10 Jan 2010)
@@ -134,9 +134,10 @@
std::ptrdiff_t minmn = std::min< std::ptrdiff_t >( size_row(a),
size_column(a) );
std::ptrdiff_t smlsiz = ilaenv(9, "GELSD", "");
- std::ptrdiff_t nlvl = static_cast<std::ptrdiff_t>(std::log(
+ std::ptrdiff_t nlvl = std::max<
+ std::ptrdiff_t >( static_cast<std::ptrdiff_t>(std::log(
static_cast<real_type>(minmn)/static_cast<real_type>(smlsiz+
- 1))/std::log(2.0)) + 1;
+ 1))/std::log(2.0)) + 1, 0 );
BOOST_ASSERT( size(s) >= std::min< std::ptrdiff_t >(size_row(a),
size_column(a)) );
BOOST_ASSERT( size(work.select(fortran_int_t())) >=
@@ -174,9 +175,10 @@
std::ptrdiff_t minmn = std::min< std::ptrdiff_t >( size_row(a),
size_column(a) );
std::ptrdiff_t smlsiz = ilaenv(9, "GELSD", "");
- std::ptrdiff_t nlvl = static_cast<std::ptrdiff_t>(std::log(
+ std::ptrdiff_t nlvl = std::max<
+ std::ptrdiff_t >( static_cast<std::ptrdiff_t>(std::log(
static_cast<real_type>(minmn)/static_cast<real_type>(smlsiz+
- 1))/std::log(2.0)) + 1;
+ 1))/std::log(2.0)) + 1, 0 );
bindings::detail::array< real_type > tmp_work( min_size_work( minmn,
smlsiz, nlvl, size_column(b) ) );
bindings::detail::array< fortran_int_t > tmp_iwork(
@@ -262,9 +264,10 @@
std::ptrdiff_t minmn = std::min< std::ptrdiff_t >( size_row(a),
size_column(a) );
std::ptrdiff_t smlsiz = ilaenv(9, "GELSD", "");
- std::ptrdiff_t nlvl = static_cast<std::ptrdiff_t>(std::log(
+ std::ptrdiff_t nlvl = std::max<
+ std::ptrdiff_t >( static_cast<std::ptrdiff_t>(std::log(
static_cast<real_type>(minmn)/static_cast<real_type>(smlsiz+
- 1))/std::log(2.0)) + 1;
+ 1))/std::log(2.0)) + 1, 0 );
BOOST_ASSERT( size(s) >= std::min< std::ptrdiff_t >(size_row(a),
size_column(a)) );
BOOST_ASSERT( size(work.select(fortran_int_t())) >=
@@ -305,9 +308,10 @@
std::ptrdiff_t minmn = std::min< std::ptrdiff_t >( size_row(a),
size_column(a) );
std::ptrdiff_t smlsiz = ilaenv(9, "GELSD", "");
- std::ptrdiff_t nlvl = static_cast<std::ptrdiff_t>(std::log(
+ std::ptrdiff_t nlvl = std::max<
+ std::ptrdiff_t >( static_cast<std::ptrdiff_t>(std::log(
static_cast<real_type>(minmn)/static_cast<real_type>(smlsiz+
- 1))/std::log(2.0)) + 1;
+ 1))/std::log(2.0)) + 1, 0 );
bindings::detail::array< value_type > tmp_work( min_size_work( minmn,
size_column(b) ) );
bindings::detail::array< real_type > tmp_rwork( min_size_rwork( minmn,
Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gelsd.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gelsd.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gelsd.hpp 2010-01-10 08:15:30 EST (Sun, 10 Jan 2010)
@@ -9,7 +9,7 @@
$TEMPLATE[gelsd.all.SMLSIZ.init]
$INTEGER_TYPE smlsiz = ilaenv(9, "GELSD", "");
$TEMPLATE[gelsd.all.NLVL.init]
-$INTEGER_TYPE nlvl = static_cast<$INTEGER_TYPE>(std::log(static_cast<real_type>(minmn)/static_cast<real_type>(smlsiz+1))/std::log(2.0)) + 1;
+$INTEGER_TYPE nlvl = std::max< $INTEGER_TYPE >( static_cast<$INTEGER_TYPE>(std::log(static_cast<real_type>(minmn)/static_cast<real_type>(smlsiz+1))/std::log(2.0)) + 1, 0 );
$TEMPLATE[gelsd.complex.min_size_rwork]
$INTEGER_TYPE smlsiz_plus_one = smlsiz + 1;
return std::max< $INTEGER_TYPE >( 1, 10*minmn + 2*minmn*smlsiz + 8*minmn*nlvl + 3*smlsiz*nrhs + smlsiz_plus_one * smlsiz_plus_one );
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk