Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59036 - in sandbox/numeric_bindings/boost/numeric/bindings/blas: detail level1
From: rutger_at_[hidden]
Date: 2010-01-15 08:41:49


Author: rutger
Date: 2010-01-15 08:41:49 EST (Fri, 15 Jan 2010)
New Revision: 59036
URL: http://svn.boost.org/trac/boost/changeset/59036

Log:
fixed const correctness / ptr stuff of rot / rotmg (blas level 1)

Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas.h | 11 +++----
   sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rot.hpp | 53 ++++++++++++++++++++++++++++++---------
   sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotmg.hpp | 4 +-
   3 files changed, 48 insertions(+), 20 deletions(-)

Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas.h
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas.h (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas.h 2010-01-15 08:41:49 EST (Fri, 15 Jan 2010)
@@ -74,12 +74,11 @@
         const fortran_int_t* incx );
 
 // Value-type variants of rot
-void BLAS_SROT( const fortran_int_t* n, const float* x,
- const fortran_int_t* incx, float* y, const fortran_int_t* incy,
- const float* c, const float* s );
-void BLAS_DROT( const fortran_int_t* n, const double* x,
- const fortran_int_t* incx, double* y, const fortran_int_t* incy,
- const double* c, const double* s );
+void BLAS_SROT( const fortran_int_t* n, float* x, const fortran_int_t* incx,
+ float* y, const fortran_int_t* incy, const float* c, const float* s );
+void BLAS_DROT( const fortran_int_t* n, double* x, const fortran_int_t* incx,
+ double* y, const fortran_int_t* incy, const double* c,
+ const double* s );
 
 // Value-type variants of rotg
 void BLAS_SROTG( float* a, float* b, float* c, float* s );

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-15 08:41:49 EST (Fri, 15 Jan 2010)
@@ -60,7 +60,7 @@
 // * CBLAS backend, and
 // * float value-type.
 //
-inline void rot( const int n, const float* x, const int incx, float* y,
+inline void rot( const int n, float* x, const int incx, float* y,
         const int incy, const float c, const float s ) {
     cblas_srot( n, x, incx, y, incy, c, s );
 }
@@ -70,7 +70,7 @@
 // * CBLAS backend, and
 // * double value-type.
 //
-inline void rot( const int n, const double* x, const int incx, double* y,
+inline void rot( const int n, double* x, const int incx, double* y,
         const int incy, const double c, const double s ) {
     cblas_drot( n, x, incx, y, incy, c, s );
 }
@@ -81,7 +81,7 @@
 // * CUBLAS backend, and
 // * float value-type.
 //
-inline void rot( const int n, const float* x, const int incx, float* y,
+inline void rot( const int n, float* x, const int incx, float* y,
         const int incy, const float c, const float s ) {
     cublasSrot( n, x, incx, y, incy, c, s );
 }
@@ -91,7 +91,7 @@
 // * CUBLAS backend, and
 // * double value-type.
 //
-inline void rot( const int n, const double* x, const int incx, double* y,
+inline void rot( const int n, double* x, const int incx, double* y,
         const int incy, const double c, const double s ) {
     cublasDrot( n, x, incx, y, incy, c, s );
 }
@@ -102,9 +102,8 @@
 // * netlib-compatible BLAS backend (the default), and
 // * float value-type.
 //
-inline void rot( const fortran_int_t n, const float* x,
- const fortran_int_t incx, float* y, const fortran_int_t incy,
- const float c, const float s ) {
+inline void rot( const fortran_int_t n, float* x, const fortran_int_t incx,
+ float* y, const fortran_int_t incy, const float c, const float s ) {
     BLAS_SROT( &n, x, &incx, y, &incy, &c, &s );
 }
 
@@ -113,9 +112,8 @@
 // * netlib-compatible BLAS backend (the default), and
 // * double value-type.
 //
-inline void rot( const fortran_int_t n, const double* x,
- const fortran_int_t incx, double* y, const fortran_int_t incy,
- const double c, const double s ) {
+inline void rot( const fortran_int_t n, double* x, const fortran_int_t incx,
+ double* y, const fortran_int_t incy, const double c, const double s ) {
     BLAS_DROT( &n, x, &incx, y, &incy, &c, &s );
 }
 
@@ -140,12 +138,13 @@
     // * Asserts that most arguments make sense.
     //
     template< typename VectorX, typename VectorY >
- static return_type invoke( const VectorX& x, VectorY& y,
- const real_type c, const real_type s ) {
+ static return_type invoke( VectorX& x, VectorY& y, 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),
@@ -163,6 +162,21 @@
 
 //
 // Overloaded function for rot. Its overload differs for
+// * VectorX&
+// * VectorY&
+//
+template< typename VectorX, typename VectorY >
+inline typename rot_impl< typename value< VectorX >::type >::return_type
+rot( VectorX& x, VectorY& y, 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 );
+}
+
+//
+// Overloaded function for rot. Its overload differs for
+// * const VectorX&
 // * VectorY&
 //
 template< typename VectorX, typename VectorY >
@@ -176,6 +190,21 @@
 
 //
 // Overloaded function for rot. Its overload differs for
+// * VectorX&
+// * const VectorY&
+//
+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<
+ 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 );
+}
+
+//
+// Overloaded function for rot. Its overload differs for
+// * const VectorX&
 // * const VectorY&
 //
 template< typename VectorX, typename VectorY >

Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotmg.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotmg.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotmg.hpp 2010-01-15 08:41:49 EST (Fri, 15 Jan 2010)
@@ -62,7 +62,7 @@
 //
 inline void rotmg( float& d1, float& d2, float& x1, const float y1,
         float* sparam ) {
- cblas_srotmg( &d1, &d2, &x1, &y1, sparam );
+ cblas_srotmg( &d1, &d2, &x1, y1, sparam );
 }
 
 //
@@ -72,7 +72,7 @@
 //
 inline void rotmg( double& d1, double& d2, double& x1, const double y1,
         double* dparam ) {
- cblas_drotmg( &d1, &d2, &x1, &y1, dparam );
+ cblas_drotmg( &d1, &d2, &x1, y1, dparam );
 }
 
 #elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS


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