|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58464 - in sandbox/numeric_bindings: boost/numeric/bindings/lapack/computational libs/numeric/bindings/lapack/test libs/numeric/bindings/tools/templates/computational
From: thomas.klimpel_at_[hidden]
Date: 2009-12-19 17:52:59
Author: klimpel
Date: 2009-12-19 17:52:58 EST (Sat, 19 Dec 2009)
New Revision: 58464
URL: http://svn.boost.org/trac/boost/changeset/58464
Log:
Continue of regression tests update
Added:
sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/computational/geqrf.hpp (contents, props changed)
Text files modified:
sandbox/numeric_bindings/boost/numeric/bindings/lapack/computational/geqrf.hpp | 16 ++++++------
sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_geqrf.cpp | 46 +++++++++++++++++++++++++++++++++++----
2 files changed, 49 insertions(+), 13 deletions(-)
Modified: sandbox/numeric_bindings/boost/numeric/bindings/lapack/computational/geqrf.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/lapack/computational/geqrf.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/lapack/computational/geqrf.hpp 2009-12-19 17:52:58 EST (Sat, 19 Dec 2009)
@@ -90,7 +90,7 @@
std::ptrdiff_t >(traits::matrix_num_rows(a),
traits::matrix_num_columns(a)) );
BOOST_ASSERT( traits::vector_size(work.select(real_type())) >=
- min_size_work( $CALL_MIN_SIZE ));
+ min_size_work( traits::matrix_num_columns(a) ));
detail::geqrf( traits::matrix_num_rows(a),
traits::matrix_num_columns(a), traits::matrix_storage(a),
traits::leading_dimension(a), traits::vector_storage(tau),
@@ -103,7 +103,7 @@
static void invoke( MatrixA& a, VectorTAU& tau, integer_t& info,
minimal_workspace work ) {
traits::detail::array< real_type > tmp_work( min_size_work(
- $CALL_MIN_SIZE ) );
+ traits::matrix_num_columns(a) ) );
invoke( a, tau, info, workspace( tmp_work ) );
}
@@ -121,8 +121,8 @@
invoke( a, tau, info, workspace( tmp_work ) );
}
- static integer_t min_size_work( $ARGUMENTS ) {
- $MIN_SIZE
+ static integer_t min_size_work( const integer_t n ) {
+ return std::max< std::ptrdiff_t >( 1, n );
}
};
@@ -148,7 +148,7 @@
std::ptrdiff_t >(traits::matrix_num_rows(a),
traits::matrix_num_columns(a)) );
BOOST_ASSERT( traits::vector_size(work.select(value_type())) >=
- min_size_work( $CALL_MIN_SIZE ));
+ min_size_work( traits::matrix_num_columns(a) ));
detail::geqrf( traits::matrix_num_rows(a),
traits::matrix_num_columns(a), traits::matrix_storage(a),
traits::leading_dimension(a), traits::vector_storage(tau),
@@ -161,7 +161,7 @@
static void invoke( MatrixA& a, VectorTAU& tau, integer_t& info,
minimal_workspace work ) {
traits::detail::array< value_type > tmp_work( min_size_work(
- $CALL_MIN_SIZE ) );
+ traits::matrix_num_columns(a) ) );
invoke( a, tau, info, workspace( tmp_work ) );
}
@@ -179,8 +179,8 @@
invoke( a, tau, info, workspace( tmp_work ) );
}
- static integer_t min_size_work( $ARGUMENTS ) {
- $MIN_SIZE
+ static integer_t min_size_work( const integer_t n ) {
+ return std::max< std::ptrdiff_t >( 1, n );
}
};
Modified: sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_geqrf.cpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_geqrf.cpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/lapack/test/ublas_geqrf.cpp 2009-12-19 17:52:58 EST (Sat, 19 Dec 2009)
@@ -8,13 +8,17 @@
#include "../../blas/test/random.hpp"
-#include <boost/numeric/bindings/lapack/geqrf.hpp>
-#include <boost/numeric/bindings/lapack/ormqr.hpp>
-#include <boost/numeric/bindings/lapack/orgqr.hpp>
+#include <boost/numeric/bindings/lapack/computational/geqrf.hpp>
+#include <boost/numeric/bindings/lapack/computational/ormqr.hpp>
+#include <boost/numeric/bindings/lapack/computational/orgqr.hpp>
+#include <boost/numeric/bindings/lapack/computational/unmqr.hpp>
+#include <boost/numeric/bindings/lapack/computational/ungqr.hpp>
#include <boost/numeric/bindings/traits/ublas_matrix.hpp>
#include <boost/numeric/bindings/traits/ublas_vector.hpp>
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
+#include <boost/type_traits/is_complex.hpp>
+#include <boost/mpl/if.hpp>
#include <iostream>
#include <limits>
@@ -22,6 +26,37 @@
namespace ublas = boost::numeric::ublas;
namespace lapack = boost::numeric::bindings::lapack;
+namespace traits = boost::numeric::bindings::traits;
+
+struct apply_real {
+ template< typename MatrixA, typename VectorTAU, typename Workspace >
+ static inline integer_t orgqr( const integer_t m, const integer_t n,
+ const integer_t k, MatrixA& a, const VectorTAU& tau, Workspace work ) {
+ return lapack::orgqr( m, n, k, a, tau, work );
+ }
+ template< typename MatrixA, typename VectorTAU, typename MatrixC,
+ typename Workspace >
+ static inline integer_t ormqr( const char side, const char trans,
+ const integer_t k, const MatrixA& a, const VectorTAU& tau, MatrixC& c,
+ Workspace work ) {
+ return lapack::ormqr( side, trans, k, a, tau, c, work );
+ }
+};
+
+struct apply_complex {
+ template< typename MatrixA, typename VectorTAU, typename Workspace >
+ static inline integer_t orgqr( const integer_t m, const integer_t n,
+ const integer_t k, MatrixA& a, const VectorTAU& tau, Workspace work ) {
+ return lapack::ungqr( m, n, k, a, tau, work );
+ }
+ template< typename MatrixA, typename VectorTAU, typename MatrixC,
+ typename Workspace >
+ static inline integer_t ormqr( const char side, const char trans,
+ const integer_t k, const MatrixA& a, const VectorTAU& tau, MatrixC& c,
+ Workspace work ) {
+ return lapack::unmqr( side, trans, k, a, tau, c, work );
+ }
+};
// Randomize a matrix
@@ -66,6 +101,7 @@
template <typename T, typename W>
int do_memory_type(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 std::complex< real_type > complex_type ;
@@ -84,14 +120,14 @@
lapack::geqrf( a, tau, workspace ) ;
// Apply the orthogonal transformations to a2
- lapack::ormqr( 'L', transpose<T>::value, a, tau, a2, workspace );
+ apply_t::ormqr( 'L', transpose<T>::value, traits::vector_size (tau), a, tau, a2, workspace );
// The upper triangular parts of a and a2 must be equal.
if (norm_frobenius( upper_part( a - a2 ) )
> std::numeric_limits<real_type>::epsilon() * 10.0 * norm_frobenius( upper_part( a ) ) ) return 255 ;
// Generate orthogonal matrix
- lapack::orgqr( a, tau, workspace );
+ apply_t::orgqr( traits::matrix_size1 (a), traits::matrix_size2 (a), traits::vector_size (tau), a, tau, workspace );
// The result of lapack::ormqr and the equivalent matrix product must be equal.
if (norm_frobenius( a2 - prod(herm(a), a3) )
Added: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/computational/geqrf.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/computational/geqrf.hpp 2009-12-19 17:52:58 EST (Sat, 19 Dec 2009)
@@ -0,0 +1,7 @@
+$TEMPLATE[geqrf.all.min_size_work.args]
+N
+$TEMPLATE[geqrf.real.min_size_work]
+return std::max< $INTEGER_TYPE >( 1, n );
+$TEMPLATE[geqrf.complex.min_size_work]
+return std::max< $INTEGER_TYPE >( 1, n );
+$TEMPLATE[end]
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