|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58463 - sandbox/numeric_bindings/libs/numeric/bindings/lapack/test
From: thomas.klimpel_at_[hidden]
Date: 2009-12-18 18:21:38
Author: klimpel
Date: 2009-12-18 18:21:37 EST (Fri, 18 Dec 2009)
New Revision: 58463
URL: http://svn.boost.org/trac/boost/changeset/58463
Log:
Continue of regression tests update
Text files modified:
sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hbev.cpp | 2
sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hbevx.cpp | 2
sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_heev.cpp | 2
sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_heevd.cpp | 2
sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_heevx.cpp | 2
sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hegv.cpp | 55 +++++++++++++++++++++++++++++++--------
sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_syev.cpp | 2
7 files changed, 49 insertions(+), 18 deletions(-)
Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hbev.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hbev.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hbev.cpp 2009-12-18 18:21:37 EST (Fri, 18 Dec 2009)
@@ -179,7 +179,7 @@
std::cout << " workspace array\n";
Workspace<T> work( n );
- do_memory_type<T,typename Workspace<T>::type >( n, work() );
+ if (do_memory_type<T,typename Workspace<T>::type >( n, work() ) ) return 255 ;
return 0;
} // do_value_type()
Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hbevx.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hbevx.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hbevx.cpp 2009-12-18 18:21:37 EST (Fri, 18 Dec 2009)
@@ -205,7 +205,7 @@
std::cout << " workspace array\n";
Workspace<T> work( n );
- do_memory_type<T,typename Workspace<T>::type >( n, work() );
+ if (do_memory_type<T,typename Workspace<T>::type >( n, work() ) ) return 255 ;
return 0;
} // do_value_type()
Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_heev.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_heev.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_heev.cpp 2009-12-18 18:21:37 EST (Fri, 18 Dec 2009)
@@ -112,7 +112,7 @@
std::cout << " workspace array\n";
Workspace<T> work( n );
- do_memory_type<T,typename Workspace<T>::type >( n, work() );
+ if (do_memory_type<T,typename Workspace<T>::type >( n, work() ) ) return 255 ;
return 0;
} // do_value_type()
Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_heevd.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_heevd.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_heevd.cpp 2009-12-18 18:21:37 EST (Fri, 18 Dec 2009)
@@ -157,7 +157,7 @@
std::cout << " workspace array\n";
Workspace<T> work( n );
- do_memory_type<T,typename Workspace<T>::type >( n, work() );
+ if (do_memory_type<T,typename Workspace<T>::type >( n, work() ) ) return 255 ;
return 0;
} // do_value_type()
Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_heevx.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_heevx.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_heevx.cpp 2009-12-18 18:21:37 EST (Fri, 18 Dec 2009)
@@ -184,7 +184,7 @@
std::cout << " workspace array\n";
Workspace<T> work( n );
- do_memory_type<T,typename Workspace<T>::type >( n, work() );
+ if (do_memory_type<T,typename Workspace<T>::type >( n, work() ) ) return 255 ;
return 0;
} // do_value_type()
Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hegv.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hegv.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_hegv.cpp 2009-12-18 18:21:37 EST (Fri, 18 Dec 2009)
@@ -8,25 +8,52 @@
#include "ublas_heev.hpp"
-#include <boost/numeric/bindings/lapack/hegv.hpp>
+#include <boost/numeric/bindings/lapack/driver/hegv.hpp>
+#include <boost/numeric/bindings/lapack/driver/sygv.hpp>
#include <boost/numeric/bindings/traits/ublas_matrix.hpp>
+#include <boost/numeric/bindings/traits/ublas_hermitian.hpp>
#include <boost/numeric/bindings/traits/ublas_vector.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
+#include <boost/type_traits/is_complex.hpp>
+#include <boost/mpl/if.hpp>
#include <iostream>
namespace ublas = boost::numeric::ublas;
namespace lapack = boost::numeric::bindings::lapack;
+namespace traits = boost::numeric::bindings::traits;
+
+struct apply_real {
+ template< typename MatrixA, typename MatrixB, typename VectorW,
+ typename Workspace >
+ static inline integer_t hegv( const integer_t itype, const char jobz,
+ const integer_t n, MatrixA& a, MatrixB& b, VectorW& w,
+ Workspace work ) {
+ return lapack::sygv( itype, jobz, n, a, b, w, work );
+ }
+};
+
+struct apply_complex {
+ template< typename MatrixA, typename MatrixB, typename VectorW,
+ typename Workspace >
+ static inline integer_t hegv( const integer_t itype, const char jobz,
+ const integer_t n, MatrixA& a, MatrixB& b, VectorW& w,
+ Workspace work ) {
+ return lapack::hegv( itype, jobz, n, a, b, w, work );
+ }
+};
-template <typename T, typename W, char UPLO>
+template <typename T, typename W, typename UPLO>
int do_memory_uplo(int n, W& workspace ) {
+ typedef typename boost::mpl::if_<boost::is_complex<T>, apply_complex, apply_real>::type apply_t;
typedef typename boost::numeric::bindings::traits::type_traits<T>::real_type real_type ;
typedef ublas::matrix<T, ublas::column_major> matrix_type ;
+ typedef ublas::hermitian_adaptor<matrix_type, UPLO> hermitian_type ;
typedef ublas::vector<real_type> vector_type ;
// Set matrix
@@ -41,24 +68,28 @@
for (int i = 0; i < n; ++i) b(i,i) = 1;
// Compute eigen decomposition.
- lapack::hegv( 1, 'V', UPLO, a, b, e1, workspace ) ;
+ hermitian_type h_a( a );
+ apply_t::hegv( 1, 'V', traits::matrix_size2( h_a ), h_a, b, e1, workspace ) ;
if (check_residual( a2, e1, a )) return 255 ;
- lapack::hegv( 1, 'N', UPLO, a2, b, e2, workspace ) ;
+ hermitian_type h_a2( a2 );
+ apply_t::hegv( 1, 'N', traits::matrix_size2( h_a2 ), h_a2 , b, e2, workspace ) ;
if (norm_2( e1 - e2 ) > n * norm_2( e1 ) * std::numeric_limits< real_type >::epsilon()) return 255 ;
// Test for a matrix range
fill( a ); a2.assign( a );
typedef ublas::matrix_range< matrix_type > matrix_range ;
+ typedef ublas::hermitian_adaptor<matrix_range, UPLO> hermitian_range_type ;
ublas::range r(1,n-1) ;
matrix_range a_r( a, r, r );
ublas::vector_range< vector_type> e_r( e1, r );
matrix_range b_r( b, r, r );
- lapack::hegv(1, 'V', UPLO, a_r, b_r, e_r, workspace );
+ hermitian_range_type h_a_r( a_r );
+ apply_t::hegv(1, 'V', traits::matrix_size2( h_a_r ), h_a_r, b_r, e_r, workspace );
matrix_range a2_r( a2, r, r );
if (check_residual( a2_r, e_r, a_r )) return 255 ;
@@ -70,9 +101,9 @@
template <typename T, typename W>
int do_memory_type(int n, W workspace) {
std::cout << " upper\n" ;
- if (do_memory_uplo<T,W,'U'>(n, workspace)) return 255 ;
+ if (do_memory_uplo<T,W,ublas::upper>(n, workspace)) return 255 ;
std::cout << " lower\n" ;
- if (do_memory_uplo<T,W,'L'>(n, workspace)) return 255 ;
+ if (do_memory_uplo<T,W,ublas::lower>(n, workspace)) return 255 ;
return 0 ;
}
@@ -124,7 +155,7 @@
std::cout << " workspace array\n";
Workspace<T> work( n );
- do_memory_type<T,typename Workspace<T>::type >( n, work() );
+ if (do_memory_type<T,typename Workspace<T>::type >( n, work() ) ) return 255 ;
return 0;
} // do_value_type()
@@ -137,11 +168,11 @@
std::cout << "double\n" ;
if (do_value_type<double>()) return 255;
-// std::cout << "complex<float>\n" ;
-// if (do_value_type< std::complex<float> >()) return 255;
+ std::cout << "complex<float>\n" ;
+ if (do_value_type< std::complex<float> >()) return 255;
-// std::cout << "complex<double>\n" ;
-// if (do_value_type< std::complex<double> >()) return 255;
+ std::cout << "complex<double>\n" ;
+ if (do_value_type< std::complex<double> >()) return 255;
std::cout << "Regression test succeeded\n" ;
return 0;
Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_syev.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_syev.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_syev.cpp 2009-12-18 18:21:37 EST (Fri, 18 Dec 2009)
@@ -127,7 +127,7 @@
std::cout << " workspace array\n";
Workspace<T> work( n );
- do_memory_type<T,typename Workspace<T>::type >( n, work() );
+ if (do_memory_type<T,typename Workspace<T>::type >( n, work() ) ) return 255 ;
return 0;
} // do_value_type()
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