Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59067 - sandbox/numeric_bindings/boost/numeric/bindings/blas/level1
From: rutger_at_[hidden]
Date: 2010-01-16 04:06:12


Author: rutger
Date: 2010-01-16 04:06:11 EST (Sat, 16 Jan 2010)
New Revision: 59067
URL: http://svn.boost.org/trac/boost/changeset/59067

Log:
support for complex variants of rot

Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rot.hpp | 109 ++++++++++++++++++++++++++++++++++-----
   1 files changed, 93 insertions(+), 16 deletions(-)

Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rot.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rot.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rot.hpp 2010-01-16 04:06:11 EST (Sat, 16 Jan 2010)
@@ -75,6 +75,28 @@
     cblas_drot( n, x, incx, y, incy, c, s );
 }
 
+//
+// Overloaded function for dispatching to
+// * CBLAS backend, and
+// * complex<float> value-type.
+//
+inline void rot( const int n, std::complex<float>* x, const int incx,
+ std::complex<float>* y, const int incy, const float c,
+ const float s ) {
+ // NOT FOUND();
+}
+
+//
+// Overloaded function for dispatching to
+// * CBLAS backend, and
+// * complex<double> value-type.
+//
+inline void rot( const int n, std::complex<double>* x, const int incx,
+ std::complex<double>* y, const int incy, const double c,
+ const double s ) {
+ // NOT FOUND();
+}
+
 #elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
 //
 // Overloaded function for dispatching to
@@ -96,6 +118,28 @@
     cublasDrot( n, x, incx, y, incy, c, s );
 }
 
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend, and
+// * complex<float> value-type.
+//
+inline void rot( const int n, std::complex<float>* x, const int incx,
+ std::complex<float>* y, const int incy, const float c,
+ const float s ) {
+ cublasCsrot( n, x, incx, y, incy, c, s );
+}
+
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend, and
+// * complex<double> value-type.
+//
+inline void rot( const int n, std::complex<double>* x, const int incx,
+ std::complex<double>* y, const int incy, const double c,
+ const double s ) {
+ // NOT FOUND();
+}
+
 #else
 //
 // Overloaded function for dispatching to
@@ -117,6 +161,28 @@
     BLAS_DROT( &n, x, &incx, y, &incy, &c, &s );
 }
 
+//
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default), and
+// * complex<float> value-type.
+//
+inline void rot( const fortran_int_t n, std::complex<float>* x,
+ const fortran_int_t incx, std::complex<float>* y,
+ const fortran_int_t incy, const float c, const float s ) {
+ BLAS_CSROT( &n, x, &incx, y, &incy, &c, &s );
+}
+
+//
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default), and
+// * complex<double> value-type.
+//
+inline void rot( const fortran_int_t n, std::complex<double>* x,
+ const fortran_int_t incx, std::complex<double>* y,
+ const fortran_int_t incy, const double c, const double s ) {
+ BLAS_ZDROT( &n, x, &incx, y, &incy, &c, &s );
+}
+
 #endif
 
 } // namespace detail
@@ -138,17 +204,16 @@
     // * Asserts that most arguments make sense.
     //
     template< typename VectorX, typename VectorY >
- static return_type invoke( VectorX& x, VectorY& y, const real_type c,
+ static return_type invoke( const std::ptrdiff_t n, VectorX& x,
+ const std::ptrdiff_t incx, VectorY& y,
+ const std::ptrdiff_t incy, const real_type c,
             const real_type s ) {
         namespace bindings = ::boost::numeric::bindings;
         BOOST_STATIC_ASSERT( (is_same< typename remove_const< typename value<
                 VectorX >::type >::type, typename remove_const<
                 typename value< VectorY >::type >::type >::value) );
- BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
- BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
- detail::rot( bindings::size(x), bindings::begin_value(x),
- bindings::stride(x), bindings::begin_value(y),
- bindings::stride(y), c, s );
+ detail::rot( n, bindings::begin_value(x), incx,
+ bindings::begin_value(y), incy, c, s );
     }
 };
 
@@ -167,11 +232,14 @@
 //
 template< typename VectorX, typename VectorY >
 inline typename rot_impl< typename value< VectorX >::type >::return_type
-rot( VectorX& x, VectorY& y, const typename remove_imaginary<
+rot( const std::ptrdiff_t n, VectorX& x,
+ const std::ptrdiff_t incx, VectorY& y,
+ const std::ptrdiff_t incy, const typename remove_imaginary<
         typename value< VectorX >::type >::type c,
         const typename remove_imaginary< typename value<
         VectorX >::type >::type s ) {
- rot_impl< typename value< VectorX >::type >::invoke( x, y, c, s );
+ rot_impl< typename value< VectorX >::type >::invoke( n, x, incx, y,
+ incy, c, s );
 }
 
 //
@@ -181,11 +249,14 @@
 //
 template< typename VectorX, typename VectorY >
 inline typename rot_impl< typename value< VectorX >::type >::return_type
-rot( const VectorX& x, VectorY& y, const typename remove_imaginary<
+rot( const std::ptrdiff_t n, const VectorX& x,
+ const std::ptrdiff_t incx, VectorY& y,
+ const std::ptrdiff_t incy, const typename remove_imaginary<
         typename value< VectorX >::type >::type c,
         const typename remove_imaginary< typename value<
         VectorX >::type >::type s ) {
- rot_impl< typename value< VectorX >::type >::invoke( x, y, c, s );
+ rot_impl< typename value< VectorX >::type >::invoke( n, x, incx, y,
+ incy, c, s );
 }
 
 //
@@ -195,11 +266,14 @@
 //
 template< typename VectorX, typename VectorY >
 inline typename rot_impl< typename value< VectorX >::type >::return_type
-rot( VectorX& x, const VectorY& y, const typename remove_imaginary<
+rot( const std::ptrdiff_t n, VectorX& x,
+ const std::ptrdiff_t incx, const VectorY& y,
+ const std::ptrdiff_t incy, const typename remove_imaginary<
         typename value< VectorX >::type >::type c,
         const typename remove_imaginary< typename value<
         VectorX >::type >::type s ) {
- rot_impl< typename value< VectorX >::type >::invoke( x, y, c, s );
+ rot_impl< typename value< VectorX >::type >::invoke( n, x, incx, y,
+ incy, c, s );
 }
 
 //
@@ -209,11 +283,14 @@
 //
 template< typename VectorX, typename VectorY >
 inline typename rot_impl< typename value< VectorX >::type >::return_type
-rot( const VectorX& x, const VectorY& y,
+rot( const std::ptrdiff_t n, const VectorX& x,
+ const std::ptrdiff_t incx, const VectorY& y,
+ const std::ptrdiff_t incy, const typename remove_imaginary<
+ typename value< VectorX >::type >::type c,
         const typename remove_imaginary< typename value<
- VectorX >::type >::type c, const typename remove_imaginary<
- typename value< VectorX >::type >::type s ) {
- rot_impl< typename value< VectorX >::type >::invoke( x, y, c, s );
+ VectorX >::type >::type s ) {
+ rot_impl< typename value< VectorX >::type >::invoke( n, x, incx, y,
+ incy, c, s );
 }
 
 } // namespace blas


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