Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58484 - in sandbox/numeric_bindings: boost/numeric/bindings/lapack/detail boost/numeric/bindings/lapack/driver libs/numeric/bindings/lapack/test libs/numeric/bindings/tools/templates
From: thomas.klimpel_at_[hidden]
Date: 2009-12-21 18:05:31


Author: klimpel
Date: 2009-12-21 18:05:30 EST (Mon, 21 Dec 2009)
New Revision: 58484
URL: http://svn.boost.org/trac/boost/changeset/58484

Log:
Continue of regression tests update
(gelsd required hand editing, because of an inconsistency between optimal and minimal workspace)
Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/lapack/detail/lapack_names.h | 6 +++++
   sandbox/numeric_bindings/boost/numeric/bindings/lapack/driver/gelsd.hpp | 6 +++++
   sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gels.cpp | 2
   sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gelsd.cpp | 43 +++++++++++++++++++++++++++++++--------
   sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gelss.cpp | 43 +++++++++++++++++++++++++++++++--------
   sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/singleton_lapack.hpp | 8 ++++++
   6 files changed, 88 insertions(+), 20 deletions(-)

Modified: sandbox/numeric_bindings/boost/numeric/bindings/lapack/detail/lapack_names.h
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/lapack/detail/lapack_names.h (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/lapack/detail/lapack_names.h 2009-12-21 18:05:30 EST (Mon, 21 Dec 2009)
@@ -1212,5 +1212,11 @@
 #define LAPACK_CLALSD FORTRAN_ID( clalsd )
 #define LAPACK_ZLALSD FORTRAN_ID( zlalsd )
 
+//
+// LAPACK auxiliary routines
+//
+
+#define LAPACK_ILAENV FORTRAN_ID( ilaenv )
+
 #endif
 

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 2009-12-21 18:05:30 EST (Mon, 21 Dec 2009)
@@ -114,11 +114,14 @@
         BOOST_ASSERT( traits::vector_size(s) >= std::min<
                 std::ptrdiff_t >(traits::matrix_num_rows(a),
                 traits::matrix_num_columns(a)) );
+ /*
+ // The following assertions fails for the size returned by the optimal workspace query of lapack 3.1
         BOOST_ASSERT( traits::vector_size(work.select(real_type())) >=
                 min_size_work( minmn, smlsiz, nlvl,
                 traits::matrix_num_columns(b) ));
         BOOST_ASSERT( traits::vector_size(work.select(integer_t())) >=
                 min_size_iwork( minmn, nlvl ));
+ */
         detail::gelsd( traits::matrix_num_rows(a),
                 traits::matrix_num_columns(a), traits::matrix_num_columns(b),
                 traits::matrix_storage(a), traits::leading_dimension(a),
@@ -216,11 +219,14 @@
                 traits::matrix_num_columns(a)) );
         BOOST_ASSERT( traits::vector_size(work.select(value_type())) >=
                 min_size_work( minmn, traits::matrix_num_columns(b) ));
