Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59086 - in sandbox/numeric_bindings/boost/numeric/bindings/blas: . detail level1
From: rutger_at_[hidden]
Date: 2010-01-17 03:55:21


Author: rutger
Date: 2010-01-17 03:55:20 EST (Sun, 17 Jan 2010)
New Revision: 59086
URL: http://svn.boost.org/trac/boost/changeset/59086

Log:
added iamax to blas/level1

Added:
   sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/iamax.hpp (contents, props changed)
Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas.h | 14 +++++++++
   sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas_names.h | 8 +++++
   sandbox/numeric_bindings/boost/numeric/bindings/blas/level1.hpp | 1
   sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/scal.hpp | 60 ++++++++++++++++++++++++++++++++++++++++
   4 files changed, 83 insertions(+), 0 deletions(-)

Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas.h
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas.h (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas.h 2010-01-17 03:55:20 EST (Sun, 17 Jan 2010)
@@ -69,6 +69,16 @@
 std::complex<double> BLAS_ZDOTC( const fortran_int_t* n, const void* x,
         const fortran_int_t* incx, const void* y, const fortran_int_t* incy );
 
+// Value-type variants of iamax
+fortran_int_t BLAS_ISAMAX( const fortran_int_t* n, const float* x,
+ const fortran_int_t* incx );
+fortran_int_t BLAS_IDAMAX( const fortran_int_t* n, const double* x,
+ const fortran_int_t* incx );
+fortran_int_t BLAS_ICAMAX( const fortran_int_t* n, const void* x,
+ const fortran_int_t* incx );
+fortran_int_t BLAS_IZAMAX( const fortran_int_t* n, const void* x,
+ const fortran_int_t* incx );
+
 // Value-type variants of nrm2
 float BLAS_SNRM2( const fortran_int_t* n, const float* x,
         const fortran_int_t* incx );
@@ -113,6 +123,10 @@
         const fortran_int_t* incx );
 void BLAS_DSCAL( const fortran_int_t* n, const double* a, double* x,
         const fortran_int_t* incx );
