|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56821 - in sandbox/numeric_bindings/boost/numeric/bindings/blas: detail level1 level2 level3
From: rutger_at_[hidden]
Date: 2009-10-14 08:47:25
Author: rutger
Date: 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
New Revision: 56821
URL: http://svn.boost.org/trac/boost/changeset/56821
Log:
integrated cblas, blas, and cublas backends in blas bindings
Text files modified:
sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas.h | 12 -------
sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas_names.h | 8 -----
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/asum.hpp | 27 ++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/axpy.hpp | 42 ++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/copy.hpp | 39 ++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/dot.hpp | 27 ++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/dotc.hpp | 30 ++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/dotu.hpp | 31 +++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/drot.hpp | 21 ++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/nrm2.hpp | 27 ++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rot.hpp | 27 ++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotg.hpp | 50 ++++++++++++++++++++------------
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotm.hpp | 27 ++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotmg.hpp | 27 ++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/scal.hpp | 39 ++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/sdot.hpp | 21 ++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/srot.hpp | 21 ++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/swap.hpp | 39 ++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/gbmv.hpp | 53 +++++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/gemv.hpp | 57 +++++++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/ger.hpp | 27 ++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/gerc.hpp | 32 +++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/geru.hpp | 32 +++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hbmv.hpp | 35 +++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hemv.hpp | 35 +++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/her.hpp | 30 ++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/her2.hpp | 32 +++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hpmv.hpp | 35 +++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hpr.hpp | 30 ++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hpr2.hpp | 32 +++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/sbmv.hpp | 29 +++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/spmv.hpp | 29 +++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/spr.hpp | 29 +++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/spr2.hpp | 29 +++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/symv.hpp | 29 +++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/syr.hpp | 29 +++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/syr2.hpp | 29 +++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tbmv.hpp | 52 ++++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tbsv.hpp | 52 ++++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tpmv.hpp | 50 +++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tpsv.hpp | 50 +++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/trmv.hpp | 49 ++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/trsv.hpp | 50 +++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/gemm.hpp | 61 ++++++++++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/hemm.hpp | 37 ++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/her2k.hpp | 35 +++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/herk.hpp | 34 ++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/symm.hpp | 53 +++++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/syr2k.hpp | 53 +++++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/syrk.hpp | 53 +++++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/trmm.hpp | 58 ++++++++++++++++++++++++++++++++++++-
sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/trsm.hpp | 59 +++++++++++++++++++++++++++++++++++++-
52 files changed, 1756 insertions(+), 138 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 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -66,11 +66,6 @@
dcomplex_t BLAS_ZDOTU( const integer_t* n, const dcomplex_t* x,
const integer_t* incx, const dcomplex_t* y, const integer_t* incy );
-// Value-type variants of drot
-void BLAS_ZDROT( const integer_t* n, const dcomplex_t* cx,
- const integer_t* incx, const dcomplex_t* cy, const integer_t* incy,
- const double* c, const double* s );
-
// Value-type variants of nrm2
float BLAS_SNRM2( const integer_t* n, const float* x, const integer_t* incx );
double BLAS_DNRM2( const integer_t* n, const double* x,
@@ -85,8 +80,6 @@
// Value-type variants of rotg
void BLAS_SROTG( float* a, float* b, float* c, float* s );
void BLAS_DROTG( double* a, double* b, double* c, double* s );
-void BLAS_CROTG( fcomplex_t* a, fcomplex_t* b, float* c, fcomplex_t* s );
-void BLAS_ZROTG( dcomplex_t* a, dcomplex_t* b, double* c, dcomplex_t* s );
// Value-type variants of rotm
void BLAS_SROTM( const integer_t* n, float* x, const integer_t* incx,
@@ -114,11 +107,6 @@
double BLAS_DSDOT( const integer_t* n, const float* sx, const integer_t* incx,
const float* sy, const integer_t* incy );
-// Value-type variants of srot
-void BLAS_CSROT( const integer_t* n, const fcomplex_t* cx,
- const integer_t* incx, const fcomplex_t* cy, const integer_t* incy,
- const float* c, const float* s );
-
// Value-type variants of swap
void BLAS_SSWAP( const integer_t* n, float* x, const integer_t* incx,
float* y, const integer_t* incy );
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 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -48,9 +48,6 @@
#define BLAS_CDOTU FORTRAN_ID( cdotu )
#define BLAS_ZDOTU FORTRAN_ID( zdotu )
-// Value-type variants of drot
-#define BLAS_ZDROT FORTRAN_ID( zdrot )
-
// Value-type variants of nrm2
#define BLAS_SNRM2 FORTRAN_ID( snrm2 )
#define BLAS_DNRM2 FORTRAN_ID( dnrm2 )
@@ -62,8 +59,6 @@
// Value-type variants of rotg
#define BLAS_SROTG FORTRAN_ID( srotg )
#define BLAS_DROTG FORTRAN_ID( drotg )
-#define BLAS_CROTG FORTRAN_ID( crotg )
-#define BLAS_ZROTG FORTRAN_ID( zrotg )
// Value-type variants of rotm
#define BLAS_SROTM FORTRAN_ID( srotm )
@@ -82,9 +77,6 @@
// Value-type variants of sdot
#define BLAS_DSDOT FORTRAN_ID( dsdot )
-// Value-type variants of srot
-#define BLAS_CSROT FORTRAN_ID( csrot )
-
// Value-type variants of swap
#define BLAS_SSWAP FORTRAN_ID( sswap )
#define BLAS_DSWAP FORTRAN_ID( dswap )
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 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ASUM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ASUM_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,18 +34,33 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline float asum( const integer_t n, const float* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ return cblas_sasum( n, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ return cublasSasum( n, x, incx );
+#else
return BLAS_SASUM( &n, x, &incx );
+#endif
}
inline double asum( const integer_t n, const double* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ return cblas_dasum( n, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ return cublasDasum( n, x, incx );
+#else
return BLAS_DASUM( &n, x, &incx );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/axpy.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/axpy.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/axpy.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_AXPY_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_AXPY_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,33 +34,63 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void axpy( const integer_t n, const float a, const float* x,
const integer_t incx, float* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_saxpy( n, a, x, incx, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSaxpy( n, a, x, incx, y, incy );
+#else
BLAS_SAXPY( &n, &a, x, &incx, y, &incy );
+#endif
}
inline void axpy( const integer_t n, const double a, const double* x,
const integer_t incx, double* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_daxpy( n, a, x, incx, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDaxpy( n, a, x, incx, y, incy );
+#else
BLAS_DAXPY( &n, &a, x, &incx, y, &incy );
+#endif
}
inline void axpy( const integer_t n, const traits::complex_f a,
const traits::complex_f* x, const integer_t incx,
traits::complex_f* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_caxpy( n, traits::void_ptr(&a), traits::void_ptr(x), incx,
+ traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCaxpy( n, traits::void_ptr(a), traits::void_ptr(x), incx,
+ traits::void_ptr(y), incy );
+#else
BLAS_CAXPY( &n, traits::complex_ptr(&a), traits::complex_ptr(x), &incx,
traits::complex_ptr(y), &incy );
+#endif
}
inline void axpy( const integer_t n, const traits::complex_d a,
const traits::complex_d* x, const integer_t incx,
traits::complex_d* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zaxpy( n, traits::void_ptr(&a), traits::void_ptr(x), incx,
+ traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZAXPY( &n, traits::complex_ptr(&a), traits::complex_ptr(x), &incx,
traits::complex_ptr(y), &incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/copy.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/copy.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/copy.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_COPY_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_COPY_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,33 +34,60 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void copy( const integer_t n, const float* x, const integer_t incx,
const float* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_scopy( n, x, incx, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasScopy( n, x, incx, y, incy );
+#else
BLAS_SCOPY( &n, x, &incx, y, &incy );
+#endif
}
inline void copy( const integer_t n, const double* x, const integer_t incx,
const double* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dcopy( n, x, incx, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDcopy( n, x, incx, y, incy );
+#else
BLAS_DCOPY( &n, x, &incx, y, &incy );
+#endif
}
inline void copy( const integer_t n, const traits::complex_f* x,
const integer_t incx, const traits::complex_f* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ccopy( n, traits::void_ptr(x), incx, traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCcopy( n, traits::void_ptr(x), incx, traits::void_ptr(y), incy );
+#else
BLAS_CCOPY( &n, traits::complex_ptr(x), &incx, traits::complex_ptr(y),
&incy );
+#endif
}
inline void copy( const integer_t n, const traits::complex_d* x,
const integer_t incx, const traits::complex_d* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zcopy( n, traits::void_ptr(x), incx, traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZCOPY( &n, traits::complex_ptr(x), &incx, traits::complex_ptr(y),
&incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/dot.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/dot.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/dot.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOT_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOT_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,19 +34,34 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline float dot( const integer_t n, const float* x, const integer_t incx,
const float* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ return cblas_sdot( n, x, incx, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ return cublasSdot( n, x, incx, y, incy );
+#else
return BLAS_SDOT( &n, x, &incx, y, &incy );
+#endif
}
inline double dot( const integer_t n, const double* x, const integer_t incx,
const double* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ return cblas_ddot( n, x, incx, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ return cublasDdot( n, x, incx, y, incy );
+#else
return BLAS_DDOT( &n, x, &incx, y, &incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/dotc.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/dotc.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/dotc.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOTC_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOTC_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,23 +34,41 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline fcomplex_t dotc( const integer_t n, const traits::complex_f* x,
const integer_t incx, const traits::complex_f* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ return cblas_cdotc_sub( n, traits::void_ptr(x), incx, traits::void_ptr(y),
+ incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ return cublasCdotc( n, traits::void_ptr(x), incx, traits::void_ptr(y),
+ incy );
+#else
return BLAS_CDOTC( &n, traits::complex_ptr(x), &incx,
traits::complex_ptr(y), &incy );
+#endif
}
inline dcomplex_t dotc( const integer_t n, const traits::complex_d* x,
const integer_t incx, const traits::complex_d* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ return cblas_zdotc_sub( n, traits::void_ptr(x), incx, traits::void_ptr(y),
+ incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ return // NOT FOUND();
+#else
return BLAS_ZDOTC( &n, traits::complex_ptr(x), &incx,
traits::complex_ptr(y), &incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/dotu.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/dotu.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/dotu.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOTU_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOTU_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,23 +34,42 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline fcomplex_t dotu( const integer_t n, const traits::complex_f* x,
const integer_t incx, const traits::complex_f* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ return cblas_cdotu_sub( n, traits::void_ptr(x), incx, traits::void_ptr(y),
+ incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ return cublasCdotu( n, traits::void_ptr(x), incx, traits::void_ptr(y),
+ incy );
+#else
return BLAS_CDOTU( &n, traits::complex_ptr(x), &incx,
traits::complex_ptr(y), &incy );
+#endif
}
inline dcomplex_t dotu( const integer_t n, const traits::complex_d* x,
const integer_t incx, const traits::complex_d* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ return cblas_zdotu_sub( n, traits::void_ptr(x), incx, traits::void_ptr(y),
+ incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ return cublasZdotu( n, traits::void_ptr(x), incx, traits::void_ptr(y),
+ incy );
+#else
return BLAS_ZDOTU( &n, traits::complex_ptr(x), &incx,
traits::complex_ptr(y), &incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/drot.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/drot.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/drot.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DROT_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DROT_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,16 +34,25 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void drot( const integer_t n, const traits::complex_d* cx,
const integer_t incx, const traits::complex_d* cy,
const integer_t incy, const double c, const double s ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ //TODO( ... ); // FIXME
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ //TODO( ... ); // FIXME
+#else
BLAS_ZDROT( &n, traits::complex_ptr(cx), &incx, traits::complex_ptr(cy),
&incy, &c, &s );
+#endif
}
+
} // namespace detail
// value-type based template
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 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_NRM2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_NRM2_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,18 +34,33 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline float nrm2( const integer_t n, const float* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ return cblas_snrm2( n, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ return cublasSnrm2( n, x, incx );
+#else
return BLAS_SNRM2( &n, x, &incx );
+#endif
}
inline double nrm2( const integer_t n, const double* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ return cblas_dnrm2( n, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ return cublasDnrm2( n, x, incx );
+#else
return BLAS_DNRM2( &n, x, &incx );
+#endif
}
+
} // namespace detail
// value-type based template
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 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROT_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROT_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,19 +34,34 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void rot( const integer_t n, const float* x, const integer_t incx,
float* y, const integer_t incy, const float c, const float s ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_srot( n, x, incx, y, incy, c, s );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSrot( n, x, incx, y, incy, c, s );
+#else
BLAS_SROT( &n, x, &incx, y, &incy, &c, &s );
+#endif
}
inline void rot( const integer_t n, const double* x, const integer_t incx,
double* y, const integer_t incy, const double c, const double s ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_drot( n, x, incx, y, incy, c, s );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDrot( n, x, incx, y, incy, c, s );
+#else
BLAS_DROT( &n, x, &incx, y, &incy, &c, &s );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotg.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotg.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotg.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTG_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTG_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,28 +34,31 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void rotg( float& a, float& b, float& c, float& s ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_srotg( &a, &b, &c, &s );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSrotg( &a, &b, &c, &s );
+#else
BLAS_SROTG( &a, &b, &c, &s );
+#endif
}
inline void rotg( double& a, double& b, double& c, double& s ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_drotg( &a, &b, &c, &s );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDrotg( &a, &b, &c, &s );
+#else
BLAS_DROTG( &a, &b, &c, &s );
+#endif
}
-inline void rotg( traits::complex_f& a, traits::complex_f& b, float& c,
- traits::complex_f& s ) {
- BLAS_CROTG( traits::complex_ptr(&a), traits::complex_ptr(&b), &c,
- traits::complex_ptr(&s) );
-}
-
-inline void rotg( traits::complex_d& a, traits::complex_d& b, double& c,
- traits::complex_d& s ) {
- BLAS_ZROTG( traits::complex_ptr(&a), traits::complex_ptr(&b), &c,
- traits::complex_ptr(&s) );
-}
} // namespace detail
@@ -61,8 +72,8 @@
// static template member function
template< >
- static return_type invoke( value_type& a, value_type& b, real_type& c,
- value_type& s ) {
+ static return_type invoke( real_type& a, real_type& b, real_type& c,
+ real_type& s ) {
detail::rotg( a, b, c, s );
}
};
@@ -71,11 +82,12 @@
template< >
inline typename rotg_impl< typename traits::TODO_traits<
TODO >::value_type >::return_type
-rotg( typename traits::TODO_traits< TODO >::value_type& a,
- typename traits::TODO_traits< TODO >::value_type& b,
+rotg( typename traits::type_traits< typename traits::TODO_traits<
+ TODO >::value_type >::real_type& a, typename traits::type_traits<
+ typename traits::TODO_traits< TODO >::value_type >::real_type& b,
typename traits::type_traits< typename traits::TODO_traits<
- TODO >::value_type >::real_type& c, typename traits::TODO_traits<
- TODO >::value_type& s ) {
+ TODO >::value_type >::real_type& c, typename traits::type_traits<
+ typename traits::TODO_traits< TODO >::value_type >::real_type& s ) {
typedef typename traits::TODO_traits< TODO >::value_type value_type;
rotg_impl< value_type >::invoke( a, b, c, s );
}
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotm.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotm.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/rotm.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTM_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,19 +34,34 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void rotm( const integer_t n, float* x, const integer_t incx, float* y,
const integer_t incy, float* param ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_srotm( n, x, incx, y, incy, param );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSrotm( n, x, incx, y, incy, param );
+#else
BLAS_SROTM( &n, x, &incx, y, &incy, param );
+#endif
}
inline void rotm( const integer_t n, double* x, const integer_t incx,
double* y, const integer_t incy, double* param ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_drotm( n, x, incx, y, incy, param );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDrotm( n, x, incx, y, incy, param );
+#else
BLAS_DROTM( &n, x, &incx, y, &incy, param );
+#endif
}
+
} // namespace detail
// value-type based template
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 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTMG_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTMG_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,19 +34,34 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void rotmg( float& d1, float& d2, float& x1, const float y1,
float* sparam ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_srotmg( &d1, &d2, &x1, &y1, sparam );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSrotmg( &d1, &d2, &x1, &y1, sparam );
+#else
BLAS_SROTMG( &d1, &d2, &x1, &y1, sparam );
+#endif
}
inline void rotmg( double& d1, double& d2, double& x1, const double y1,
double* dparam ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_drotmg( &d1, &d2, &x1, &y1, dparam );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDrotmg( &d1, &d2, &x1, &y1, dparam );
+#else
BLAS_DROTMG( &d1, &d2, &x1, &y1, dparam );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/scal.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/scal.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/scal.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SCAL_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SCAL_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,29 +34,56 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void scal( const integer_t n, const float a, const float* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_sscal( n, a, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSscal( n, a, x, incx );
+#else
BLAS_SSCAL( &n, &a, x, &incx );
+#endif
}
inline void scal( const integer_t n, const double a, const double* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dscal( n, a, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDscal( n, a, x, incx );
+#else
BLAS_DSCAL( &n, &a, x, &incx );
+#endif
}
inline void scal( const integer_t n, const traits::complex_f a,
const traits::complex_f* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_cscal( n, traits::void_ptr(&a), traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCscal( n, traits::void_ptr(a), traits::void_ptr(x), incx );
+#else
BLAS_CSCAL( &n, traits::complex_ptr(&a), traits::complex_ptr(x), &incx );
+#endif
}
inline void scal( const integer_t n, const traits::complex_d a,
const traits::complex_d* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zscal( n, traits::void_ptr(&a), traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasZscal( n, traits::void_ptr(a), traits::void_ptr(x), incx );
+#else
BLAS_ZSCAL( &n, traits::complex_ptr(&a), traits::complex_ptr(x), &incx );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/sdot.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/sdot.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/sdot.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SDOT_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SDOT_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,14 +34,23 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline double sdot( const integer_t n, const float* sx, const integer_t incx,
const float* sy, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ return cblas_dsdot( n, sx, incx, sy, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ return // NOT FOUND();
+#else
return BLAS_DSDOT( &n, sx, &incx, sy, &incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/srot.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/srot.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/srot.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SROT_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SROT_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,16 +34,25 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void srot( const integer_t n, const traits::complex_f* cx,
const integer_t incx, const traits::complex_f* cy,
const integer_t incy, const float c, const float s ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ //TODO( ... ); // FIXME
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCsrot( ... ); // FIXME
+#else
BLAS_CSROT( &n, traits::complex_ptr(cx), &incx, traits::complex_ptr(cy),
&incy, &c, &s );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/swap.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/swap.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/swap.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SWAP_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SWAP_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,31 +34,58 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void swap( const integer_t n, float* x, const integer_t incx, float* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_sswap( n, x, incx, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSswap( n, x, incx, y, incy );
+#else
BLAS_SSWAP( &n, x, &incx, y, &incy );
+#endif
}
inline void swap( const integer_t n, double* x, const integer_t incx,
double* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dswap( n, x, incx, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDswap( n, x, incx, y, incy );
+#else
BLAS_DSWAP( &n, x, &incx, y, &incy );
+#endif
}
inline void swap( const integer_t n, traits::complex_f* x,
const integer_t incx, traits::complex_f* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_cswap( n, traits::void_ptr(x), incx, traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCswap( n, traits::void_ptr(x), incx, traits::void_ptr(y), incy );
+#else
BLAS_CSWAP( &n, traits::complex_ptr(x), &incx, traits::complex_ptr(y),
&incy );
+#endif
}
inline void swap( const integer_t n, traits::complex_d* x,
const integer_t incx, traits::complex_d* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zswap( n, traits::void_ptr(x), incx, traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZSWAP( &n, traits::complex_ptr(x), &incx, traits::complex_ptr(y),
&incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/gbmv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/gbmv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/gbmv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GBMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GBMV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,7 +34,9 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void gbmv( const char trans, const integer_t m, const integer_t n,
@@ -34,8 +44,16 @@
const float* a, const integer_t lda, const float* x,
const integer_t incx, const float beta, float* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_sgbmv( CblasColMajor,
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSgbmv( trans, m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy );
+#else
BLAS_SGBMV( &trans, &m, &n, &kl, &ku, &alpha, a, &lda, x, &incx, &beta, y,
&incy );
+#endif
}
inline void gbmv( const char trans, const integer_t m, const integer_t n,
@@ -43,8 +61,16 @@
const double* a, const integer_t lda, const double* x,
const integer_t incx, const double beta, double* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dgbmv( CblasColMajor,
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_DGBMV( &trans, &m, &n, &kl, &ku, &alpha, a, &lda, x, &incx, &beta, y,
&incy );
+#endif
}
inline void gbmv( const char trans, const integer_t m, const integer_t n,
@@ -53,9 +79,21 @@
const traits::complex_f* x, const integer_t incx,
const traits::complex_f beta, traits::complex_f* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_cgbmv( CblasColMajor,
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ m, n, kl, ku, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(x), incx, traits::void_ptr(&beta),
+ traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCgbmv( trans, m, n, kl, ku, traits::void_ptr(alpha),
+ traits::void_ptr(a), lda, traits::void_ptr(x), incx,
+ traits::void_ptr(beta), traits::void_ptr(y), incy );
+#else
BLAS_CGBMV( &trans, &m, &n, &kl, &ku, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(x), &incx,
traits::complex_ptr(&beta), traits::complex_ptr(y), &incy );
+#endif
}
inline void gbmv( const char trans, const integer_t m, const integer_t n,
@@ -64,11 +102,22 @@
const traits::complex_d* x, const integer_t incx,
const traits::complex_d beta, traits::complex_d* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zgbmv( CblasColMajor,
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ m, n, kl, ku, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(x), incx, traits::void_ptr(&beta),
+ traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZGBMV( &trans, &m, &n, &kl, &ku, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(x), &incx,
traits::complex_ptr(&beta), traits::complex_ptr(y), &incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/gemv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/gemv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/gemv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GEMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GEMV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,21 +34,39 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void gemv( const char trans, const integer_t m, const integer_t n,
const float alpha, const float* a, const integer_t lda,
const float* x, const integer_t incx, const float beta, float* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_sgemv( CblasColMajor,
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ m, n, alpha, a, lda, x, incx, beta, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSgemv( trans, m, n, alpha, a, lda, x, incx, beta, y, incy );
+#else
BLAS_SGEMV( &trans, &m, &n, &alpha, a, &lda, x, &incx, &beta, y, &incy );
+#endif
}
inline void gemv( const char trans, const integer_t m, const integer_t n,
const double alpha, const double* a, const integer_t lda,
const double* x, const integer_t incx, const double beta, double* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dgemv( CblasColMajor,
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ m, n, alpha, a, lda, x, incx, beta, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDgemv( trans, m, n, alpha, a, lda, x, incx, beta, y, incy );
+#else
BLAS_DGEMV( &trans, &m, &n, &alpha, a, &lda, x, &incx, &beta, y, &incy );
+#endif
}
inline void gemv( const char trans, const integer_t m, const integer_t n,
@@ -48,9 +74,21 @@
const integer_t lda, const traits::complex_f* x, const integer_t incx,
const traits::complex_f beta, traits::complex_f* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_cgemv( CblasColMajor,
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ m, n, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(x), incx, traits::void_ptr(&beta),
+ traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCgemv( trans, m, n, traits::void_ptr(alpha), traits::void_ptr(a),
+ lda, traits::void_ptr(x), incx, traits::void_ptr(beta),
+ traits::void_ptr(y), incy );
+#else
BLAS_CGEMV( &trans, &m, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(x), &incx,
traits::complex_ptr(&beta), traits::complex_ptr(y), &incy );
+#endif
}
inline void gemv( const char trans, const integer_t m, const integer_t n,
@@ -58,11 +96,24 @@
const integer_t lda, const traits::complex_d* x, const integer_t incx,
const traits::complex_d beta, traits::complex_d* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zgemv( CblasColMajor,
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ m, n, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(x), incx, traits::void_ptr(&beta),
+ traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasZgemv( trans, m, n, traits::void_ptr(alpha), traits::void_ptr(a),
+ lda, traits::void_ptr(x), incx, traits::void_ptr(beta),
+ traits::void_ptr(y), incy );
+#else
BLAS_ZGEMV( &trans, &m, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(x), &incx,
traits::complex_ptr(&beta), traits::complex_ptr(y), &incy );
+#endif
}
+
} // namespace detail
// value-type based template
@@ -77,7 +128,7 @@
template< typename MatrixA, typename VectorX, typename VectorY >
static return_type transform( MatrixA& A, VectorX& x, VectorY& y,
const value_type alpha, const value_type beta ) {
- invoke( );
+ invoke();
}
// static template member function
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/ger.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/ger.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/ger.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GER_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GER_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,21 +34,36 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void ger( const integer_t m, const integer_t n, const float alpha,
const float* x, const integer_t incx, const float* y,
const integer_t incy, float* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_sger( CblasColMajor, m, n, alpha, x, incx, y, incy, a, lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSger( m, n, alpha, x, incx, y, incy, a, lda );
+#else
BLAS_SGER( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
+#endif
}
inline void ger( const integer_t m, const integer_t n, const double alpha,
const double* x, const integer_t incx, const double* y,
const integer_t incy, double* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dger( CblasColMajor, m, n, alpha, x, incx, y, incy, a, lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDger( m, n, alpha, x, incx, y, incy, a, lda );
+#else
BLAS_DGER( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/gerc.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/gerc.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/gerc.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GERC_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GERC_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,27 +34,47 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void gerc( const integer_t m, const integer_t n,
const traits::complex_f alpha, const traits::complex_f* x,
const integer_t incx, const traits::complex_f* y,
const integer_t incy, traits::complex_f* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_cgerc( CblasColMajor, m, n, traits::void_ptr(&alpha),
+ traits::void_ptr(x), incx, traits::void_ptr(y), incy,
+ traits::void_ptr(a), lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCgerc( m, n, traits::void_ptr(alpha), traits::void_ptr(x), incx,
+ traits::void_ptr(y), incy, traits::void_ptr(a), lda );
+#else
BLAS_CGERC( &m, &n, traits::complex_ptr(&alpha), traits::complex_ptr(x),
&incx, traits::complex_ptr(y), &incy, traits::complex_ptr(a),
&lda );
+#endif
}
inline void gerc( const integer_t m, const integer_t n,
const traits::complex_d alpha, const traits::complex_d* x,
const integer_t incx, const traits::complex_d* y,
const integer_t incy, traits::complex_d* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zgerc( CblasColMajor, m, n, traits::void_ptr(&alpha),
+ traits::void_ptr(x), incx, traits::void_ptr(y), incy,
+ traits::void_ptr(a), lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZGERC( &m, &n, traits::complex_ptr(&alpha), traits::complex_ptr(x),
&incx, traits::complex_ptr(y), &incy, traits::complex_ptr(a),
&lda );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/geru.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/geru.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/geru.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GERU_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GERU_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,27 +34,47 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void geru( const integer_t m, const integer_t n,
const traits::complex_f alpha, const traits::complex_f* x,
const integer_t incx, const traits::complex_f* y,
const integer_t incy, traits::complex_f* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_cgeru( CblasColMajor, m, n, traits::void_ptr(&alpha),
+ traits::void_ptr(x), incx, traits::void_ptr(y), incy,
+ traits::void_ptr(a), lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCgeru( m, n, traits::void_ptr(alpha), traits::void_ptr(x), incx,
+ traits::void_ptr(y), incy, traits::void_ptr(a), lda );
+#else
BLAS_CGERU( &m, &n, traits::complex_ptr(&alpha), traits::complex_ptr(x),
&incx, traits::complex_ptr(y), &incy, traits::complex_ptr(a),
&lda );
+#endif
}
inline void geru( const integer_t m, const integer_t n,
const traits::complex_d alpha, const traits::complex_d* x,
const integer_t incx, const traits::complex_d* y,
const integer_t incy, traits::complex_d* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zgeru( CblasColMajor, m, n, traits::void_ptr(&alpha),
+ traits::void_ptr(x), incx, traits::void_ptr(y), incy,
+ traits::void_ptr(a), lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZGERU( &m, &n, traits::complex_ptr(&alpha), traits::complex_ptr(x),
&incx, traits::complex_ptr(y), &incy, traits::complex_ptr(a),
&lda );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hbmv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hbmv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hbmv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HBMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HBMV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,7 +34,9 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void hbmv( const char uplo, const integer_t n, const integer_t k,
@@ -34,9 +44,20 @@
const integer_t lda, const traits::complex_f* x, const integer_t incx,
const traits::complex_f beta, traits::complex_f* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_chbmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ k, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(x), incx, traits::void_ptr(&beta),
+ traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasChbmv( uplo, n, k, traits::void_ptr(alpha), traits::void_ptr(a),
+ lda, traits::void_ptr(x), incx, traits::void_ptr(beta),
+ traits::void_ptr(y), incy );
+#else
BLAS_CHBMV( &uplo, &n, &k, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(x), &incx,
traits::complex_ptr(&beta), traits::complex_ptr(y), &incy );
+#endif
}
inline void hbmv( const char uplo, const integer_t n, const integer_t k,
@@ -44,11 +65,21 @@
const integer_t lda, const traits::complex_d* x, const integer_t incx,
const traits::complex_d beta, traits::complex_d* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zhbmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ k, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(x), incx, traits::void_ptr(&beta),
+ traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZHBMV( &uplo, &n, &k, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(x), &incx,
traits::complex_ptr(&beta), traits::complex_ptr(y), &incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hemv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hemv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hemv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HEMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HEMV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,7 +34,9 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void hemv( const char uplo, const integer_t n,
@@ -34,9 +44,20 @@
const integer_t lda, const traits::complex_f* x, const integer_t incx,
const traits::complex_f beta, traits::complex_f* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_chemv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(x), incx, traits::void_ptr(&beta),
+ traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasChemv( uplo, n, traits::void_ptr(alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(x), incx, traits::void_ptr(beta),
+ traits::void_ptr(y), incy );
+#else
BLAS_CHEMV( &uplo, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(x), &incx,
traits::complex_ptr(&beta), traits::complex_ptr(y), &incy );
+#endif
}
inline void hemv( const char uplo, const integer_t n,
@@ -44,11 +65,21 @@
const integer_t lda, const traits::complex_d* x, const integer_t incx,
const traits::complex_d beta, traits::complex_d* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zhemv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(x), incx, traits::void_ptr(&beta),
+ traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZHEMV( &uplo, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(x), &incx,
traits::complex_ptr(&beta), traits::complex_ptr(y), &incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/her.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/her.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/her.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HER_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HER_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,23 +34,41 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void her( const char uplo, const integer_t n, const float alpha,
const traits::complex_f* x, const integer_t incx,
traits::complex_f* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_cher( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, traits::void_ptr(x), incx, traits::void_ptr(a), lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCher( uplo, n, alpha, traits::void_ptr(x), incx,
+ traits::void_ptr(a), lda );
+#else
BLAS_CHER( &uplo, &n, &alpha, traits::complex_ptr(x), &incx,
traits::complex_ptr(a), &lda );
+#endif
}
inline void her( const char uplo, const integer_t n, const double alpha,
const traits::complex_d* x, const integer_t incx,
traits::complex_d* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zher( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, traits::void_ptr(x), incx, traits::void_ptr(a), lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZHER( &uplo, &n, &alpha, traits::complex_ptr(x), &incx,
traits::complex_ptr(a), &lda );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/her2.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/her2.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/her2.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HER2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HER2_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,27 +34,47 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void her2( const char uplo, const integer_t n,
const traits::complex_f alpha, const traits::complex_f* x,
const integer_t incx, const traits::complex_f* y,
const integer_t incy, traits::complex_f* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_cher2( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ traits::void_ptr(&alpha), traits::void_ptr(x), incx,
+ traits::void_ptr(y), incy, traits::void_ptr(a), lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCher2( uplo, n, traits::void_ptr(alpha), traits::void_ptr(x), incx,
+ traits::void_ptr(y), incy, traits::void_ptr(a), lda );
+#else
BLAS_CHER2( &uplo, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(x), &incx, traits::complex_ptr(y), &incy,
traits::complex_ptr(a), &lda );
+#endif
}
inline void her2( const char uplo, const integer_t n,
const traits::complex_d alpha, const traits::complex_d* x,
const integer_t incx, const traits::complex_d* y,
const integer_t incy, traits::complex_d* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zher2( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ traits::void_ptr(&alpha), traits::void_ptr(x), incx,
+ traits::void_ptr(y), incy, traits::void_ptr(a), lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZHER2( &uplo, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(x), &incx, traits::complex_ptr(y), &incy,
traits::complex_ptr(a), &lda );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hpmv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hpmv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hpmv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPMV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,7 +34,9 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void hpmv( const char uplo, const integer_t n,
@@ -34,9 +44,20 @@
const traits::complex_f* x, const integer_t incx,
const traits::complex_f beta, traits::complex_f* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_chpmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ traits::void_ptr(&alpha), traits::void_ptr(ap),
+ traits::void_ptr(x), incx, traits::void_ptr(&beta),
+ traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasChpmv( uplo, n, traits::void_ptr(alpha), traits::void_ptr(ap),
+ traits::void_ptr(x), incx, traits::void_ptr(beta),
+ traits::void_ptr(y), incy );
+#else
BLAS_CHPMV( &uplo, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(ap), traits::complex_ptr(x), &incx,
traits::complex_ptr(&beta), traits::complex_ptr(y), &incy );
+#endif
}
inline void hpmv( const char uplo, const integer_t n,
@@ -44,11 +65,21 @@
const traits::complex_d* x, const integer_t incx,
const traits::complex_d beta, traits::complex_d* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zhpmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ traits::void_ptr(&alpha), traits::void_ptr(ap),
+ traits::void_ptr(x), incx, traits::void_ptr(&beta),
+ traits::void_ptr(y), incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZHPMV( &uplo, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(ap), traits::complex_ptr(x), &incx,
traits::complex_ptr(&beta), traits::complex_ptr(y), &incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hpr.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hpr.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hpr.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPR_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPR_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,23 +34,41 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void hpr( const char uplo, const integer_t n, const float alpha,
const traits::complex_f* x, const integer_t incx,
traits::complex_f* ap ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_chpr( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, traits::void_ptr(x), incx, traits::void_ptr(ap) );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasChpr( uplo, n, alpha, traits::void_ptr(x), incx,
+ traits::void_ptr(ap) );
+#else
BLAS_CHPR( &uplo, &n, &alpha, traits::complex_ptr(x), &incx,
traits::complex_ptr(ap) );
+#endif
}
inline void hpr( const char uplo, const integer_t n, const double alpha,
const traits::complex_d* x, const integer_t incx,
traits::complex_d* ap ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zhpr( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, traits::void_ptr(x), incx, traits::void_ptr(ap) );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZHPR( &uplo, &n, &alpha, traits::complex_ptr(x), &incx,
traits::complex_ptr(ap) );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hpr2.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hpr2.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/hpr2.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPR2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPR2_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,27 +34,47 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void hpr2( const char uplo, const integer_t n,
const traits::complex_f alpha, const traits::complex_f* x,
const integer_t incx, const traits::complex_f* y,
const integer_t incy, traits::complex_f* ap ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_chpr2( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ traits::void_ptr(&alpha), traits::void_ptr(x), incx,
+ traits::void_ptr(y), incy, traits::void_ptr(ap) );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasChpr2( uplo, n, traits::void_ptr(alpha), traits::void_ptr(x), incx,
+ traits::void_ptr(y), incy, traits::void_ptr(ap) );
+#else
BLAS_CHPR2( &uplo, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(x), &incx, traits::complex_ptr(y), &incy,
traits::complex_ptr(ap) );
+#endif
}
inline void hpr2( const char uplo, const integer_t n,
const traits::complex_d alpha, const traits::complex_d* x,
const integer_t incx, const traits::complex_d* y,
const integer_t incy, traits::complex_d* ap ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zhpr2( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ traits::void_ptr(&alpha), traits::void_ptr(x), incx,
+ traits::void_ptr(y), incy, traits::void_ptr(ap) );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZHPR2( &uplo, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(x), &incx, traits::complex_ptr(y), &incy,
traits::complex_ptr(ap) );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/sbmv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/sbmv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/sbmv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SBMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SBMV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,23 +34,40 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void sbmv( const char uplo, const integer_t n, const integer_t k,
const float alpha, const float* a, const integer_t lda,
const float* x, const integer_t incx, const float beta, float* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ssbmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ k, alpha, a, lda, x, incx, beta, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSsbmv( uplo, n, k, alpha, a, lda, x, incx, beta, y, incy );
+#else
BLAS_SSBMV( &uplo, &n, &k, &alpha, a, &lda, x, &incx, &beta, y, &incy );
+#endif
}
inline void sbmv( const char uplo, const integer_t n, const integer_t k,
const double alpha, const double* a, const integer_t lda,
const double* x, const integer_t incx, const double beta, double* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dsbmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ k, alpha, a, lda, x, incx, beta, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_DSBMV( &uplo, &n, &k, &alpha, a, &lda, x, &incx, &beta, y, &incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/spmv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/spmv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/spmv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPMV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,21 +34,38 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void spmv( const char uplo, const integer_t n, const float alpha,
const float* ap, const float* x, const integer_t incx,
const float beta, float* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_sspmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, ap, x, incx, beta, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSspmv( uplo, n, alpha, ap, x, incx, beta, y, incy );
+#else
BLAS_SSPMV( &uplo, &n, &alpha, ap, x, &incx, &beta, y, &incy );
+#endif
}
inline void spmv( const char uplo, const integer_t n, const double alpha,
const double* ap, const double* x, const integer_t incx,
const double beta, double* y, const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dspmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, ap, x, incx, beta, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_DSPMV( &uplo, &n, &alpha, ap, x, &incx, &beta, y, &incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/spr.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/spr.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/spr.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPR_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPR_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,19 +34,36 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void spr( const char uplo, const integer_t n, const float alpha,
const float* x, const integer_t incx, float* ap ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_sspr( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, x, incx, ap );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSspr( uplo, n, alpha, x, incx, ap );
+#else
BLAS_SSPR( &uplo, &n, &alpha, x, &incx, ap );
+#endif
}
inline void spr( const char uplo, const integer_t n, const double alpha,
const double* x, const integer_t incx, double* ap ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dspr( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, x, incx, ap );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_DSPR( &uplo, &n, &alpha, x, &incx, ap );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/spr2.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/spr2.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/spr2.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPR2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPR2_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,21 +34,38 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void spr2( const char uplo, const integer_t n, const float alpha,
const float* x, const integer_t incx, const float* y,
const integer_t incy, float* ap ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_sspr2( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, x, incx, y, incy, ap );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSspr2( uplo, n, alpha, x, incx, y, incy, ap );
+#else
BLAS_SSPR2( &uplo, &n, &alpha, x, &incx, y, &incy, ap );
+#endif
}
inline void spr2( const char uplo, const integer_t n, const double alpha,
const double* x, const integer_t incx, const double* y,
const integer_t incy, double* ap ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dspr2( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, x, incx, y, incy, ap );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_DSPR2( &uplo, &n, &alpha, x, &incx, y, &incy, ap );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/symv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/symv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/symv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYMV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,23 +34,40 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void symv( const char uplo, const integer_t n, const float alpha,
const float* a, const integer_t lda, const float* x,
const integer_t incx, const float beta, float* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ssymv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, a, lda, x, incx, beta, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSsymv( uplo, n, alpha, a, lda, x, incx, beta, y, incy );
+#else
BLAS_SSYMV( &uplo, &n, &alpha, a, &lda, x, &incx, &beta, y, &incy );
+#endif
}
inline void symv( const char uplo, const integer_t n, const double alpha,
const double* a, const integer_t lda, const double* x,
const integer_t incx, const double beta, double* y,
const integer_t incy ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dsymv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, a, lda, x, incx, beta, y, incy );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_DSYMV( &uplo, &n, &alpha, a, &lda, x, &incx, &beta, y, &incy );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/syr.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/syr.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/syr.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYR_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYR_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,20 +34,37 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void syr( const char uplo, const integer_t n, const float alpha,
const float* x, const integer_t incx, float* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ssyr( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, x, incx, a, lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSsyr( uplo, n, alpha, x, incx, a, lda );
+#else
BLAS_SSYR( &uplo, &n, &alpha, x, &incx, a, &lda );
+#endif
}
inline void syr( const char uplo, const integer_t n, const double alpha,
const double* x, const integer_t incx, double* a,
const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dsyr( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, x, incx, a, lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDsyr( uplo, n, alpha, x, incx, a, lda );
+#else
BLAS_DSYR( &uplo, &n, &alpha, x, &incx, a, &lda );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/syr2.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/syr2.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/syr2.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYR2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYR2_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,21 +34,38 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void syr2( const char uplo, const integer_t n, const float alpha,
const float* x, const integer_t incx, const float* y,
const integer_t incy, float* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ssyr2( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, x, incx, y, incy, a, lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSsyr2( uplo, n, alpha, x, incx, y, incy, a, lda );
+#else
BLAS_SSYR2( &uplo, &n, &alpha, x, &incx, y, &incy, a, &lda );
+#endif
}
inline void syr2( const char uplo, const integer_t n, const double alpha,
const double* x, const integer_t incx, const double* y,
const integer_t incy, double* a, const integer_t lda ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dsyr2( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ), n,
+ alpha, x, incx, y, incy, a, lda );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_DSYR2( &uplo, &n, &alpha, x, &incx, y, &incy, a, &lda );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tbmv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tbmv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tbmv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TBMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TBMV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,35 +34,75 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void tbmv( const char uplo, const char trans, const char diag,
const integer_t n, const integer_t k, const float* a,
const integer_t lda, float* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_stbmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, k, a, lda, x,
+ incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasStbmv( uplo, trans, diag, n, k, a, lda, x, incx );
+#else
BLAS_STBMV( &uplo, &trans, &diag, &n, &k, a, &lda, x, &incx );
+#endif
}
inline void tbmv( const char uplo, const char trans, const char diag,
const integer_t n, const integer_t k, const double* a,
const integer_t lda, double* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dtbmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, k, a, lda, x,
+ incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_DTBMV( &uplo, &trans, &diag, &n, &k, a, &lda, x, &incx );
+#endif
}
inline void tbmv( const char uplo, const char trans, const char diag,
const integer_t n, const integer_t k, const traits::complex_f* a,
const integer_t lda, traits::complex_f* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ctbmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, k,
+ traits::void_ptr(a), lda, traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCtbmv( uplo, trans, diag, n, k, traits::void_ptr(a), lda,
+ traits::void_ptr(x), incx );
+#else
BLAS_CTBMV( &uplo, &trans, &diag, &n, &k, traits::complex_ptr(a), &lda,
traits::complex_ptr(x), &incx );
+#endif
}
inline void tbmv( const char uplo, const char trans, const char diag,
const integer_t n, const integer_t k, const traits::complex_d* a,
const integer_t lda, traits::complex_d* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ztbmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, k,
+ traits::void_ptr(a), lda, traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZTBMV( &uplo, &trans, &diag, &n, &k, traits::complex_ptr(a), &lda,
traits::complex_ptr(x), &incx );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tbsv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tbsv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tbsv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TBSV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TBSV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,35 +34,75 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void tbsv( const char uplo, const char trans, const char diag,
const integer_t n, const integer_t k, const float* a,
const integer_t lda, float* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_stbsv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, k, a, lda, x,
+ incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasStbsv( uplo, trans, diag, n, k, a, lda, x, incx );
+#else
BLAS_STBSV( &uplo, &trans, &diag, &n, &k, a, &lda, x, &incx );
+#endif
}
inline void tbsv( const char uplo, const char trans, const char diag,
const integer_t n, const integer_t k, const double* a,
const integer_t lda, double* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dtbsv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, k, a, lda, x,
+ incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_DTBSV( &uplo, &trans, &diag, &n, &k, a, &lda, x, &incx );
+#endif
}
inline void tbsv( const char uplo, const char trans, const char diag,
const integer_t n, const integer_t k, const traits::complex_f* a,
const integer_t lda, traits::complex_f* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ctbsv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, k,
+ traits::void_ptr(a), lda, traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCtbsv( uplo, trans, diag, n, k, traits::void_ptr(a), lda,
+ traits::void_ptr(x), incx );
+#else
BLAS_CTBSV( &uplo, &trans, &diag, &n, &k, traits::complex_ptr(a), &lda,
traits::complex_ptr(x), &incx );
+#endif
}
inline void tbsv( const char uplo, const char trans, const char diag,
const integer_t n, const integer_t k, const traits::complex_d* a,
const integer_t lda, traits::complex_d* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ztbsv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, k,
+ traits::void_ptr(a), lda, traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZTBSV( &uplo, &trans, &diag, &n, &k, traits::complex_ptr(a), &lda,
traits::complex_ptr(x), &incx );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tpmv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tpmv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tpmv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TPMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TPMV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,34 +34,72 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void tpmv( const char uplo, const char trans, const char diag,
const integer_t n, const float* ap, float* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_stpmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, ap, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasStpmv( uplo, trans, diag, n, ap, x, incx );
+#else
BLAS_STPMV( &uplo, &trans, &diag, &n, ap, x, &incx );
+#endif
}
inline void tpmv( const char uplo, const char trans, const char diag,
const integer_t n, const double* ap, double* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dtpmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, ap, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_DTPMV( &uplo, &trans, &diag, &n, ap, x, &incx );
+#endif
}
inline void tpmv( const char uplo, const char trans, const char diag,
const integer_t n, const traits::complex_f* ap, traits::complex_f* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ctpmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n,
+ traits::void_ptr(ap), traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCtpmv( uplo, trans, diag, n, traits::void_ptr(ap),
+ traits::void_ptr(x), incx );
+#else
BLAS_CTPMV( &uplo, &trans, &diag, &n, traits::complex_ptr(ap),
traits::complex_ptr(x), &incx );
+#endif
}
inline void tpmv( const char uplo, const char trans, const char diag,
const integer_t n, const traits::complex_d* ap, traits::complex_d* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ztpmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n,
+ traits::void_ptr(ap), traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZTPMV( &uplo, &trans, &diag, &n, traits::complex_ptr(ap),
traits::complex_ptr(x), &incx );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tpsv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tpsv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/tpsv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TPSV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TPSV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,34 +34,72 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void tpsv( const char uplo, const char trans, const char diag,
const integer_t n, const float* ap, float* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_stpsv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, ap, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasStpsv( uplo, trans, diag, n, ap, x, incx );
+#else
BLAS_STPSV( &uplo, &trans, &diag, &n, ap, x, &incx );
+#endif
}
inline void tpsv( const char uplo, const char trans, const char diag,
const integer_t n, const double* ap, double* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dtpsv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, ap, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_DTPSV( &uplo, &trans, &diag, &n, ap, x, &incx );
+#endif
}
inline void tpsv( const char uplo, const char trans, const char diag,
const integer_t n, const traits::complex_f* ap, traits::complex_f* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ctpsv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n,
+ traits::void_ptr(ap), traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCtpsv( uplo, trans, diag, n, traits::void_ptr(ap),
+ traits::void_ptr(x), incx );
+#else
BLAS_CTPSV( &uplo, &trans, &diag, &n, traits::complex_ptr(ap),
traits::complex_ptr(x), &incx );
+#endif
}
inline void tpsv( const char uplo, const char trans, const char diag,
const integer_t n, const traits::complex_d* ap, traits::complex_d* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ztpsv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n,
+ traits::void_ptr(ap), traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZTPSV( &uplo, &trans, &diag, &n, traits::complex_ptr(ap),
traits::complex_ptr(x), &incx );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/trmv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/trmv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/trmv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TRMV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TRMV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,35 +34,72 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void trmv( const char uplo, const char trans, const char diag,
const integer_t n, const float* a, const integer_t lda, float* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_strmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, a, lda, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasStrmv( uplo, trans, diag, n, a, lda, x, incx );
+#else
BLAS_STRMV( &uplo, &trans, &diag, &n, a, &lda, x, &incx );
+#endif
}
inline void trmv( const char uplo, const char trans, const char diag,
const integer_t n, const double* a, const integer_t lda, double* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dtrmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, a, lda, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_DTRMV( &uplo, &trans, &diag, &n, a, &lda, x, &incx );
+#endif
}
inline void trmv( const char uplo, const char trans, const char diag,
const integer_t n, const traits::complex_f* a, const integer_t lda,
traits::complex_f* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ctrmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n,
+ traits::void_ptr(a), lda, traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_CTRMV( &uplo, &trans, &diag, &n, traits::complex_ptr(a), &lda,
traits::complex_ptr(x), &incx );
+#endif
}
inline void trmv( const char uplo, const char trans, const char diag,
const integer_t n, const traits::complex_d* a, const integer_t lda,
traits::complex_d* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ztrmv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n,
+ traits::void_ptr(a), lda, traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZTRMV( &uplo, &trans, &diag, &n, traits::complex_ptr(a), &lda,
traits::complex_ptr(x), &incx );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/trsv.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/trsv.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level2/trsv.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TRSV_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TRSV_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,35 +34,73 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void trsv( const char uplo, const char trans, const char diag,
const integer_t n, const float* a, const integer_t lda, float* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_strsv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, a, lda, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasStrsv( uplo, trans, diag, n, a, lda, x, incx );
+#else
BLAS_STRSV( &uplo, &trans, &diag, &n, a, &lda, x, &incx );
+#endif
}
inline void trsv( const char uplo, const char trans, const char diag,
const integer_t n, const double* a, const integer_t lda, double* x,
const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dtrsv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n, a, lda, x, incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDtrsv( uplo, trans, diag, n, a, lda, x, incx );
+#else
BLAS_DTRSV( &uplo, &trans, &diag, &n, a, &lda, x, &incx );
+#endif
}
inline void trsv( const char uplo, const char trans, const char diag,
const integer_t n, const traits::complex_f* a, const integer_t lda,
traits::complex_f* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ctrsv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n,
+ traits::void_ptr(a), lda, traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCtrsv( uplo, trans, diag, n, traits::void_ptr(a), lda,
+ traits::void_ptr(x), incx );
+#else
BLAS_CTRSV( &uplo, &trans, &diag, &n, traits::complex_ptr(a), &lda,
traits::complex_ptr(x), &incx );
+#endif
}
inline void trsv( const char uplo, const char trans, const char diag,
const integer_t n, const traits::complex_d* a, const integer_t lda,
traits::complex_d* x, const integer_t incx ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ztrsv( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), n,
+ traits::void_ptr(a), lda, traits::void_ptr(x), incx );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZTRSV( &uplo, &trans, &diag, &n, traits::complex_ptr(a), &lda,
traits::complex_ptr(x), &incx );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/gemm.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/gemm.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/gemm.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_GEMM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_GEMM_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,7 +34,9 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void gemm( const char transa, const char transb, const integer_t m,
@@ -34,8 +44,18 @@
const float* a, const integer_t lda, const float* b,
const integer_t ldb, const float beta, float* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_sgemm( CblasColMajor,
+ ( transa == 'N' ? CblasNoTrans : ( transa == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( transb == 'N' ? CblasNoTrans : ( transb == 'T' ? CblasTrans : CblasConjTrans ) ),
+ m, n, k, alpha, a, lda, b, ldb, beta, c, ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSgemm( transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c,
+ ldc );
+#else
BLAS_SGEMM( &transa, &transb, &m, &n, &k, &alpha, a, &lda, b, &ldb, &beta,
c, &ldc );
+#endif
}
inline void gemm( const char transa, const char transb, const integer_t m,
@@ -43,8 +63,18 @@
const double* a, const integer_t lda, const double* b,
const integer_t ldb, const double beta, double* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dgemm( CblasColMajor,
+ ( transa == 'N' ? CblasNoTrans : ( transa == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( transb == 'N' ? CblasNoTrans : ( transb == 'T' ? CblasTrans : CblasConjTrans ) ),
+ m, n, k, alpha, a, lda, b, ldb, beta, c, ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDgemm( transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c,
+ ldc );
+#else
BLAS_DGEMM( &transa, &transb, &m, &n, &k, &alpha, a, &lda, b, &ldb, &beta,
c, &ldc );
+#endif
}
inline void gemm( const char transa, const char transb, const integer_t m,
@@ -53,9 +83,22 @@
const traits::complex_f* b, const integer_t ldb,
const traits::complex_f beta, traits::complex_f* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_cgemm( CblasColMajor,
+ ( transa == 'N' ? CblasNoTrans : ( transa == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( transb == 'N' ? CblasNoTrans : ( transb == 'T' ? CblasTrans : CblasConjTrans ) ),
+ m, n, k, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb, traits::void_ptr(&beta),
+ traits::void_ptr(c), ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCgemm( transa, transb, m, n, k, traits::void_ptr(alpha),
+ traits::void_ptr(a), lda, traits::void_ptr(b), ldb,
+ traits::void_ptr(beta), traits::void_ptr(c), ldc );
+#else
BLAS_CGEMM( &transa, &transb, &m, &n, &k, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(b), &ldb,
traits::complex_ptr(&beta), traits::complex_ptr(c), &ldc );
+#endif
}
inline void gemm( const char transa, const char transb, const integer_t m,
@@ -64,11 +107,25 @@
const traits::complex_d* b, const integer_t ldb,
const traits::complex_d beta, traits::complex_d* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zgemm( CblasColMajor,
+ ( transa == 'N' ? CblasNoTrans : ( transa == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( transb == 'N' ? CblasNoTrans : ( transb == 'T' ? CblasTrans : CblasConjTrans ) ),
+ m, n, k, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb, traits::void_ptr(&beta),
+ traits::void_ptr(c), ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasZgemm( transa, transb, m, n, k, traits::void_ptr(alpha),
+ traits::void_ptr(a), lda, traits::void_ptr(b), ldb,
+ traits::void_ptr(beta), traits::void_ptr(c), ldc );
+#else
BLAS_ZGEMM( &transa, &transb, &m, &n, &k, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(b), &ldb,
traits::complex_ptr(&beta), traits::complex_ptr(c), &ldc );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/hemm.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/hemm.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/hemm.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HEMM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HEMM_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,7 +34,9 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void hemm( const char side, const char uplo, const integer_t m,
@@ -35,9 +45,21 @@
const traits::complex_f* b, const integer_t ldb,
const traits::complex_f beta, traits::complex_f* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_chemm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ), m, n,
+ traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb, traits::void_ptr(&beta),
+ traits::void_ptr(c), ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasChemm( side, uplo, m, n, traits::void_ptr(alpha),
+ traits::void_ptr(a), lda, traits::void_ptr(b), ldb,
+ traits::void_ptr(beta), traits::void_ptr(c), ldc );
+#else
BLAS_CHEMM( &side, &uplo, &m, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(b), &ldb,
traits::complex_ptr(&beta), traits::complex_ptr(c), &ldc );
+#endif
}
inline void hemm( const char side, const char uplo, const integer_t m,
@@ -46,11 +68,22 @@
const traits::complex_d* b, const integer_t ldb,
const traits::complex_d beta, traits::complex_d* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zhemm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ), m, n,
+ traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb, traits::void_ptr(&beta),
+ traits::void_ptr(c), ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZHEMM( &side, &uplo, &m, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(b), &ldb,
traits::complex_ptr(&beta), traits::complex_ptr(c), &ldc );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/her2k.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/her2k.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/her2k.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HER2K_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HER2K_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,7 +34,9 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void her2k( const char uplo, const char trans, const integer_t n,
@@ -34,9 +44,20 @@
const traits::complex_f* a, const integer_t lda,
const traits::complex_f* b, const integer_t ldb, const float beta,
traits::complex_f* c, const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_cher2k( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ n, k, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb, beta, traits::void_ptr(c), ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCher2k( uplo, trans, n, k, traits::void_ptr(alpha),
+ traits::void_ptr(a), lda, traits::void_ptr(b), ldb, beta,
+ traits::void_ptr(c), ldc );
+#else
BLAS_CHER2K( &uplo, &trans, &n, &k, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(b), &ldb, &beta,
traits::complex_ptr(c), &ldc );
+#endif
}
inline void her2k( const char uplo, const char trans, const integer_t n,
@@ -44,11 +65,21 @@
const traits::complex_d* a, const integer_t lda,
const traits::complex_d* b, const integer_t ldb, const double beta,
traits::complex_d* c, const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zher2k( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ n, k, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb, beta, traits::void_ptr(c), ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZHER2K( &uplo, &trans, &n, &k, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(b), &ldb, &beta,
traits::complex_ptr(c), &ldc );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/herk.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/herk.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/herk.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HERK_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HERK_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,25 +34,47 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void herk( const char uplo, const char trans, const integer_t n,
const integer_t k, const float alpha, const traits::complex_f* a,
const integer_t lda, const float beta, traits::complex_f* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_cherk( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ n, k, alpha, traits::void_ptr(a), lda, beta, traits::void_ptr(c),
+ ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCherk( uplo, trans, n, k, alpha, traits::void_ptr(a), lda, beta,
+ traits::void_ptr(c), ldc );
+#else
BLAS_CHERK( &uplo, &trans, &n, &k, &alpha, traits::complex_ptr(a), &lda,
&beta, traits::complex_ptr(c), &ldc );
+#endif
}
inline void herk( const char uplo, const char trans, const integer_t n,
const integer_t k, const double alpha, const traits::complex_d* a,
const integer_t lda, const double beta, traits::complex_d* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zherk( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ n, k, alpha, traits::void_ptr(a), lda, beta, traits::void_ptr(c),
+ ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZHERK( &uplo, &trans, &n, &k, &alpha, traits::complex_ptr(a), &lda,
&beta, traits::complex_ptr(c), &ldc );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/symm.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/symm.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/symm.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYMM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYMM_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,23 +34,41 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void symm( const char side, const char uplo, const integer_t m,
const integer_t n, const float alpha, const float* a,
const integer_t lda, const float* b, const integer_t ldb,
const float beta, float* c, const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ssymm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ), m, n, alpha, a, lda, b,
+ ldb, beta, c, ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSsymm( side, uplo, m, n, alpha, a, lda, b, ldb, beta, c, ldc );
+#else
BLAS_SSYMM( &side, &uplo, &m, &n, &alpha, a, &lda, b, &ldb, &beta, c,
&ldc );
+#endif
}
inline void symm( const char side, const char uplo, const integer_t m,
const integer_t n, const double alpha, const double* a,
const integer_t lda, const double* b, const integer_t ldb,
const double beta, double* c, const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dsymm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ), m, n, alpha, a, lda, b,
+ ldb, beta, c, ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDsymm( side, uplo, m, n, alpha, a, lda, b, ldb, beta, c, ldc );
+#else
BLAS_DSYMM( &side, &uplo, &m, &n, &alpha, a, &lda, b, &ldb, &beta, c,
&ldc );
+#endif
}
inline void symm( const char side, const char uplo, const integer_t m,
@@ -51,9 +77,21 @@
const traits::complex_f* b, const integer_t ldb,
const traits::complex_f beta, traits::complex_f* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_csymm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ), m, n,
+ traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb, traits::void_ptr(&beta),
+ traits::void_ptr(c), ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCsymm( side, uplo, m, n, traits::void_ptr(alpha),
+ traits::void_ptr(a), lda, traits::void_ptr(b), ldb,
+ traits::void_ptr(beta), traits::void_ptr(c), ldc );
+#else
BLAS_CSYMM( &side, &uplo, &m, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(b), &ldb,
traits::complex_ptr(&beta), traits::complex_ptr(c), &ldc );
+#endif
}
inline void symm( const char side, const char uplo, const integer_t m,
@@ -62,11 +100,22 @@
const traits::complex_d* b, const integer_t ldb,
const traits::complex_d beta, traits::complex_d* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zsymm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ), m, n,
+ traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb, traits::void_ptr(&beta),
+ traits::void_ptr(c), ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZSYMM( &side, &uplo, &m, &n, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(b), &ldb,
traits::complex_ptr(&beta), traits::complex_ptr(c), &ldc );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/syr2k.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/syr2k.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/syr2k.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYR2K_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYR2K_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,23 +34,41 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void syr2k( const char uplo, const char trans, const integer_t n,
const integer_t k, const float alpha, const float* a,
const integer_t lda, const float* b, const integer_t ldb,
const float beta, float* c, const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ssyr2k( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ n, k, alpha, a, lda, b, ldb, beta, c, ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSsyr2k( uplo, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc );
+#else
BLAS_SSYR2K( &uplo, &trans, &n, &k, &alpha, a, &lda, b, &ldb, &beta, c,
&ldc );
+#endif
}
inline void syr2k( const char uplo, const char trans, const integer_t n,
const integer_t k, const double alpha, const double* a,
const integer_t lda, const double* b, const integer_t ldb,
const double beta, double* c, const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dsyr2k( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ n, k, alpha, a, lda, b, ldb, beta, c, ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDsyr2k( uplo, trans, n, k, alpha, a, lda, b, ldb, beta, c, ldc );
+#else
BLAS_DSYR2K( &uplo, &trans, &n, &k, &alpha, a, &lda, b, &ldb, &beta, c,
&ldc );
+#endif
}
inline void syr2k( const char uplo, const char trans, const integer_t n,
@@ -51,9 +77,21 @@
const traits::complex_f* b, const integer_t ldb,
const traits::complex_f beta, traits::complex_f* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_csyr2k( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ n, k, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb, traits::void_ptr(&beta),
+ traits::void_ptr(c), ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCsyr2k( uplo, trans, n, k, traits::void_ptr(alpha),
+ traits::void_ptr(a), lda, traits::void_ptr(b), ldb,
+ traits::void_ptr(beta), traits::void_ptr(c), ldc );
+#else
BLAS_CSYR2K( &uplo, &trans, &n, &k, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(b), &ldb,
traits::complex_ptr(&beta), traits::complex_ptr(c), &ldc );
+#endif
}
inline void syr2k( const char uplo, const char trans, const integer_t n,
@@ -62,11 +100,22 @@
const traits::complex_d* b, const integer_t ldb,
const traits::complex_d beta, traits::complex_d* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zsyr2k( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ n, k, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb, traits::void_ptr(&beta),
+ traits::void_ptr(c), ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZSYR2K( &uplo, &trans, &n, &k, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(b), &ldb,
traits::complex_ptr(&beta), traits::complex_ptr(c), &ldc );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/syrk.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/syrk.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/syrk.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYRK_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYRK_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,21 +34,39 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void syrk( const char uplo, const char trans, const integer_t n,
const integer_t k, const float alpha, const float* a,
const integer_t lda, const float beta, float* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ssyrk( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ n, k, alpha, a, lda, beta, c, ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasSsyrk( uplo, trans, n, k, alpha, a, lda, beta, c, ldc );
+#else
BLAS_SSYRK( &uplo, &trans, &n, &k, &alpha, a, &lda, &beta, c, &ldc );
+#endif
}
inline void syrk( const char uplo, const char trans, const integer_t n,
const integer_t k, const double alpha, const double* a,
const integer_t lda, const double beta, double* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dsyrk( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ n, k, alpha, a, lda, beta, c, ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDsyrk( uplo, trans, n, k, alpha, a, lda, beta, c, ldc );
+#else
BLAS_DSYRK( &uplo, &trans, &n, &k, &alpha, a, &lda, &beta, c, &ldc );
+#endif
}
inline void syrk( const char uplo, const char trans, const integer_t n,
@@ -48,9 +74,20 @@
const traits::complex_f* a, const integer_t lda,
const traits::complex_f beta, traits::complex_f* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_csyrk( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ n, k, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(&beta), traits::void_ptr(c), ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCsyrk( uplo, trans, n, k, traits::void_ptr(alpha),
+ traits::void_ptr(a), lda, traits::void_ptr(beta),
+ traits::void_ptr(c), ldc );
+#else
BLAS_CSYRK( &uplo, &trans, &n, &k, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(&beta),
traits::complex_ptr(c), &ldc );
+#endif
}
inline void syrk( const char uplo, const char trans, const integer_t n,
@@ -58,11 +95,23 @@
const traits::complex_d* a, const integer_t lda,
const traits::complex_d beta, traits::complex_d* c,
const integer_t ldc ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_zsyrk( CblasColMajor, ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( trans == 'N' ? CblasNoTrans : ( trans == 'T' ? CblasTrans : CblasConjTrans ) ),
+ n, k, traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(&beta), traits::void_ptr(c), ldc );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasZsyrk( uplo, trans, n, k, traits::void_ptr(alpha),
+ traits::void_ptr(a), lda, traits::void_ptr(beta),
+ traits::void_ptr(c), ldc );
+#else
BLAS_ZSYRK( &uplo, &trans, &n, &k, traits::complex_ptr(&alpha),
traits::complex_ptr(a), &lda, traits::complex_ptr(&beta),
traits::complex_ptr(c), &ldc );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/trmm.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/trmm.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/trmm.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_TRMM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_TRMM_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,43 +34,89 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void trmm( const char side, const char uplo, const char transa,
const char diag, const integer_t m, const integer_t n,
const float alpha, const float* a, const integer_t lda, float* b,
const integer_t ldb ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_strmm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( transa == 'N' ? CblasNoTrans : ( transa == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), m, n, alpha, a, lda,
+ b, ldb );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasStrmm( side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb );
+#else
BLAS_STRMM( &side, &uplo, &transa, &diag, &m, &n, &alpha, a, &lda, b,
&ldb );
+#endif
}
inline void trmm( const char side, const char uplo, const char transa,
const char diag, const integer_t m, const integer_t n,
const double alpha, const double* a, const integer_t lda, double* b,
const integer_t ldb ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dtrmm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( transa == 'N' ? CblasNoTrans : ( transa == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), m, n, alpha, a, lda,
+ b, ldb );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDtrmm( side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb );
+#else
BLAS_DTRMM( &side, &uplo, &transa, &diag, &m, &n, &alpha, a, &lda, b,
&ldb );
+#endif
}
inline void trmm( const char side, const char uplo, const char transa,
const char diag, const integer_t m, const integer_t n,
const traits::complex_f alpha, const traits::complex_f* a,
const integer_t lda, traits::complex_f* b, const integer_t ldb ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ctrmm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( transa == 'N' ? CblasNoTrans : ( transa == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), m, n,
+ traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCtrmm( side, uplo, transa, diag, m, n, traits::void_ptr(alpha),
+ traits::void_ptr(a), lda, traits::void_ptr(b), ldb );
+#else
BLAS_CTRMM( &side, &uplo, &transa, &diag, &m, &n,
traits::complex_ptr(&alpha), traits::complex_ptr(a), &lda,
traits::complex_ptr(b), &ldb );
+#endif
}
inline void trmm( const char side, const char uplo, const char transa,
const char diag, const integer_t m, const integer_t n,
const traits::complex_d alpha, const traits::complex_d* a,
const integer_t lda, traits::complex_d* b, const integer_t ldb ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ztrmm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( transa == 'N' ? CblasNoTrans : ( transa == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), m, n,
+ traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ // NOT FOUND();
+#else
BLAS_ZTRMM( &side, &uplo, &transa, &diag, &m, &n,
traits::complex_ptr(&alpha), traits::complex_ptr(a), &lda,
traits::complex_ptr(b), &ldb );
+#endif
}
+
} // namespace detail
// value-type based template
Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/trsm.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/trsm.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level3/trsm.hpp 2009-10-14 08:47:20 EDT (Wed, 14 Oct 2009)
@@ -14,8 +14,16 @@
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_TRSM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_TRSM_HPP
-#include <boost/mpl/bool.hpp>
+// Include header of configured BLAS interface
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#else
#include <boost/numeric/bindings/blas/detail/blas.h>
+#endif
+
+#include <boost/mpl/bool.hpp>
#include <boost/numeric/bindings/traits/traits.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/static_assert.hpp>
@@ -26,43 +34,90 @@
namespace bindings {
namespace blas {
-// overloaded functions to call blas
+// The detail namespace is used for overloads on value type,
+// and to dispatch to the right routine
+
namespace detail {
inline void trsm( const char side, const char uplo, const char transa,
const char diag, const integer_t m, const integer_t n,
const float alpha, const float* a, const integer_t lda, float* b,
const integer_t ldb ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_strsm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( transa == 'N' ? CblasNoTrans : ( transa == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), m, n, alpha, a, lda,
+ b, ldb );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasStrsm( side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb );
+#else
BLAS_STRSM( &side, &uplo, &transa, &diag, &m, &n, &alpha, a, &lda, b,
&ldb );
+#endif
}
inline void trsm( const char side, const char uplo, const char transa,
const char diag, const integer_t m, const integer_t n,
const double alpha, const double* a, const integer_t lda, double* b,
const integer_t ldb ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_dtrsm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( transa == 'N' ? CblasNoTrans : ( transa == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), m, n, alpha, a, lda,
+ b, ldb );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasDtrsm( side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb );
+#else
BLAS_DTRSM( &side, &uplo, &transa, &diag, &m, &n, &alpha, a, &lda, b,
&ldb );
+#endif
}
inline void trsm( const char side, const char uplo, const char transa,
const char diag, const integer_t m, const integer_t n,
const traits::complex_f alpha, const traits::complex_f* a,
const integer_t lda, traits::complex_f* b, const integer_t ldb ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ctrsm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( transa == 'N' ? CblasNoTrans : ( transa == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), m, n,
+ traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasCtrsm( side, uplo, transa, diag, m, n, traits::void_ptr(alpha),
+ traits::void_ptr(a), lda, traits::void_ptr(b), ldb );
+#else
BLAS_CTRSM( &side, &uplo, &transa, &diag, &m, &n,
traits::complex_ptr(&alpha), traits::complex_ptr(a), &lda,
traits::complex_ptr(b), &ldb );
+#endif
}
inline void trsm( const char side, const char uplo, const char transa,
const char diag, const integer_t m, const integer_t n,
const traits::complex_d alpha, const traits::complex_d* a,
const integer_t lda, traits::complex_d* b, const integer_t ldb ) {
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+ cblas_ztrsm( CblasColMajor, ( uplo == 'L' ? CblasLeft : CblasRight ),
+ ( uplo == 'U' ? CblasUpper : CblasLower ),
+ ( transa == 'N' ? CblasNoTrans : ( transa == 'T' ? CblasTrans : CblasConjTrans ) ),
+ ( uplo == 'N' ? CblasNonUnit : CblasUnit ), m, n,
+ traits::void_ptr(&alpha), traits::void_ptr(a), lda,
+ traits::void_ptr(b), ldb );
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+ cublasZtrsm( side, uplo, transa, diag, m, n, traits::void_ptr(alpha),
+ traits::void_ptr(a), lda, traits::void_ptr(b), ldb );
+#else
BLAS_ZTRSM( &side, &uplo, &transa, &diag, &m, &n,
traits::complex_ptr(&alpha), traits::complex_ptr(a), &lda,
traits::complex_ptr(b), &ldb );
+#endif
}
+
} // namespace detail
// value-type based template
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