Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59048 - in sandbox/numeric_bindings/boost/numeric/bindings: blas/detail blas/level1 ublas
From: rutger_at_[hidden]
Date: 2010-01-15 10:11:45


Author: rutger
Date: 2010-01-15 10:11:44 EST (Fri, 15 Jan 2010)
New Revision: 59048
URL: http://svn.boost.org/trac/boost/changeset/59048

Log:
intitial addition of complex variants of asum and nrm2; to be audited further. Also added default include to ublas storage in ublas vector bindings

Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas.h | 8 +++++
   sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas_names.h | 4 ++
   sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/asum.hpp | 60 ++++++++++++++++++++++++++++++++++++++++
   sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/nrm2.hpp | 60 ++++++++++++++++++++++++++++++++++++++++
   sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector.hpp | 1
   5 files changed, 133 insertions(+), 0 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 10:11:44 EST (Fri, 15 Jan 2010)
@@ -25,6 +25,10 @@
 // Value-type variants of asum
 float BLAS_SASUM( const fortran_int_t* n, const float* x,
         const fortran_int_t* incx );
+float BLAS_SCASUM( const fortran_int_t* n, const void* x,
+ const fortran_int_t* incx );
+double BLAS_DZASUM( const fortran_int_t* n, const void* x,
+ const fortran_int_t* incx );
 double BLAS_DASUM( const fortran_int_t* n, const double* x,
         const fortran_int_t* incx );
 
@@ -70,8 +74,12 @@
 // Value-type variants of nrm2
 float BLAS_SNRM2( const fortran_int_t* n, const float* x,
         const fortran_int_t* incx );
+float BLAS_SCNRM2( const fortran_int_t* n, const void* x,
+ const fortran_int_t* incx );
 double BLAS_DNRM2( const fortran_int_t* n, const double* x,
         const fortran_int_t* incx );
