Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58877 - in sandbox/numeric_bindings: boost/numeric/bindings/lapack/driver libs/numeric/bindings/lapack/test libs/numeric/bindings/tools/templates/driver
From: thomas.klimpel_at_[hidden]
Date: 2010-01-10 13:55:28


Author: klimpel
Date: 2010-01-10 13:55:27 EST (Sun, 10 Jan 2010)
New Revision: 58877
URL: http://svn.boost.org/trac/boost/changeset/58877

Log:
read fortran code for cgelsd to find out the correct minimum value for LWORK.
- Should we create patches for the "bugs" in the lapack documentation?
- Changed ublas_gelsd.cpp to follow the rule that failing regression tests should report this by a non-zero exist value.
Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/lapack/driver/gelsd.hpp | 15 ++++++++-------
   sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gelsd.cpp | 16 ++++++++++++++++
   sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/driver/gelsd.hpp | 4 ++--
   3 files changed, 26 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 13:55:27 EST (Sun, 10 Jan 2010)
@@ -274,8 +274,8 @@
                 min_size_iwork( minmn, nlvl ));
         BOOST_ASSERT( size(work.select(real_type())) >= min_size_rwork( minmn,
                 smlsiz, nlvl, size_column(b) ));
- BOOST_ASSERT( size(work.select(value_type())) >= min_size_work( minmn,
- size_column(b) ));
+ BOOST_ASSERT( size(work.select(value_type())) >= min_size_work(
+ size_column(a), minmn, size_column(b) ));
         BOOST_ASSERT( size_column(a) >= 0 );
         BOOST_ASSERT( size_column(b) >= 0 );
         BOOST_ASSERT( size_minor(a) == 1 || stride_minor(a) == 1 );
@@ -312,8 +312,8 @@
                 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 );
- bindings::detail::array< value_type > tmp_work( min_size_work( minmn,
- size_column(b) ) );
+ bindings::detail::array< value_type > tmp_work( min_size_work(
+ size_column(a), minmn, size_column(b) ) );
         bindings::detail::array< real_type > tmp_rwork( min_size_rwork( minmn,
                 smlsiz, nlvl, size_column(b) ) );
         bindings::detail::array< fortran_int_t > tmp_iwork(
@@ -354,9 +354,10 @@
     // Static member function that returns the minimum size of
     // workspace-array work.
     //
- static std::ptrdiff_t min_size_work( const std::ptrdiff_t minmn,
- const std::ptrdiff_t nrhs ) {
- return std::max< std::ptrdiff_t >( 1, 2*minmn + minmn*nrhs );
+ static std::ptrdiff_t min_size_work( const std::ptrdiff_t n,
+ const std::ptrdiff_t minmn, const std::ptrdiff_t nrhs ) {
+ return std::max< std::ptrdiff_t >( 1, 2*minmn + std::max<
+ std::ptrdiff_t >( n, minmn*nrhs ) );
     }
 
     //

Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gelsd.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gelsd.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gelsd.cpp 2010-01-10 13:55:27 EST (Sun, 10 Jan 2010)
@@ -55,6 +55,7 @@
         {
                 oss << "sgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End sgelsd tests" << std::endl;
         oss << std::endl;
         oss << "Testing dgelsd" << std::endl;
@@ -62,6 +63,7 @@
         {
                 oss << "dgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End dgelsd tests" << std::endl;
         oss << std::endl;
         oss << "Testing cgelsd" << std::endl;
@@ -69,6 +71,7 @@
         {
                 oss << "cgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End cgelsd tests" << std::endl;
         oss << std::endl;
         oss << "Testing zgelsd" << std::endl;
@@ -76,6 +79,7 @@
         {
                 oss << "zgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End zgelsd tests" << std::endl;
         oss << std::endl;
         oss << "End Square Matrix Least Squares Tests" << std::endl;
@@ -89,6 +93,7 @@
         {
                 oss << "sgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End sgelsd tests" << std::endl;
         oss << std::endl;
         oss << "Testing dgelsd" << std::endl;
@@ -96,6 +101,7 @@
         {
                 oss << "dgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End dgelsd tests" << std::endl;
         oss << std::endl;
         oss << "Testing cgelsd" << std::endl;
@@ -103,6 +109,7 @@
         {
                 oss << "cgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End cgelsd tests" << std::endl;
         oss << std::endl;
         oss << "Testing zgelsd" << std::endl;
@@ -110,6 +117,7 @@
         {
                 oss << "zgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End zgelsd tests" << std::endl;
         oss << std::endl;
         oss << "End Underdetermined Matrix Least Squares Tests" << std::endl;
@@ -123,6 +131,7 @@
         {
                 oss << "sgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End sgelsd tests" << std::endl;
         oss << std::endl;
         oss << "Testing dgelsd" << std::endl;
@@ -130,6 +139,7 @@
         {
                 oss << "dgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End dgelsd tests" << std::endl;
         oss << std::endl;
         oss << "Testing cgelsd" << std::endl;
@@ -137,6 +147,7 @@
         {
                 oss << "cgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End cgelsd tests" << std::endl;
         oss << std::endl;
         oss << "Testing zgelsd" << std::endl;
@@ -144,6 +155,7 @@
         {
                 oss << "zgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End zgelsd tests" << std::endl;
         oss << std::endl;
         oss << "End Overdetermined Matrix Least Squares Test" << std::endl;
@@ -157,6 +169,7 @@
         {
                 oss << "sgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End sgelsd tests" << std::endl;
         oss << std::endl;
         oss << "Testing dgelsd" << std::endl;
@@ -164,6 +177,7 @@
         {
                 oss << "dgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End dgelsd tests" << std::endl;
         oss << std::endl;
         oss << "Testing cgelsd" << std::endl;
@@ -171,6 +185,7 @@
         {
                 oss << "cgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End cgelsd tests" << std::endl;
         oss << std::endl;
         oss << "Testing zgelsd" << std::endl;
@@ -178,6 +193,7 @@
         {
                 oss << "zgelsd passed." << std::endl;
         }
+ else return 255;
         oss << "End zgelsd tests" << std::endl;
         oss << std::endl;
         oss << "End Multiple Solution Vectors Least Squares Test" << std::endl;

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 13:55:27 EST (Sun, 10 Jan 2010)
@@ -14,9 +14,9 @@
 $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 );
 $TEMPLATE[gelsd.complex.min_size_work.args]
-MINMN, NRHS
+N, MINMN, NRHS
 $TEMPLATE[gelsd.complex.min_size_work]
-return std::max< $INTEGER_TYPE >( 1, 2*minmn + minmn*nrhs );
+return std::max< $INTEGER_TYPE >( 1, 2*minmn + std::max< $INTEGER_TYPE >( n, minmn*nrhs ) );
 $TEMPLATE[gelsd.all.min_size_iwork.args]
 MINMN,NLVL
 $TEMPLATE[gelsd.all.min_size_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