+void BLAS_CSSCAL( const fortran_int_t* n, const float* a, void* x,
+ const fortran_int_t* incx );
+void BLAS_ZDSCAL( const fortran_int_t* n, const double* a, void* x,
+ const fortran_int_t* incx );
 void BLAS_CSCAL( const fortran_int_t* n, const void* a, void* x,
         const fortran_int_t* incx );
 void BLAS_ZSCAL( const fortran_int_t* n, const void* a, void* x,

Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas_names.h
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas_names.h (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/detail/blas_names.h 2010-01-17 03:55:20 EST (Sun, 17 Jan 2010)
@@ -48,6 +48,12 @@
 #define BLAS_CDOTC FORTRAN_ID( cdotc )
 #define BLAS_ZDOTC FORTRAN_ID( zdotc )
 
+// Value-type variants of iamax
+#define BLAS_ISAMAX FORTRAN_ID( isamax )
+#define BLAS_IDAMAX FORTRAN_ID( idamax )
+#define BLAS_ICAMAX FORTRAN_ID( icamax )
+#define BLAS_IZAMAX FORTRAN_ID( izamax )
+
 // Value-type variants of nrm2
 #define BLAS_SNRM2 FORTRAN_ID( snrm2 )
 #define BLAS_DNRM2 FORTRAN_ID( dnrm2 )
@@ -77,6 +83,8 @@
 // Value-type variants of scal
 #define BLAS_SSCAL FORTRAN_ID( sscal )
 #define BLAS_DSCAL FORTRAN_ID( dscal )
+#define BLAS_CSSCAL FORTRAN_ID( csscal )
+#define BLAS_ZDSCAL FORTRAN_ID( zdscal )
 #define BLAS_CSCAL FORTRAN_ID( cscal )
 #define BLAS_ZSCAL FORTRAN_ID( zscal )
 

Modified: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/blas/level1.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1.hpp 2010-01-17 03:55:20 EST (Sun, 17 Jan 2010)
@@ -15,6 +15,7 @@
 #include <boost/numeric/bindings/blas/level1/dotc.hpp>
 #include <boost/numeric/bindings/blas/level1/dot.hpp>
 #include <boost/numeric/bindings/blas/level1/dotu.hpp>
+#include <boost/numeric/bindings/blas/level1/iamax.hpp>
 #include <boost/numeric/bindings/blas/level1/nrm2.hpp>
 #include <boost/numeric/bindings/blas/level1/rotg.hpp>
 #include <boost/numeric/bindings/blas/level1/rot.hpp>

Added: sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/iamax.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/blas/level1/iamax.hpp 2010-01-17 03:55:20 EST (Sun, 17 Jan 2010)
@@ -0,0 +1,196 @@
+//
+// Copyright (c) 2002--2010
+// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
+// Thomas Klimpel and Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// THIS FILE IS AUTOMATICALLY GENERATED
+// PLEASE DO NOT EDIT!
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_IAMAX_HPP
+#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_IAMAX_HPP
+
+#include <boost/assert.hpp>
+#include <boost/numeric/bindings/begin.hpp>
+#include <boost/numeric/bindings/is_mutable.hpp>
+#include <boost/numeric/bindings/remove_imaginary.hpp>
+#include <boost/numeric/bindings/size.hpp>
+#include <boost/numeric/bindings/stride.hpp>
+#include <boost/numeric/bindings/value.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/remove_const.hpp>
+
+//
+// The BLAS-backend is selected by defining a pre-processor variable,
+// which can be one of
+// * for CBLAS, define BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+// * for CUBLAS, define BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+// * netlib-compatible BLAS is the default
+//
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+#include <boost/numeric/bindings/blas/detail/cblas.h>
+#include <boost/numeric/bindings/blas/detail/cblas_option.hpp>
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+#include <boost/numeric/bindings/blas/detail/cublas.h>
+#include <boost/numeric/bindings/blas/detail/blas_option.hpp>
+#else
+#include <boost/numeric/bindings/blas/detail/blas.h>
+#include <boost/numeric/bindings/blas/detail/blas_option.hpp>
+#endif
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace blas {
+
+//
+// The detail namespace contains value-type-overloaded functions that
+// dispatch to the appropriate back-end BLAS-routine.
+//
+namespace detail {
+
+#if defined BOOST_NUMERIC_BINDINGS_BLAS_CBLAS
+//
+// Overloaded function for dispatching to
+// * CBLAS backend, and
+// * float value-type.
+//
+inline std::ptrdiff_t iamax( const int n, const float* x, const int incx ) {
+ return cblas_isamax( n, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CBLAS backend, and
+// * double value-type.
+//
+inline std::ptrdiff_t iamax( const int n, const double* x,
+ const int incx ) {
+ return cblas_idamax( n, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CBLAS backend, and
+// * complex<float> value-type.
+//
+inline std::ptrdiff_t iamax( const int n, const std::complex<float>* x,
+ const int incx ) {
+ return cblas_icamax( n, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CBLAS backend, and
+// * complex<double> value-type.
+//
+inline std::ptrdiff_t iamax( const int n, const std::complex<double>* x,
+ const int incx ) {
+ return cblas_izamax( n, x, incx );
+}
+
+#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend, and
+// * float value-type.
+//
+inline std::ptrdiff_t iamax( const int n, const float* x, const int incx ) {
+ return cublasIsamax( n, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend, and
+// * double value-type.
+//
+inline std::ptrdiff_t iamax( const int n, const double* x,
+ const int incx ) {
+ return cublasIdamax( n, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend, and
+// * complex<float> value-type.
+//
+inline std::ptrdiff_t iamax( const int n, const std::complex<float>* x,
+ const int incx ) {
+ return cublasIcamax( n, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend, and
+// * complex<double> value-type.
+//
+inline std::ptrdiff_t iamax( const int n, const std::complex<double>* x,
+ const int incx ) {
+ return // NOT FOUND();
+}
+
+#else
+//
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default), and
+// * float value-type.
+//
+inline std::ptrdiff_t iamax( const fortran_int_t n, const float* x,
+ const fortran_int_t incx ) {
+ return BLAS_ISAMAX( &n, x, &incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default), and
+// * double value-type.
+//
+inline std::ptrdiff_t iamax( const fortran_int_t n, const double* x,
+ const fortran_int_t incx ) {
+ return BLAS_IDAMAX( &n, x, &incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default), and
+// * complex<float> value-type.
+//
+inline std::ptrdiff_t iamax( const fortran_int_t n,
+ const std::complex<float>* x, const fortran_int_t incx ) {
+ return BLAS_ICAMAX( &n, x, &incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default), and
+// * complex<double> value-type.
+//
+inline std::ptrdiff_t iamax( const fortran_int_t n,
+ const std::complex<double>* x, const fortran_int_t incx ) {
+ return BLAS_IZAMAX( &n, x, &incx );
+}
+
+#endif
+
+} // namespace detail
+
+
+//
+// Functions for direct use. These functions are overloaded for temporaries,
+// so that wrapped types can still be passed and used for write-access. Calls
+// to these functions are passed to the iamax_impl classes. In the
+// documentation, the const-overloads are collapsed to avoid a large number of
+// prototypes which are very similar.
+//
+
+} // namespace blas
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif

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 2010-01-17 03:55:20 EST (Sun, 17 Jan 2010)
@@ -76,6 +76,26 @@
 //
 // Overloaded function for dispatching to
 // * CBLAS backend, and
+// * combined float and complex<float> value-type.
+//
+inline void scal( const int n, const float a, std::complex<float>* x,
+ const int incx ) {
+ cblas_csscal( n, a, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CBLAS backend, and
+// * combined double and complex<double> value-type.
+//
+inline void scal( const int n, const double a, std::complex<double>* x,
+ const int incx ) {
+ cblas_zdscal( n, a, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CBLAS backend, and
 // * complex<float> value-type.
 //
 inline void scal( const int n, const std::complex<float> a,
@@ -115,6 +135,26 @@
 //
 // Overloaded function for dispatching to
 // * CUBLAS backend, and
+// * combined float and complex<float> value-type.
+//
+inline void scal( const int n, const float a, std::complex<float>* x,
+ const int incx ) {
+ cublasCsscal( n, a, x, incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend, and
+// * combined double and complex<double> value-type.
+//
+inline void scal( const int n, const double a, std::complex<double>* x,
+ const int incx ) {
+ // NOT FOUND();
+}
+
+//
+// Overloaded function for dispatching to
+// * CUBLAS backend, and
 // * complex<float> value-type.
 //
 inline void scal( const int n, const std::complex<float> a,
@@ -156,6 +196,26 @@
 //
 // Overloaded function for dispatching to
 // * netlib-compatible BLAS backend (the default), and
+// * combined float and complex<float> value-type.
+//
+inline void scal( const fortran_int_t n, const float a,
+ std::complex<float>* x, const fortran_int_t incx ) {
+ BLAS_CSSCAL( &n, &a, x, &incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default), and
+// * combined double and complex<double> value-type.
+//
+inline void scal( const fortran_int_t n, const double a,
+ std::complex<double>* x, const fortran_int_t incx ) {
+ BLAS_ZDSCAL( &n, &a, x, &incx );
+}
+
+//
+// Overloaded function for dispatching to
+// * netlib-compatible BLAS backend (the default), and
 // * complex<float> value-type.
 //
 inline void scal( const fortran_int_t n, const std::complex<float> a,


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