+ /*
+ // The following assertions fails for the size returned by the optimal workspace query of lapack 3.1
         BOOST_ASSERT( traits::vector_size(work.select(real_type())) >=
                 min_size_rwork( minmn, smlsiz, nlvl,
                 traits::matrix_num_columns(b) ));
         BOOST_ASSERT( traits::vector_size(work.select(integer_t())) >=
                 min_size_iwork( minmn, nlvl ));
+ */
         detail::gelsd( traits::matrix_num_rows(a),
                 traits::matrix_num_columns(a), traits::matrix_num_columns(b),
                 traits::matrix_storage(a), traits::leading_dimension(a),

Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gels.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gels.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gels.cpp 2009-12-21 18:05:30 EST (Mon, 21 Dec 2009)
@@ -7,7 +7,7 @@
 //
 
 #include "convenience.h"
-#include <boost/numeric/bindings/lapack/gels.hpp>
+#include <boost/numeric/bindings/lapack/driver/gels.hpp>
 
 // set to 1 to write test output to file, otherwise outputs to console
 #define OUTPUT_TO_FILE 0

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 2009-12-21 18:05:30 EST (Mon, 21 Dec 2009)
@@ -7,7 +7,7 @@
 //
 
 #include "convenience.h"
-#include <boost/numeric/bindings/lapack/gelsd.hpp>
+#include <boost/numeric/bindings/lapack/driver/gelsd.hpp>
 
 // set to 1 to write test output to file, otherwise outputs to console
 #define OUTPUT_TO_FILE 0
@@ -23,6 +23,7 @@
 #define USE_MINIMAL_WORKSPACE 1
 
 namespace lapack = boost::numeric::bindings::lapack;
+namespace traits = boost::numeric::bindings::traits;
 
 // test function declarations
 template <typename StreamType, typename MatrType, typename VecType>
@@ -219,6 +220,11 @@
 template <typename StreamType, typename MatType, typename VecType>
 int test_square_gelsd(StreamType& oss)
 {
+ typedef typename traits::matrix_traits<MatType>::value_type val_t;
+ typedef typename traits::type_traits<val_t>::real_type real_t;
+ const real_t rcond = -1; // use machine precision
+ integer_t rank;
+
         // return value
         int err = 0;
 
@@ -228,18 +234,19 @@
         
         //const int m = traits::matrix_size1(mat);
         const int n = traits::matrix_size2(mat);
+ traits::detail::array<real_t> s(n);
 
 #if USE_OPTIMAL_WORKSPACE
         MatType optimalmat(mat);
         VecType optimalvec(vec);
- err += lapack::gelsd(optimalmat, optimalvec, lapack::optimal_workspace());
+ err += lapack::gelsd(optimalmat, optimalvec, s, rcond, rank, lapack::optimal_workspace());
         VecType optimalanswer(ublas::project(optimalvec, ublas::range(0, n)));
         VecType optimal_check = ublas::prod(mat, optimalanswer);
 #endif
 #if USE_MINIMAL_WORKSPACE
         MatType minimalmat(mat);
         VecType minimalvec(vec);
- err += lapack::gelsd(minimalmat, minimalvec, lapack::minimal_workspace());
+ err += lapack::gelsd(minimalmat, minimalvec, s, rcond, rank, lapack::minimal_workspace());
         VecType minimalanswer(ublas::project(minimalvec, ublas::range(0, n)));
         VecType minimal_check = ublas::prod(mat, minimalanswer);
 #endif
@@ -274,6 +281,11 @@
 template <typename StreamType, typename MatType, typename VecType>
 int test_under_gelsd(StreamType& oss)
 {
+ typedef typename traits::matrix_traits<MatType>::value_type val_t;
+ typedef typename traits::type_traits<val_t>::real_type real_t;
+ const real_t rcond = -1; // use machine precision
+ integer_t rank;
+
         // return value
         int err = 0;
 
@@ -283,18 +295,19 @@
 
         //const int m = traits::matrix_size1(mat);
         const int n = traits::matrix_size2(mat);
+ traits::detail::array<real_t> s(n);
 
 #if USE_OPTIMAL_WORKSPACE
         MatType optimalmat(mat);
         VecType optimalvec(vec);
- err += lapack::gelsd(optimalmat, optimalvec, lapack::optimal_workspace());
+ err += lapack::gelsd(optimalmat, optimalvec, s, rcond, rank, lapack::optimal_workspace());
         VecType optimalanswer(ublas::project(optimalvec, ublas::range(0, n)));
         VecType optimal_check = ublas::prod(mat, optimalanswer);
 #endif
 #if USE_MINIMAL_WORKSPACE
         MatType minimalmat(mat);
         VecType minimalvec(vec);
- err += lapack::gelsd(minimalmat, minimalvec, lapack::minimal_workspace());
+ err += lapack::gelsd(minimalmat, minimalvec, s, rcond, rank, lapack::minimal_workspace());
         VecType minimalanswer(ublas::project(minimalvec, ublas::range(0, n)));
         VecType minimal_check = ublas::prod(mat, minimalanswer);
 #endif
@@ -329,6 +342,11 @@
 template <typename StreamType, typename MatType, typename VecType>
 int test_over_gelsd(StreamType& oss)
 {
+ typedef typename traits::matrix_traits<MatType>::value_type val_t;
+ typedef typename traits::type_traits<val_t>::real_type real_t;
+ const real_t rcond = -1; // use machine precision
+ integer_t rank;
+
         // return value
         int err = 0;
 
@@ -338,18 +356,19 @@
 
         //const int m = traits::matrix_size1(mat);
         const int n = traits::matrix_size2(mat);
+ traits::detail::array<real_t> s(n);
 
 #if USE_OPTIMAL_WORKSPACE
         MatType optimalmat(mat);
         VecType optimalvec(vec);
- err += lapack::gelsd(optimalmat, optimalvec, lapack::optimal_workspace());
+ err += lapack::gelsd(optimalmat, optimalvec, s, rcond, rank, lapack::optimal_workspace());
         VecType optimalanswer(ublas::project(optimalvec, ublas::range(0, n)));
         VecType optimal_check = ublas::prod(mat, optimalanswer);
 #endif
 #if USE_MINIMAL_WORKSPACE
         MatType minimalmat(mat);
         VecType minimalvec(vec);
- err += lapack::gelsd(minimalmat, minimalvec, lapack::minimal_workspace());
+ err += lapack::gelsd(minimalmat, minimalvec, s, rcond, rank, lapack::minimal_workspace());
         VecType minimalanswer(ublas::project(minimalvec, ublas::range(0, n)));
         VecType minimal_check = ublas::prod(mat, minimalanswer);
 #endif
@@ -384,6 +403,11 @@
 template <typename StreamType, typename MatType, typename VecType>
 int test_multiple_gelsd(StreamType& oss)
 {
+ typedef typename traits::matrix_traits<MatType>::value_type val_t;
+ typedef typename traits::type_traits<val_t>::real_type real_t;
+ const real_t rcond = -1; // use machine precision
+ integer_t rank;
+
         // return value
         int err = 0;
 
@@ -396,18 +420,19 @@
         //const int m = traits::matrix_size1(mat);
         const int n = traits::matrix_size2(mat);
         const int nrhs = traits::matrix_size2(vec);
+ traits::detail::array<real_t> s(n);
 
 #if USE_OPTIMAL_WORKSPACE
         MatType optimalmat(mat);
         MatType optimalvec(vec);
- err += lapack::gelsd(optimalmat, optimalvec, lapack::optimal_workspace());
+ err += lapack::gelsd(optimalmat, optimalvec, s, rcond, rank, lapack::optimal_workspace());
         MatType optimalanswer(ublas::project(optimalvec, ublas::range(0, n), ublas::range(0, nrhs)));
         MatType optimal_check = ublas::prod(mat, optimalanswer);
 #endif
 #if USE_MINIMAL_WORKSPACE
         MatType minimalmat(mat);
         MatType minimalvec(vec);
- err += lapack::gelsd(minimalmat, minimalvec, lapack::minimal_workspace());
+ err += lapack::gelsd(minimalmat, minimalvec, s, rcond, rank, lapack::minimal_workspace());
         MatType minimalanswer(ublas::project(minimalvec, ublas::range(0, n), ublas::range(0, nrhs)));
         MatType minimal_check = ublas::prod(mat, minimalanswer);
 #endif

Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gelss.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gelss.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_gelss.cpp 2009-12-21 18:05:30 EST (Mon, 21 Dec 2009)
@@ -7,7 +7,7 @@
 //
 
 #include "convenience.h"
-#include <boost/numeric/bindings/lapack/gelss.hpp>
+#include <boost/numeric/bindings/lapack/driver/gelss.hpp>
 
 // set to 1 to write test output to file, otherwise outputs to console
 #define OUTPUT_TO_FILE 0
@@ -23,6 +23,7 @@
 #define USE_MINIMAL_WORKSPACE 1
 
 namespace lapack = boost::numeric::bindings::lapack;
+namespace traits = boost::numeric::bindings::traits;
 
 // test function declarations
 template <typename StreamType, typename MatrType, typename VecType>
@@ -219,6 +220,11 @@
 template <typename StreamType, typename MatType, typename VecType>
 int test_square_gelss(StreamType& oss)
 {
+ typedef typename traits::matrix_traits<MatType>::value_type val_t;
+ typedef typename traits::type_traits<val_t>::real_type real_t;
+ const real_t rcond = -1; // use machine precision
+ integer_t rank;
+
         // return value
         int err = 0;
 
@@ -228,18 +234,19 @@
 
         //const int m = traits::matrix_size1(mat);
         const int n = traits::matrix_size2(mat);
+ traits::detail::array<real_t> s(n);
 
 #if USE_OPTIMAL_WORKSPACE
         MatType optimalmat(mat);
         VecType optimalvec(vec);
- err += lapack::gelss(optimalmat, optimalvec, lapack::optimal_workspace());
+ err += lapack::gelss(optimalmat, optimalvec, s, rcond, rank, lapack::optimal_workspace());
         VecType optimalanswer(ublas::project(optimalvec, ublas::range(0, n)));
         VecType optimal_check = ublas::prod(mat, optimalanswer);
 #endif
 #if USE_MINIMAL_WORKSPACE
         MatType minimalmat(mat);
         VecType minimalvec(vec);
- err += lapack::gelss(minimalmat, minimalvec, lapack::minimal_workspace());
+ err += lapack::gelss(minimalmat, minimalvec, s, rcond, rank, lapack::minimal_workspace());
         VecType minimalanswer(ublas::project(minimalvec, ublas::range(0, n)));
         VecType minimal_check = ublas::prod(mat, minimalanswer);
 #endif
@@ -274,6 +281,11 @@
 template <typename StreamType, typename MatType, typename VecType>
 int test_under_gelss(StreamType& oss)
 {
+ typedef typename traits::matrix_traits<MatType>::value_type val_t;
+ typedef typename traits::type_traits<val_t>::real_type real_t;
+ const real_t rcond = -1; // use machine precision
+ integer_t rank;
+
         // return value
         int err = 0;
 
@@ -283,18 +295,19 @@
 
         //const int m = traits::matrix_size1(mat);
         const int n = traits::matrix_size2(mat);
+ traits::detail::array<real_t> s(n);
 
 #if USE_OPTIMAL_WORKSPACE
         MatType optimalmat(mat);
         VecType optimalvec(vec);
- err += lapack::gelss(optimalmat, optimalvec, lapack::optimal_workspace());
+ err += lapack::gelss(optimalmat, optimalvec, s, rcond, rank, lapack::optimal_workspace());
         VecType optimalanswer(ublas::project(optimalvec, ublas::range(0, n)));
         VecType optimal_check = ublas::prod(mat, optimalanswer);
 #endif
 #if USE_MINIMAL_WORKSPACE
         MatType minimalmat(mat);
         VecType minimalvec(vec);
- err += lapack::gelss(minimalmat, minimalvec, lapack::minimal_workspace());
+ err += lapack::gelss(minimalmat, minimalvec, s, rcond, rank, lapack::minimal_workspace());
         VecType minimalanswer(ublas::project(minimalvec, ublas::range(0, n)));
         VecType minimal_check = ublas::prod(mat, minimalanswer);
 #endif
@@ -329,6 +342,11 @@
 template <typename StreamType, typename MatType, typename VecType>
 int test_over_gelss(StreamType& oss)
 {
+ typedef typename traits::matrix_traits<MatType>::value_type val_t;
+ typedef typename traits::type_traits<val_t>::real_type real_t;
+ const real_t rcond = -1; // use machine precision
+ integer_t rank;
+
         // return value
         int err = 0;
 
@@ -338,18 +356,19 @@
 
         //const int m = traits::matrix_size1(mat);
         const int n = traits::matrix_size2(mat);
+ traits::detail::array<real_t> s(n);
 
 #if USE_OPTIMAL_WORKSPACE
         MatType optimalmat(mat);
         VecType optimalvec(vec);
- err += lapack::gelss(optimalmat, optimalvec, lapack::optimal_workspace());
+ err += lapack::gelss(optimalmat, optimalvec, s, rcond, rank, lapack::optimal_workspace());
         VecType optimalanswer(ublas::project(optimalvec, ublas::range(0, n)));
         VecType optimal_check = ublas::prod(mat, optimalanswer);
 #endif
 #if USE_MINIMAL_WORKSPACE
         MatType minimalmat(mat);
         VecType minimalvec(vec);
- err += lapack::gelss(minimalmat, minimalvec, lapack::minimal_workspace());
+ err += lapack::gelss(minimalmat, minimalvec, s, rcond, rank, lapack::minimal_workspace());
         VecType minimalanswer(ublas::project(minimalvec, ublas::range(0, n)));
         VecType minimal_check = ublas::prod(mat, minimalanswer);
 #endif
@@ -384,6 +403,11 @@
 template <typename StreamType, typename MatType, typename VecType>
 int test_multiple_gelss(StreamType& oss)
 {
+ typedef typename traits::matrix_traits<MatType>::value_type val_t;
+ typedef typename traits::type_traits<val_t>::real_type real_t;
+ const real_t rcond = -1; // use machine precision
+ integer_t rank;
+
         // return value
         int err = 0;
 
@@ -396,18 +420,19 @@
         //const int m = traits::matrix_size1(mat);
         const int n = traits::matrix_size2(mat);
         const int nrhs = traits::matrix_size2(vec);
+ traits::detail::array<real_t> s(n);
 
 #if USE_OPTIMAL_WORKSPACE
         MatType optimalmat(mat);
         MatType optimalvec(vec);
- err += lapack::gelss(optimalmat, optimalvec, lapack::optimal_workspace());
+ err += lapack::gelss(optimalmat, optimalvec, s, rcond, rank, lapack::optimal_workspace());
         MatType optimalanswer(ublas::project(optimalvec, ublas::range(0, n), ublas::range(0, nrhs)));
         MatType optimal_check = ublas::prod(mat, optimalanswer);
 #endif
 #if USE_MINIMAL_WORKSPACE
         MatType minimalmat(mat);
         MatType minimalvec(vec);
- err += lapack::gelss(minimalmat, minimalvec, lapack::minimal_workspace());
+ err += lapack::gelss(minimalmat, minimalvec, s, rcond, rank, lapack::minimal_workspace());
         MatType minimalanswer(ublas::project(minimalvec, ublas::range(0, n), ublas::range(0, nrhs)));
         MatType minimal_check = ublas::prod(mat, minimalanswer);
 #endif

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/singleton_lapack.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/singleton_lapack.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/singleton_lapack.hpp 2009-12-21 18:05:30 EST (Mon, 21 Dec 2009)
@@ -60,7 +60,13 @@
 # define FORTRAN_ID( id ) id##_
 #endif
 
-$CONTENT#endif
+$CONTENT//
+// LAPACK auxiliary routines
+//
+
+#define LAPACK_ILAENV FORTRAN_ID( ilaenv )
+
+#endif
 
 $TEMPLATE[lapack_names.h_function]
 #define LAPACK_$SUBROUTINE FORTRAN_ID( $subroutine )


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