|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58907 - sandbox/numeric_bindings/boost/numeric/bindings/lapack/driver
From: rutger_at_[hidden]
Date: 2010-01-11 08:50:42
Author: rutger
Date: 2010-01-11 08:50:41 EST (Mon, 11 Jan 2010)
New Revision: 58907
URL: http://svn.boost.org/trac/boost/changeset/58907
Log:
Removed opt workspace queries for min sizes done by complex variant of gelsd
Text files modified:
sandbox/numeric_bindings/boost/numeric/bindings/lapack/driver/gelsd.hpp | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 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-11 08:50:41 EST (Mon, 11 Jan 2010)
@@ -218,6 +218,13 @@
static std::ptrdiff_t invoke( MatrixA& a, MatrixB& b, VectorS& s,
const real_type rcond, fortran_int_t& rank,
optimal_workspace work ) {
+ 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 = 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, 0 );
real_type opt_size_work;
bindings::detail::array< fortran_int_t > tmp_iwork(
min_size_iwork( minmn, nlvl ) );
@@ -353,19 +360,24 @@
static std::ptrdiff_t invoke( MatrixA& a, MatrixB& b, VectorS& s,
const real_type rcond, fortran_int_t& rank,
optimal_workspace work ) {
+ 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 = 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, 0 );
value_type opt_size_work;
- real_type opt_size_rwork;
- fortran_int_t opt_size_iwork;
+ bindings::detail::array< real_type > tmp_rwork( min_size_rwork( minmn,
+ smlsiz, nlvl, size_column(b) ) );
+ bindings::detail::array< fortran_int_t > tmp_iwork(
+ min_size_iwork( minmn, nlvl ) );
detail::gelsd( size_row(a), size_column(a), size_column(b),
begin_value(a), stride_major(a), begin_value(b),
stride_major(b), begin_value(s), rcond, rank, &opt_size_work,
- -1, &opt_size_rwork, &opt_size_iwork );
+ -1, begin_value(tmp_rwork), begin_value(tmp_iwork) );
bindings::detail::array< value_type > tmp_work(
traits::detail::to_int( opt_size_work ) );
- bindings::detail::array< real_type > tmp_rwork(
- traits::detail::to_int( opt_size_rwork ) );
- bindings::detail::array< fortran_int_t > tmp_iwork(
- opt_size_iwork );
return invoke( a, b, s, rcond, rank, workspace( tmp_work, tmp_rwork,
tmp_iwork ) );
}
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