+double BLAS_DZNRM2( const fortran_int_t* n, const void* x,
+ const fortran_int_t* incx );
 
 // Value-type variants of rot
 void BLAS_SROT( const fortran_int_t* n, float* x, const fortran_int_t* incx,

Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas_names.h
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas_names.h (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas_names.h 2010-01-15 10:11:44 EST (Fri, 15 Jan 2010)
@@ -22,6 +22,8 @@
 
 // Value-type variants of asum
 #define BLAS_SASUM FORTRAN_ID( sasum )
+#define BLAS_SCASUM FORTRAN_ID( scasum )
+#define BLAS_DZASUM FORTRAN_ID( dzasum )
 #define BLAS_DASUM FORTRAN_ID( dasum )
 
 // Value-type variants of axpy
@@ -50,7 +52,9 @@
 
 // Value-type variants of nrm2
 #define BLAS_SNRM2 FORTRAN_ID( snrm2 )
+#define BLAS_SCNRM2 FORTRAN_ID( scnrm2 )
 #define BLAS_DNRM2 FORTRAN_ID( dnrm2 )
+#define BLAS_DZNRM2 FORTRAN_ID( dznrm2 )
 
 // Value-type variants of rot
 #define BLAS_SROT FORTRAN_ID( srot )

Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/asum.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/asum.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/asum.hpp 2010-01-15 10:11:44 EST (Fri, 15 Jan 2010)
@@ -67,6 +67,26 @@
 //
 // Overloaded function for dispatching to
 // * CBLAS backend, and
+// * float value-type.
+//
+inline float asum( const int n, const std::complex<float>* x,
+ const int incx ) {
+ return cblas_scasum( n, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CBLAS backend, and
+// * double value-type.
+//
+inline double asum( const int n, const std::complex<double>* x,
+ const int incx ) {
+ return cblas_dzasum( n, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CBLAS backend, and
 // * double value-type.
 //
 inline double asum( const int n, const double* x, const int incx ) {
@@ -86,6 +106,26 @@
 //
 // Overloaded function for dispatching to
 // * CUBLAS backend, and
+// * float value-type.
+//
+inline float asum( const int n, const std::complex<float>* x,
+ const int incx ) {
+ return cublasScasum( n, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend, and
+// * double value-type.
+//
+inline double asum( const int n, const std::complex<double>* x,
+ const int incx ) {
+ return // NOT FOUND();
+}
+
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend, and
 // * double value-type.
 //
 inline double asum( const int n, const double* x, const int incx ) {
@@ -106,6 +146,26 @@
 //
 // Overloaded function for dispatching to
 // * netlib-compatible BLAS backend (the default), and
+// * float value-type.
+//
+inline float asum( const fortran_int_t n, const std::complex<float>* x,
+ const fortran_int_t incx ) {
+ return BLAS_SCASUM( &n, x, &incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default), and
+// * double value-type.
+//
+inline double asum( const fortran_int_t n, const std::complex<double>* x,
+ const fortran_int_t incx ) {
+ return BLAS_DZASUM( &n, x, &incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default), and
 // * double value-type.
 //
 inline double asum( const fortran_int_t n, const double* x,

Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/nrm2.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/nrm2.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/nrm2.hpp 2010-01-15 10:11:44 EST (Fri, 15 Jan 2010)
@@ -67,12 +67,32 @@
 //
 // Overloaded function for dispatching to
 // * CBLAS backend, and
+// * float value-type.
+//
+inline float nrm2( const int n, const std::complex<float>* x,
+ const int incx ) {
+ return cblas_scnrm2( n, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CBLAS backend, and
 // * double value-type.
 //
 inline double nrm2( const int n, const double* x, const int incx ) {
     return cblas_dnrm2( n, x, incx );
 }
 
+//
+// Overloaded function for dispatching to
+// * CBLAS backend, and
+// * double value-type.
+//
+inline double nrm2( const int n, const std::complex<double>* x,
+ const int incx ) {
+ return cblas_dznrm2( n, x, incx );
+}
+
 #elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
 //
 // Overloaded function for dispatching to
@@ -86,12 +106,32 @@
 //
 // Overloaded function for dispatching to
 // * CUBLAS backend, and
+// * float value-type.
+//
+inline float nrm2( const int n, const std::complex<float>* x,
+ const int incx ) {
+ return cublasScnrm2( n, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend, and
 // * double value-type.
 //
 inline double nrm2( const int n, const double* x, const int incx ) {
     return cublasDnrm2( n, x, incx );
 }
 
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend, and
+// * double value-type.
+//
+inline double nrm2( const int n, const std::complex<double>* x,
+ const int incx ) {
+ return // NOT FOUND();
+}
+
 #else
 //
 // Overloaded function for dispatching to
@@ -106,6 +146,16 @@
 //
 // Overloaded function for dispatching to
 // * netlib-compatible BLAS backend (the default), and
+// * float value-type.
+//
+inline float nrm2( const fortran_int_t n, const std::complex<float>* x,
+ const fortran_int_t incx ) {
+ return BLAS_SCNRM2( &n, x, &incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default), and
 // * double value-type.
 //
 inline double nrm2( const fortran_int_t n, const double* x,
@@ -113,6 +163,16 @@
     return BLAS_DNRM2( &n, x, &incx );
 }
 
+//
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default), and
+// * double value-type.
+//
+inline double nrm2( const fortran_int_t n, const std::complex<double>* x,
+ const fortran_int_t incx ) {
+ return BLAS_DZNRM2( &n, x, &incx );
+}
+
 #endif
 
 } // namespace detail

Modified: sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/ublas/vector.hpp 2010-01-15 10:11:44 EST (Fri, 15 Jan 2010)
@@ -12,6 +12,7 @@
 #include <boost/numeric/bindings/detail/adaptor.hpp>
 #include <boost/numeric/bindings/begin.hpp>
 #include <boost/numeric/bindings/end.hpp>
+#include <boost/numeric/bindings/ublas/storage.hpp>
 #include <boost/numeric/bindings/ublas/vector_expression.hpp>
 #include <boost/numeric/ublas/vector.hpp>
 


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