mirror of
http://172.16.200.102/MOISE/Timed-Altarica-To-Fiacre-Translator.git
synced 2025-11-26 06:37:59 +01:00
Initial commit.
This commit is contained in:
332
sdk/boost/numeric/bindings/blas/level2/gbmv.hpp
Normal file
332
sdk/boost/numeric/bindings/blas/level2/gbmv.hpp
Normal file
@@ -0,0 +1,332 @@
|
||||
//
|
||||
// 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_LEVEL2_GBMV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GBMV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
|
||||
#include <boost/numeric/bindings/has_band_array.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gbmv( const Order, const Trans, const int m, const int n,
|
||||
const int kl, const int ku, const float alpha, const float* a,
|
||||
const int lda, const float* x, const int incx, const float beta,
|
||||
float* y, const int incy ) {
|
||||
cblas_sgbmv( cblas_option< Order >::value, cblas_option< Trans >::value,
|
||||
m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gbmv( const Order, const Trans, const int m, const int n,
|
||||
const int kl, const int ku, const double alpha, const double* a,
|
||||
const int lda, const double* x, const int incx, const double beta,
|
||||
double* y, const int incy ) {
|
||||
cblas_dgbmv( cblas_option< Order >::value, cblas_option< Trans >::value,
|
||||
m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gbmv( const Order, const Trans, const int m, const int n,
|
||||
const int kl, const int ku, const std::complex<float> alpha,
|
||||
const std::complex<float>* a, const int lda,
|
||||
const std::complex<float>* x, const int incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const int incy ) {
|
||||
cblas_cgbmv( cblas_option< Order >::value, cblas_option< Trans >::value,
|
||||
m, n, kl, ku, &alpha, a, lda, x, incx, &beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gbmv( const Order, const Trans, const int m, const int n,
|
||||
const int kl, const int ku, const std::complex<double> alpha,
|
||||
const std::complex<double>* a, const int lda,
|
||||
const std::complex<double>* x, const int incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const int incy ) {
|
||||
cblas_zgbmv( cblas_option< Order >::value, cblas_option< Trans >::value,
|
||||
m, n, kl, ku, &alpha, a, lda, x, incx, &beta, y, incy );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gbmv( const Order, const Trans, const int m, const int n,
|
||||
const int kl, const int ku, const float alpha, const float* a,
|
||||
const int lda, const float* x, const int incx, const float beta,
|
||||
float* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSgbmv( blas_option< Trans >::value, m, n, kl, ku, alpha, a, lda, x,
|
||||
incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gbmv( const Order, const Trans, const int m, const int n,
|
||||
const int kl, const int ku, const double alpha, const double* a,
|
||||
const int lda, const double* x, const int incx, const double beta,
|
||||
double* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDgbmv( blas_option< Trans >::value, m, n, kl, ku, alpha, a, lda, x,
|
||||
incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gbmv( const Order, const Trans, const int m, const int n,
|
||||
const int kl, const int ku, const std::complex<float> alpha,
|
||||
const std::complex<float>* a, const int lda,
|
||||
const std::complex<float>* x, const int incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasCgbmv( blas_option< Trans >::value, m, n, kl, ku, alpha, a, lda, x,
|
||||
incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gbmv( const Order, const Trans, const int m, const int n,
|
||||
const int kl, const int ku, const std::complex<double> alpha,
|
||||
const std::complex<double>* a, const int lda,
|
||||
const std::complex<double>* x, const int incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZgbmv( blas_option< Trans >::value, m, n, kl, ku, alpha, a, lda, x,
|
||||
incx, beta, y, incy );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gbmv( const Order, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t kl, const fortran_int_t ku,
|
||||
const float alpha, const float* a, const fortran_int_t lda,
|
||||
const float* x, const fortran_int_t incx, const float beta, float* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SGBMV( &blas_option< Trans >::value, &m, &n, &kl, &ku, &alpha, a,
|
||||
&lda, x, &incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gbmv( const Order, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t kl, const fortran_int_t ku,
|
||||
const double alpha, const double* a, const fortran_int_t lda,
|
||||
const double* x, const fortran_int_t incx, const double beta,
|
||||
double* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DGBMV( &blas_option< Trans >::value, &m, &n, &kl, &ku, &alpha, a,
|
||||
&lda, x, &incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gbmv( const Order, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t kl, const fortran_int_t ku,
|
||||
const std::complex<float> alpha, const std::complex<float>* a,
|
||||
const fortran_int_t lda, const std::complex<float>* x,
|
||||
const fortran_int_t incx, const std::complex<float> beta,
|
||||
std::complex<float>* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CGBMV( &blas_option< Trans >::value, &m, &n, &kl, &ku, &alpha, a,
|
||||
&lda, x, &incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gbmv( const Order, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const fortran_int_t kl, const fortran_int_t ku,
|
||||
const std::complex<double> alpha, const std::complex<double>* a,
|
||||
const fortran_int_t lda, const std::complex<double>* x,
|
||||
const fortran_int_t incx, const std::complex<double> beta,
|
||||
std::complex<double>* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZGBMV( &blas_option< Trans >::value, &m, &n, &kl, &ku, &alpha, a,
|
||||
&lda, x, &incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gbmv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gbmv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
static result_type invoke( const value_type alpha, const MatrixA& a,
|
||||
const VectorX& x, const value_type beta, VectorY& y ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename detail::default_order< MatrixA >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_band_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::gbmv( order(), trans(), bindings::size_row_op(a,
|
||||
trans()), bindings::size_column_op(a, trans()),
|
||||
bindings::bandwidth_lower_op(a, trans()),
|
||||
bindings::bandwidth_upper_op(a, trans()), alpha,
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(x), bindings::stride(x), beta,
|
||||
bindings::begin_value(y), bindings::stride(y) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 gbmv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gbmv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
inline typename gbmv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::result_type
|
||||
gbmv( const typename bindings::value_type< MatrixA >::type alpha,
|
||||
const MatrixA& a, const VectorX& x,
|
||||
const typename bindings::value_type< MatrixA >::type beta,
|
||||
VectorY& y ) {
|
||||
gbmv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( alpha, a, x, beta, y );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
325
sdk/boost/numeric/bindings/blas/level2/gemv.hpp
Normal file
325
sdk/boost/numeric/bindings/blas/level2/gemv.hpp
Normal file
@@ -0,0 +1,325 @@
|
||||
//
|
||||
// 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_LEVEL2_GEMV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GEMV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gemv( const Order, const Trans, const int m, const int n,
|
||||
const float alpha, const float* a, const int lda, const float* x,
|
||||
const int incx, const float beta, float* y, const int incy ) {
|
||||
cblas_sgemv( cblas_option< Order >::value, cblas_option< Trans >::value,
|
||||
m, n, alpha, a, lda, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gemv( const Order, const Trans, const int m, const int n,
|
||||
const double alpha, const double* a, const int lda, const double* x,
|
||||
const int incx, const double beta, double* y, const int incy ) {
|
||||
cblas_dgemv( cblas_option< Order >::value, cblas_option< Trans >::value,
|
||||
m, n, alpha, a, lda, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gemv( const Order, const Trans, const int m, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* a,
|
||||
const int lda, const std::complex<float>* x, const int incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const int incy ) {
|
||||
cblas_cgemv( cblas_option< Order >::value, cblas_option< Trans >::value,
|
||||
m, n, &alpha, a, lda, x, incx, &beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gemv( const Order, const Trans, const int m, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* a,
|
||||
const int lda, const std::complex<double>* x, const int incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const int incy ) {
|
||||
cblas_zgemv( cblas_option< Order >::value, cblas_option< Trans >::value,
|
||||
m, n, &alpha, a, lda, x, incx, &beta, y, incy );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gemv( const Order, const Trans, const int m, const int n,
|
||||
const float alpha, const float* a, const int lda, const float* x,
|
||||
const int incx, const float beta, float* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSgemv( blas_option< Trans >::value, m, n, alpha, a, lda, x, incx,
|
||||
beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gemv( const Order, const Trans, const int m, const int n,
|
||||
const double alpha, const double* a, const int lda, const double* x,
|
||||
const int incx, const double beta, double* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDgemv( blas_option< Trans >::value, m, n, alpha, a, lda, x, incx,
|
||||
beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gemv( const Order, const Trans, const int m, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* a,
|
||||
const int lda, const std::complex<float>* x, const int incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasCgemv( blas_option< Trans >::value, m, n, alpha, a, lda, x, incx,
|
||||
beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gemv( const Order, const Trans, const int m, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* a,
|
||||
const int lda, const std::complex<double>* x, const int incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZgemv( blas_option< Trans >::value, m, n, alpha, a, lda, x, incx,
|
||||
beta, y, incy );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gemv( const Order, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const float alpha, const float* a,
|
||||
const fortran_int_t lda, const float* x, const fortran_int_t incx,
|
||||
const float beta, float* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SGEMV( &blas_option< Trans >::value, &m, &n, &alpha, a, &lda, x,
|
||||
&incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gemv( const Order, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const double alpha, const double* a,
|
||||
const fortran_int_t lda, const double* x, const fortran_int_t incx,
|
||||
const double beta, double* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DGEMV( &blas_option< Trans >::value, &m, &n, &alpha, a, &lda, x,
|
||||
&incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gemv( const Order, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const std::complex<float> alpha,
|
||||
const std::complex<float>* a, const fortran_int_t lda,
|
||||
const std::complex<float>* x, const fortran_int_t incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CGEMV( &blas_option< Trans >::value, &m, &n, &alpha, a, &lda, x,
|
||||
&incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename Trans >
|
||||
inline void gemv( const Order, const Trans, const fortran_int_t m,
|
||||
const fortran_int_t n, const std::complex<double> alpha,
|
||||
const std::complex<double>* a, const fortran_int_t lda,
|
||||
const std::complex<double>* x, const fortran_int_t incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZGEMV( &blas_option< Trans >::value, &m, &n, &alpha, a, &lda, x,
|
||||
&incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gemv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gemv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
// high-level transform typedefs and functions
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
static result_type transform( MatrixA& A, VectorX& x, VectorY& y,
|
||||
const value_type alpha, const value_type beta ) {
|
||||
invoke();
|
||||
}
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
static result_type invoke( const value_type alpha, const MatrixA& a,
|
||||
const VectorX& x, const value_type beta, VectorY& y ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename detail::default_order< MatrixA >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::gemv( order(), trans(), bindings::size_row_op(a,
|
||||
trans()), bindings::size_column_op(a, trans()), alpha,
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(x), bindings::stride(x), beta,
|
||||
bindings::begin_value(y), bindings::stride(y) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 gemv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gemv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
inline typename gemv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::result_type
|
||||
gemv( const typename bindings::value_type< MatrixA >::type alpha,
|
||||
const MatrixA& a, const VectorX& x,
|
||||
const typename bindings::value_type< MatrixA >::type beta,
|
||||
VectorY& y ) {
|
||||
gemv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( alpha, a, x, beta, y );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
215
sdk/boost/numeric/bindings/blas/level2/ger.hpp
Normal file
215
sdk/boost/numeric/bindings/blas/level2/ger.hpp
Normal file
@@ -0,0 +1,215 @@
|
||||
//
|
||||
// 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_LEVEL2_GER_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GER_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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_type.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.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void ger( const Order, const int m, const int n, const float alpha,
|
||||
const float* x, const int incx, const float* y, const int incy,
|
||||
float* a, const int lda ) {
|
||||
cblas_sger( cblas_option< Order >::value, m, n, alpha, x, incx, y, incy,
|
||||
a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void ger( const Order, const int m, const int n, const double alpha,
|
||||
const double* x, const int incx, const double* y, const int incy,
|
||||
double* a, const int lda ) {
|
||||
cblas_dger( cblas_option< Order >::value, m, n, alpha, x, incx, y, incy,
|
||||
a, lda );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void ger( const Order, const int m, const int n, const float alpha,
|
||||
const float* x, const int incx, const float* y, const int incy,
|
||||
float* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSger( m, n, alpha, x, incx, y, incy, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void ger( const Order, const int m, const int n, const double alpha,
|
||||
const double* x, const int incx, const double* y, const int incy,
|
||||
double* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDger( m, n, alpha, x, incx, y, incy, a, lda );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void ger( const Order, const fortran_int_t m, const fortran_int_t n,
|
||||
const float alpha, const float* x, const fortran_int_t incx,
|
||||
const float* y, const fortran_int_t incy, float* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SGER( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void ger( const Order, const fortran_int_t m, const fortran_int_t n,
|
||||
const double alpha, const double* x, const fortran_int_t incx,
|
||||
const double* y, const fortran_int_t incy, double* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DGER( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to ger.
|
||||
//
|
||||
template< typename Value >
|
||||
struct ger_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixA >
|
||||
static result_type invoke( const real_type alpha, const VectorX& x,
|
||||
const VectorY& y, MatrixA& a ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixA >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::ger( order(), bindings::size_row(a),
|
||||
bindings::size_column(a), alpha, bindings::begin_value(x),
|
||||
bindings::stride(x), bindings::begin_value(y),
|
||||
bindings::stride(y), bindings::begin_value(a),
|
||||
bindings::stride_major(a) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 ger_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for ger. Its overload differs for
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixA >
|
||||
inline typename ger_impl< typename bindings::value_type<
|
||||
VectorX >::type >::result_type
|
||||
ger( const typename remove_imaginary< typename bindings::value_type<
|
||||
VectorX >::type >::type alpha, const VectorX& x, const VectorY& y,
|
||||
MatrixA& a ) {
|
||||
ger_impl< typename bindings::value_type<
|
||||
VectorX >::type >::invoke( alpha, x, y, a );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
220
sdk/boost/numeric/bindings/blas/level2/gerc.hpp
Normal file
220
sdk/boost/numeric/bindings/blas/level2/gerc.hpp
Normal file
@@ -0,0 +1,220 @@
|
||||
//
|
||||
// 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_LEVEL2_GERC_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GERC_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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_type.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
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void gerc( const Order, const int m, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* x,
|
||||
const int incx, const std::complex<float>* y, const int incy,
|
||||
std::complex<float>* a, const int lda ) {
|
||||
cblas_cgerc( cblas_option< Order >::value, m, n, &alpha, x, incx, y, incy,
|
||||
a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void gerc( const Order, const int m, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* x,
|
||||
const int incx, const std::complex<double>* y, const int incy,
|
||||
std::complex<double>* a, const int lda ) {
|
||||
cblas_zgerc( cblas_option< Order >::value, m, n, &alpha, x, incx, y, incy,
|
||||
a, lda );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void gerc( const Order, const int m, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* x,
|
||||
const int incx, const std::complex<float>* y, const int incy,
|
||||
std::complex<float>* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasCgerc( m, n, alpha, x, incx, y, incy, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void gerc( const Order, const int m, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* x,
|
||||
const int incx, const std::complex<double>* y, const int incy,
|
||||
std::complex<double>* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZgerc( m, n, alpha, x, incx, y, incy, a, lda );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void gerc( const Order, const fortran_int_t m, const fortran_int_t n,
|
||||
const std::complex<float> alpha, const std::complex<float>* x,
|
||||
const fortran_int_t incx, const std::complex<float>* y,
|
||||
const fortran_int_t incy, std::complex<float>* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CGERC( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void gerc( const Order, const fortran_int_t m, const fortran_int_t n,
|
||||
const std::complex<double> alpha, const std::complex<double>* x,
|
||||
const fortran_int_t incx, const std::complex<double>* y,
|
||||
const fortran_int_t incy, std::complex<double>* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZGERC( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to gerc.
|
||||
//
|
||||
template< typename Value >
|
||||
struct gerc_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixA >
|
||||
static result_type invoke( const value_type alpha, const VectorX& x,
|
||||
const VectorY& y, MatrixA& a ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixA >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::gerc( order(), bindings::size_row(a),
|
||||
bindings::size_column(a), alpha, bindings::begin_value(x),
|
||||
bindings::stride(x), bindings::begin_value(y),
|
||||
bindings::stride(y), bindings::begin_value(a),
|
||||
bindings::stride_major(a) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 gerc_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for gerc. Its overload differs for
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixA >
|
||||
inline typename gerc_impl< typename bindings::value_type<
|
||||
VectorX >::type >::result_type
|
||||
gerc( const typename bindings::value_type< VectorX >::type alpha,
|
||||
const VectorX& x, const VectorY& y, MatrixA& a ) {
|
||||
gerc_impl< typename bindings::value_type<
|
||||
VectorX >::type >::invoke( alpha, x, y, a );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
220
sdk/boost/numeric/bindings/blas/level2/geru.hpp
Normal file
220
sdk/boost/numeric/bindings/blas/level2/geru.hpp
Normal file
@@ -0,0 +1,220 @@
|
||||
//
|
||||
// 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_LEVEL2_GERU_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_GERU_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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_type.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
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void geru( const Order, const int m, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* x,
|
||||
const int incx, const std::complex<float>* y, const int incy,
|
||||
std::complex<float>* a, const int lda ) {
|
||||
cblas_cgeru( cblas_option< Order >::value, m, n, &alpha, x, incx, y, incy,
|
||||
a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void geru( const Order, const int m, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* x,
|
||||
const int incx, const std::complex<double>* y, const int incy,
|
||||
std::complex<double>* a, const int lda ) {
|
||||
cblas_zgeru( cblas_option< Order >::value, m, n, &alpha, x, incx, y, incy,
|
||||
a, lda );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void geru( const Order, const int m, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* x,
|
||||
const int incx, const std::complex<float>* y, const int incy,
|
||||
std::complex<float>* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasCgeru( m, n, alpha, x, incx, y, incy, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void geru( const Order, const int m, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* x,
|
||||
const int incx, const std::complex<double>* y, const int incy,
|
||||
std::complex<double>* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZgeru( m, n, alpha, x, incx, y, incy, a, lda );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void geru( const Order, const fortran_int_t m, const fortran_int_t n,
|
||||
const std::complex<float> alpha, const std::complex<float>* x,
|
||||
const fortran_int_t incx, const std::complex<float>* y,
|
||||
const fortran_int_t incy, std::complex<float>* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CGERU( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order >
|
||||
inline void geru( const Order, const fortran_int_t m, const fortran_int_t n,
|
||||
const std::complex<double> alpha, const std::complex<double>* x,
|
||||
const fortran_int_t incx, const std::complex<double>* y,
|
||||
const fortran_int_t incy, std::complex<double>* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZGERU( &m, &n, &alpha, x, &incx, y, &incy, a, &lda );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to geru.
|
||||
//
|
||||
template< typename Value >
|
||||
struct geru_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixA >
|
||||
static result_type invoke( const value_type alpha, const VectorX& x,
|
||||
const VectorY& y, MatrixA& a ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixA >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::geru( order(), bindings::size_row(a),
|
||||
bindings::size_column(a), alpha, bindings::begin_value(x),
|
||||
bindings::stride(x), bindings::begin_value(y),
|
||||
bindings::stride(y), bindings::begin_value(a),
|
||||
bindings::stride_major(a) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 geru_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for geru. Its overload differs for
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixA >
|
||||
inline typename geru_impl< typename bindings::value_type<
|
||||
VectorX >::type >::result_type
|
||||
geru( const typename bindings::value_type< VectorX >::type alpha,
|
||||
const VectorX& x, const VectorY& y, MatrixA& a ) {
|
||||
geru_impl< typename bindings::value_type<
|
||||
VectorX >::type >::invoke( alpha, x, y, a );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
320
sdk/boost/numeric/bindings/blas/level2/hbmv.hpp
Normal file
320
sdk/boost/numeric/bindings/blas/level2/hbmv.hpp
Normal file
@@ -0,0 +1,320 @@
|
||||
//
|
||||
// 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_LEVEL2_HBMV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HBMV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_band_array.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hbmv( const Order, const UpLo, const int n, const int k,
|
||||
const float alpha, const float* a, const int lda, const float* x,
|
||||
const int incx, const float beta, float* y, const int incy ) {
|
||||
cblas_ssbmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
k, alpha, a, lda, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hbmv( const Order, const UpLo, const int n, const int k,
|
||||
const double alpha, const double* a, const int lda, const double* x,
|
||||
const int incx, const double beta, double* y, const int incy ) {
|
||||
cblas_dsbmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
k, alpha, a, lda, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hbmv( const Order, const UpLo, const int n, const int k,
|
||||
const std::complex<float> alpha, const std::complex<float>* a,
|
||||
const int lda, const std::complex<float>* x, const int incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const int incy ) {
|
||||
cblas_chbmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
k, &alpha, a, lda, x, incx, &beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hbmv( const Order, const UpLo, const int n, const int k,
|
||||
const std::complex<double> alpha, const std::complex<double>* a,
|
||||
const int lda, const std::complex<double>* x, const int incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const int incy ) {
|
||||
cblas_zhbmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
k, &alpha, a, lda, x, incx, &beta, y, incy );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hbmv( const Order, const UpLo, const int n, const int k,
|
||||
const float alpha, const float* a, const int lda, const float* x,
|
||||
const int incx, const float beta, float* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSsbmv( blas_option< UpLo >::value, n, k, alpha, a, lda, x, incx,
|
||||
beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hbmv( const Order, const UpLo, const int n, const int k,
|
||||
const double alpha, const double* a, const int lda, const double* x,
|
||||
const int incx, const double beta, double* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDsbmv( blas_option< UpLo >::value, n, k, alpha, a, lda, x, incx,
|
||||
beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hbmv( const Order, const UpLo, const int n, const int k,
|
||||
const std::complex<float> alpha, const std::complex<float>* a,
|
||||
const int lda, const std::complex<float>* x, const int incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasChbmv( blas_option< UpLo >::value, n, k, alpha, a, lda, x, incx,
|
||||
beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hbmv( const Order, const UpLo, const int n, const int k,
|
||||
const std::complex<double> alpha, const std::complex<double>* a,
|
||||
const int lda, const std::complex<double>* x, const int incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZhbmv( blas_option< UpLo >::value, n, k, alpha, a, lda, x, incx,
|
||||
beta, y, incy );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hbmv( const Order, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t k, const float alpha, const float* a,
|
||||
const fortran_int_t lda, const float* x, const fortran_int_t incx,
|
||||
const float beta, float* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSBMV( &blas_option< UpLo >::value, &n, &k, &alpha, a, &lda, x,
|
||||
&incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hbmv( const Order, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t k, const double alpha, const double* a,
|
||||
const fortran_int_t lda, const double* x, const fortran_int_t incx,
|
||||
const double beta, double* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSBMV( &blas_option< UpLo >::value, &n, &k, &alpha, a, &lda, x,
|
||||
&incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hbmv( const Order, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t k, const std::complex<float> alpha,
|
||||
const std::complex<float>* a, const fortran_int_t lda,
|
||||
const std::complex<float>* x, const fortran_int_t incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CHBMV( &blas_option< UpLo >::value, &n, &k, &alpha, a, &lda, x,
|
||||
&incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hbmv( const Order, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t k, const std::complex<double> alpha,
|
||||
const std::complex<double>* a, const fortran_int_t lda,
|
||||
const std::complex<double>* x, const fortran_int_t incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZHBMV( &blas_option< UpLo >::value, &n, &k, &alpha, a, &lda, x,
|
||||
&incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hbmv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hbmv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
static result_type invoke( const value_type alpha, const MatrixA& a,
|
||||
const VectorX& x, const value_type beta, VectorY& y ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_band_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::hbmv( order(), uplo(), bindings::size_column(a),
|
||||
bindings::bandwidth_upper(a), alpha, bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(x),
|
||||
bindings::stride(x), beta, bindings::begin_value(y),
|
||||
bindings::stride(y) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 hbmv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hbmv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
inline typename hbmv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::result_type
|
||||
hbmv( const typename bindings::value_type< MatrixA >::type alpha,
|
||||
const MatrixA& a, const VectorX& x,
|
||||
const typename bindings::value_type< MatrixA >::type beta,
|
||||
VectorY& y ) {
|
||||
hbmv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( alpha, a, x, beta, y );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
315
sdk/boost/numeric/bindings/blas/level2/hemv.hpp
Normal file
315
sdk/boost/numeric/bindings/blas/level2/hemv.hpp
Normal file
@@ -0,0 +1,315 @@
|
||||
//
|
||||
// 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_LEVEL2_HEMV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HEMV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hemv( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* a, const int lda, const float* x, const int incx,
|
||||
const float beta, float* y, const int incy ) {
|
||||
cblas_ssymv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, a, lda, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hemv( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* a, const int lda, const double* x, const int incx,
|
||||
const double beta, double* y, const int incy ) {
|
||||
cblas_dsymv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, a, lda, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hemv( const Order, const UpLo, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* a,
|
||||
const int lda, const std::complex<float>* x, const int incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const int incy ) {
|
||||
cblas_chemv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
&alpha, a, lda, x, incx, &beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hemv( const Order, const UpLo, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* a,
|
||||
const int lda, const std::complex<double>* x, const int incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const int incy ) {
|
||||
cblas_zhemv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
&alpha, a, lda, x, incx, &beta, y, incy );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hemv( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* a, const int lda, const float* x, const int incx,
|
||||
const float beta, float* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSsymv( blas_option< UpLo >::value, n, alpha, a, lda, x, incx, beta,
|
||||
y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hemv( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* a, const int lda, const double* x, const int incx,
|
||||
const double beta, double* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDsymv( blas_option< UpLo >::value, n, alpha, a, lda, x, incx, beta,
|
||||
y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hemv( const Order, const UpLo, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* a,
|
||||
const int lda, const std::complex<float>* x, const int incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasChemv( blas_option< UpLo >::value, n, alpha, a, lda, x, incx, beta,
|
||||
y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hemv( const Order, const UpLo, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* a,
|
||||
const int lda, const std::complex<double>* x, const int incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZhemv( blas_option< UpLo >::value, n, alpha, a, lda, x, incx, beta,
|
||||
y, incy );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hemv( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const float* a, const fortran_int_t lda,
|
||||
const float* x, const fortran_int_t incx, const float beta, float* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSYMV( &blas_option< UpLo >::value, &n, &alpha, a, &lda, x, &incx,
|
||||
&beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hemv( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const double* a, const fortran_int_t lda,
|
||||
const double* x, const fortran_int_t incx, const double beta,
|
||||
double* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSYMV( &blas_option< UpLo >::value, &n, &alpha, a, &lda, x, &incx,
|
||||
&beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hemv( const Order, const UpLo, const fortran_int_t n,
|
||||
const std::complex<float> alpha, const std::complex<float>* a,
|
||||
const fortran_int_t lda, const std::complex<float>* x,
|
||||
const fortran_int_t incx, const std::complex<float> beta,
|
||||
std::complex<float>* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CHEMV( &blas_option< UpLo >::value, &n, &alpha, a, &lda, x, &incx,
|
||||
&beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hemv( const Order, const UpLo, const fortran_int_t n,
|
||||
const std::complex<double> alpha, const std::complex<double>* a,
|
||||
const fortran_int_t lda, const std::complex<double>* x,
|
||||
const fortran_int_t incx, const std::complex<double> beta,
|
||||
std::complex<double>* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZHEMV( &blas_option< UpLo >::value, &n, &alpha, a, &lda, x, &incx,
|
||||
&beta, y, &incy );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hemv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hemv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
static result_type invoke( const value_type alpha, const MatrixA& a,
|
||||
const VectorX& x, const value_type beta, VectorY& y ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::hemv( order(), uplo(), bindings::size_column(a), alpha,
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(x), bindings::stride(x), beta,
|
||||
bindings::begin_value(y), bindings::stride(y) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 hemv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hemv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
inline typename hemv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::result_type
|
||||
hemv( const typename bindings::value_type< MatrixA >::type alpha,
|
||||
const MatrixA& a, const VectorX& x,
|
||||
const typename bindings::value_type< MatrixA >::type beta,
|
||||
VectorY& y ) {
|
||||
hemv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( alpha, a, x, beta, y );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
283
sdk/boost/numeric/bindings/blas/level2/her.hpp
Normal file
283
sdk/boost/numeric/bindings/blas/level2/her.hpp
Normal file
@@ -0,0 +1,283 @@
|
||||
//
|
||||
// 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_LEVEL2_HER_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HER_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, float* a, const int lda ) {
|
||||
cblas_ssyr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, double* a, const int lda ) {
|
||||
cblas_dsyr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her( const Order, const UpLo, const int n, const float alpha,
|
||||
const std::complex<float>* x, const int incx, std::complex<float>* a,
|
||||
const int lda ) {
|
||||
cblas_cher( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her( const Order, const UpLo, const int n, const double alpha,
|
||||
const std::complex<double>* x, const int incx,
|
||||
std::complex<double>* a, const int lda ) {
|
||||
cblas_zher( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, a, lda );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, float* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSsyr( blas_option< UpLo >::value, n, alpha, x, incx, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, double* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDsyr( blas_option< UpLo >::value, n, alpha, x, incx, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her( const Order, const UpLo, const int n, const float alpha,
|
||||
const std::complex<float>* x, const int incx, std::complex<float>* a,
|
||||
const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasCher( blas_option< UpLo >::value, n, alpha, x, incx, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her( const Order, const UpLo, const int n, const double alpha,
|
||||
const std::complex<double>* x, const int incx,
|
||||
std::complex<double>* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZher( blas_option< UpLo >::value, n, alpha, x, incx, a, lda );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const float* x, const fortran_int_t incx, float* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSYR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, a, &lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const double* x, const fortran_int_t incx,
|
||||
double* a, const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSYR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, a, &lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const std::complex<float>* x,
|
||||
const fortran_int_t incx, std::complex<float>* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CHER( &blas_option< UpLo >::value, &n, &alpha, x, &incx, a, &lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const std::complex<double>* x,
|
||||
const fortran_int_t incx, std::complex<double>* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZHER( &blas_option< UpLo >::value, &n, &alpha, x, &incx, a, &lda );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to her.
|
||||
//
|
||||
template< typename Value >
|
||||
struct her_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename VectorX, typename MatrixA >
|
||||
static result_type invoke( const real_type alpha, const VectorX& x,
|
||||
MatrixA& a ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixA >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::her( order(), uplo(), bindings::size_column(a), alpha,
|
||||
bindings::begin_value(x), bindings::stride(x),
|
||||
bindings::begin_value(a), bindings::stride_major(a) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 her_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for her. Its overload differs for
|
||||
//
|
||||
template< typename VectorX, typename MatrixA >
|
||||
inline typename her_impl< typename bindings::value_type<
|
||||
VectorX >::type >::result_type
|
||||
her( const typename remove_imaginary< typename bindings::value_type<
|
||||
VectorX >::type >::type alpha, const VectorX& x, MatrixA& a ) {
|
||||
her_impl< typename bindings::value_type<
|
||||
VectorX >::type >::invoke( alpha, x, a );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
309
sdk/boost/numeric/bindings/blas/level2/her2.hpp
Normal file
309
sdk/boost/numeric/bindings/blas/level2/her2.hpp
Normal file
@@ -0,0 +1,309 @@
|
||||
//
|
||||
// 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_LEVEL2_HER2_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HER2_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her2( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, const float* y, const int incy,
|
||||
float* a, const int lda ) {
|
||||
cblas_ssyr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, y, incy, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her2( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, const double* y, const int incy,
|
||||
double* a, const int lda ) {
|
||||
cblas_dsyr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, y, incy, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her2( const Order, const UpLo, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* x,
|
||||
const int incx, const std::complex<float>* y, const int incy,
|
||||
std::complex<float>* a, const int lda ) {
|
||||
cblas_cher2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
&alpha, x, incx, y, incy, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her2( const Order, const UpLo, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* x,
|
||||
const int incx, const std::complex<double>* y, const int incy,
|
||||
std::complex<double>* a, const int lda ) {
|
||||
cblas_zher2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
&alpha, x, incx, y, incy, a, lda );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her2( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, const float* y, const int incy,
|
||||
float* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSsyr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, a,
|
||||
lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her2( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, const double* y, const int incy,
|
||||
double* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDsyr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, a,
|
||||
lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her2( const Order, const UpLo, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* x,
|
||||
const int incx, const std::complex<float>* y, const int incy,
|
||||
std::complex<float>* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasCher2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, a,
|
||||
lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her2( const Order, const UpLo, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* x,
|
||||
const int incx, const std::complex<double>* y, const int incy,
|
||||
std::complex<double>* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZher2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, a,
|
||||
lda );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her2( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const float* x, const fortran_int_t incx,
|
||||
const float* y, const fortran_int_t incy, float* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSYR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
|
||||
a, &lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her2( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const double* x, const fortran_int_t incx,
|
||||
const double* y, const fortran_int_t incy, double* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSYR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
|
||||
a, &lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her2( const Order, const UpLo, const fortran_int_t n,
|
||||
const std::complex<float> alpha, const std::complex<float>* x,
|
||||
const fortran_int_t incx, const std::complex<float>* y,
|
||||
const fortran_int_t incy, std::complex<float>* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CHER2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
|
||||
a, &lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void her2( const Order, const UpLo, const fortran_int_t n,
|
||||
const std::complex<double> alpha, const std::complex<double>* x,
|
||||
const fortran_int_t incx, const std::complex<double>* y,
|
||||
const fortran_int_t incy, std::complex<double>* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZHER2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
|
||||
a, &lda );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to her2.
|
||||
//
|
||||
template< typename Value >
|
||||
struct her2_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixA >
|
||||
static result_type invoke( const value_type alpha, const VectorX& x,
|
||||
const VectorY& y, MatrixA& a ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixA >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::her2( order(), uplo(), bindings::size_column(a), alpha,
|
||||
bindings::begin_value(x), bindings::stride(x),
|
||||
bindings::begin_value(y), bindings::stride(y),
|
||||
bindings::begin_value(a), bindings::stride_major(a) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 her2_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for her2. Its overload differs for
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixA >
|
||||
inline typename her2_impl< typename bindings::value_type<
|
||||
VectorX >::type >::result_type
|
||||
her2( const typename bindings::value_type< VectorX >::type alpha,
|
||||
const VectorX& x, const VectorY& y, MatrixA& a ) {
|
||||
her2_impl< typename bindings::value_type<
|
||||
VectorX >::type >::invoke( alpha, x, y, a );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
315
sdk/boost/numeric/bindings/blas/level2/hpmv.hpp
Normal file
315
sdk/boost/numeric/bindings/blas/level2/hpmv.hpp
Normal file
@@ -0,0 +1,315 @@
|
||||
//
|
||||
// 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_LEVEL2_HPMV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPMV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.hpp>
|
||||
#include <boost/numeric/bindings/has_triangular_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpmv( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* ap, const float* x, const int incx, const float beta,
|
||||
float* y, const int incy ) {
|
||||
cblas_sspmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, ap, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpmv( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* ap, const double* x, const int incx, const double beta,
|
||||
double* y, const int incy ) {
|
||||
cblas_dspmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, ap, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpmv( const Order, const UpLo, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* ap,
|
||||
const std::complex<float>* x, const int incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const int incy ) {
|
||||
cblas_chpmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
&alpha, ap, x, incx, &beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpmv( const Order, const UpLo, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* ap,
|
||||
const std::complex<double>* x, const int incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const int incy ) {
|
||||
cblas_zhpmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
&alpha, ap, x, incx, &beta, y, incy );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpmv( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* ap, const float* x, const int incx, const float beta,
|
||||
float* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSspmv( blas_option< UpLo >::value, n, alpha, ap, x, incx, beta, y,
|
||||
incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpmv( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* ap, const double* x, const int incx, const double beta,
|
||||
double* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDspmv( blas_option< UpLo >::value, n, alpha, ap, x, incx, beta, y,
|
||||
incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpmv( const Order, const UpLo, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* ap,
|
||||
const std::complex<float>* x, const int incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasChpmv( blas_option< UpLo >::value, n, alpha, ap, x, incx, beta, y,
|
||||
incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpmv( const Order, const UpLo, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* ap,
|
||||
const std::complex<double>* x, const int incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZhpmv( blas_option< UpLo >::value, n, alpha, ap, x, incx, beta, y,
|
||||
incy );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpmv( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const float* ap, const float* x,
|
||||
const fortran_int_t incx, const float beta, float* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSPMV( &blas_option< UpLo >::value, &n, &alpha, ap, x, &incx, &beta,
|
||||
y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpmv( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const double* ap, const double* x,
|
||||
const fortran_int_t incx, const double beta, double* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSPMV( &blas_option< UpLo >::value, &n, &alpha, ap, x, &incx, &beta,
|
||||
y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpmv( const Order, const UpLo, const fortran_int_t n,
|
||||
const std::complex<float> alpha, const std::complex<float>* ap,
|
||||
const std::complex<float>* x, const fortran_int_t incx,
|
||||
const std::complex<float> beta, std::complex<float>* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CHPMV( &blas_option< UpLo >::value, &n, &alpha, ap, x, &incx, &beta,
|
||||
y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpmv( const Order, const UpLo, const fortran_int_t n,
|
||||
const std::complex<double> alpha, const std::complex<double>* ap,
|
||||
const std::complex<double>* x, const fortran_int_t incx,
|
||||
const std::complex<double> beta, std::complex<double>* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZHPMV( &blas_option< UpLo >::value, &n, &alpha, ap, x, &incx, &beta,
|
||||
y, &incy );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hpmv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hpmv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixAP, typename VectorX, typename VectorY >
|
||||
static result_type invoke( const value_type alpha, const MatrixAP& ap,
|
||||
const VectorX& x, const value_type beta, VectorY& y ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAP >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
|
||||
MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
|
||||
detail::hpmv( order(), uplo(), bindings::size_column(ap), alpha,
|
||||
bindings::begin_value(ap), bindings::begin_value(x),
|
||||
bindings::stride(x), beta, bindings::begin_value(y),
|
||||
bindings::stride(y) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 hpmv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hpmv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP, typename VectorX, typename VectorY >
|
||||
inline typename hpmv_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::result_type
|
||||
hpmv( const typename bindings::value_type< MatrixAP >::type alpha,
|
||||
const MatrixAP& ap, const VectorX& x,
|
||||
const typename bindings::value_type< MatrixAP >::type beta,
|
||||
VectorY& y ) {
|
||||
hpmv_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( alpha, ap, x, beta, y );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
281
sdk/boost/numeric/bindings/blas/level2/hpr.hpp
Normal file
281
sdk/boost/numeric/bindings/blas/level2/hpr.hpp
Normal file
@@ -0,0 +1,281 @@
|
||||
//
|
||||
// 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_LEVEL2_HPR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPR_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.hpp>
|
||||
#include <boost/numeric/bindings/has_triangular_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, float* ap ) {
|
||||
cblas_sspr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, double* ap ) {
|
||||
cblas_dspr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr( const Order, const UpLo, const int n, const float alpha,
|
||||
const std::complex<float>* x, const int incx,
|
||||
std::complex<float>* ap ) {
|
||||
cblas_chpr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr( const Order, const UpLo, const int n, const double alpha,
|
||||
const std::complex<double>* x, const int incx,
|
||||
std::complex<double>* ap ) {
|
||||
cblas_zhpr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, ap );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, float* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSspr( blas_option< UpLo >::value, n, alpha, x, incx, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, double* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDspr( blas_option< UpLo >::value, n, alpha, x, incx, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr( const Order, const UpLo, const int n, const float alpha,
|
||||
const std::complex<float>* x, const int incx,
|
||||
std::complex<float>* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasChpr( blas_option< UpLo >::value, n, alpha, x, incx, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr( const Order, const UpLo, const int n, const double alpha,
|
||||
const std::complex<double>* x, const int incx,
|
||||
std::complex<double>* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZhpr( blas_option< UpLo >::value, n, alpha, x, incx, ap );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const float* x, const fortran_int_t incx,
|
||||
float* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSPR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const double* x, const fortran_int_t incx,
|
||||
double* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSPR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const std::complex<float>* x,
|
||||
const fortran_int_t incx, std::complex<float>* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CHPR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const std::complex<double>* x,
|
||||
const fortran_int_t incx, std::complex<double>* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZHPR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, ap );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hpr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hpr_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename VectorX, typename MatrixAP >
|
||||
static result_type invoke( const real_type alpha, const VectorX& x,
|
||||
MatrixAP& ap ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAP >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAP >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
|
||||
MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
detail::hpr( order(), uplo(), bindings::size_column(ap), alpha,
|
||||
bindings::begin_value(x), bindings::stride(x),
|
||||
bindings::begin_value(ap) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 hpr_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hpr. Its overload differs for
|
||||
//
|
||||
template< typename VectorX, typename MatrixAP >
|
||||
inline typename hpr_impl< typename bindings::value_type<
|
||||
VectorX >::type >::result_type
|
||||
hpr( const typename remove_imaginary< typename bindings::value_type<
|
||||
VectorX >::type >::type alpha, const VectorX& x, MatrixAP& ap ) {
|
||||
hpr_impl< typename bindings::value_type<
|
||||
VectorX >::type >::invoke( alpha, x, ap );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
301
sdk/boost/numeric/bindings/blas/level2/hpr2.hpp
Normal file
301
sdk/boost/numeric/bindings/blas/level2/hpr2.hpp
Normal file
@@ -0,0 +1,301 @@
|
||||
//
|
||||
// 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_LEVEL2_HPR2_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPR2_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.hpp>
|
||||
#include <boost/numeric/bindings/has_triangular_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr2( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, const float* y, const int incy,
|
||||
float* ap ) {
|
||||
cblas_sspr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, y, incy, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr2( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, const double* y, const int incy,
|
||||
double* ap ) {
|
||||
cblas_dspr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, y, incy, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr2( const Order, const UpLo, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* x,
|
||||
const int incx, const std::complex<float>* y, const int incy,
|
||||
std::complex<float>* ap ) {
|
||||
cblas_chpr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
&alpha, x, incx, y, incy, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr2( const Order, const UpLo, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* x,
|
||||
const int incx, const std::complex<double>* y, const int incy,
|
||||
std::complex<double>* ap ) {
|
||||
cblas_zhpr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
&alpha, x, incx, y, incy, ap );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr2( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, const float* y, const int incy,
|
||||
float* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSspr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr2( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, const double* y, const int incy,
|
||||
double* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDspr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr2( const Order, const UpLo, const int n,
|
||||
const std::complex<float> alpha, const std::complex<float>* x,
|
||||
const int incx, const std::complex<float>* y, const int incy,
|
||||
std::complex<float>* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasChpr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr2( const Order, const UpLo, const int n,
|
||||
const std::complex<double> alpha, const std::complex<double>* x,
|
||||
const int incx, const std::complex<double>* y, const int incy,
|
||||
std::complex<double>* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZhpr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, ap );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr2( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const float* x, const fortran_int_t incx,
|
||||
const float* y, const fortran_int_t incy, float* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSPR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
|
||||
ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr2( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const double* x, const fortran_int_t incx,
|
||||
const double* y, const fortran_int_t incy, double* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSPR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
|
||||
ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr2( const Order, const UpLo, const fortran_int_t n,
|
||||
const std::complex<float> alpha, const std::complex<float>* x,
|
||||
const fortran_int_t incx, const std::complex<float>* y,
|
||||
const fortran_int_t incy, std::complex<float>* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CHPR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
|
||||
ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void hpr2( const Order, const UpLo, const fortran_int_t n,
|
||||
const std::complex<double> alpha, const std::complex<double>* x,
|
||||
const fortran_int_t incx, const std::complex<double>* y,
|
||||
const fortran_int_t incy, std::complex<double>* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZHPR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
|
||||
ap );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to hpr2.
|
||||
//
|
||||
template< typename Value >
|
||||
struct hpr2_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixAP >
|
||||
static result_type invoke( const value_type alpha, const VectorX& x,
|
||||
const VectorY& y, MatrixAP& ap ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAP >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAP >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
|
||||
MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
detail::hpr2( order(), uplo(), bindings::size_column(ap), alpha,
|
||||
bindings::begin_value(x), bindings::stride(x),
|
||||
bindings::begin_value(y), bindings::stride(y),
|
||||
bindings::begin_value(ap) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 hpr2_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for hpr2. Its overload differs for
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixAP >
|
||||
inline typename hpr2_impl< typename bindings::value_type<
|
||||
VectorX >::type >::result_type
|
||||
hpr2( const typename bindings::value_type< VectorX >::type alpha,
|
||||
const VectorX& x, const VectorY& y, MatrixAP& ap ) {
|
||||
hpr2_impl< typename bindings::value_type<
|
||||
VectorX >::type >::invoke( alpha, x, y, ap );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
224
sdk/boost/numeric/bindings/blas/level2/sbmv.hpp
Normal file
224
sdk/boost/numeric/bindings/blas/level2/sbmv.hpp
Normal file
@@ -0,0 +1,224 @@
|
||||
//
|
||||
// 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_LEVEL2_SBMV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SBMV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_band_array.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void sbmv( const Order, const UpLo, const int n, const int k,
|
||||
const float alpha, const float* a, const int lda, const float* x,
|
||||
const int incx, const float beta, float* y, const int incy ) {
|
||||
cblas_ssbmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
k, alpha, a, lda, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void sbmv( const Order, const UpLo, const int n, const int k,
|
||||
const double alpha, const double* a, const int lda, const double* x,
|
||||
const int incx, const double beta, double* y, const int incy ) {
|
||||
cblas_dsbmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
k, alpha, a, lda, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void sbmv( const Order, const UpLo, const int n, const int k,
|
||||
const float alpha, const float* a, const int lda, const float* x,
|
||||
const int incx, const float beta, float* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSsbmv( blas_option< UpLo >::value, n, k, alpha, a, lda, x, incx,
|
||||
beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void sbmv( const Order, const UpLo, const int n, const int k,
|
||||
const double alpha, const double* a, const int lda, const double* x,
|
||||
const int incx, const double beta, double* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDsbmv( blas_option< UpLo >::value, n, k, alpha, a, lda, x, incx,
|
||||
beta, y, incy );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void sbmv( const Order, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t k, const float alpha, const float* a,
|
||||
const fortran_int_t lda, const float* x, const fortran_int_t incx,
|
||||
const float beta, float* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSBMV( &blas_option< UpLo >::value, &n, &k, &alpha, a, &lda, x,
|
||||
&incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void sbmv( const Order, const UpLo, const fortran_int_t n,
|
||||
const fortran_int_t k, const double alpha, const double* a,
|
||||
const fortran_int_t lda, const double* x, const fortran_int_t incx,
|
||||
const double beta, double* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSBMV( &blas_option< UpLo >::value, &n, &k, &alpha, a, &lda, x,
|
||||
&incx, &beta, y, &incy );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to sbmv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct sbmv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
static result_type invoke( const real_type alpha, const MatrixA& a,
|
||||
const VectorX& x, const real_type beta, VectorY& y ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_band_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::sbmv( order(), uplo(), bindings::size_column(a),
|
||||
bindings::bandwidth_upper(a), alpha, bindings::begin_value(a),
|
||||
bindings::stride_major(a), bindings::begin_value(x),
|
||||
bindings::stride(x), beta, bindings::begin_value(y),
|
||||
bindings::stride(y) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 sbmv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for sbmv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
inline typename sbmv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::result_type
|
||||
sbmv( const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type alpha, const MatrixA& a, const VectorX& x,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type beta, VectorY& y ) {
|
||||
sbmv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( alpha, a, x, beta, y );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
221
sdk/boost/numeric/bindings/blas/level2/spmv.hpp
Normal file
221
sdk/boost/numeric/bindings/blas/level2/spmv.hpp
Normal file
@@ -0,0 +1,221 @@
|
||||
//
|
||||
// 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_LEVEL2_SPMV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPMV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.hpp>
|
||||
#include <boost/numeric/bindings/has_triangular_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spmv( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* ap, const float* x, const int incx, const float beta,
|
||||
float* y, const int incy ) {
|
||||
cblas_sspmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, ap, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spmv( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* ap, const double* x, const int incx, const double beta,
|
||||
double* y, const int incy ) {
|
||||
cblas_dspmv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, ap, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spmv( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* ap, const float* x, const int incx, const float beta,
|
||||
float* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSspmv( blas_option< UpLo >::value, n, alpha, ap, x, incx, beta, y,
|
||||
incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spmv( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* ap, const double* x, const int incx, const double beta,
|
||||
double* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDspmv( blas_option< UpLo >::value, n, alpha, ap, x, incx, beta, y,
|
||||
incy );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spmv( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const float* ap, const float* x,
|
||||
const fortran_int_t incx, const float beta, float* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSPMV( &blas_option< UpLo >::value, &n, &alpha, ap, x, &incx, &beta,
|
||||
y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spmv( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const double* ap, const double* x,
|
||||
const fortran_int_t incx, const double beta, double* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSPMV( &blas_option< UpLo >::value, &n, &alpha, ap, x, &incx, &beta,
|
||||
y, &incy );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to spmv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct spmv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixAP, typename VectorX, typename VectorY >
|
||||
static result_type invoke( const real_type alpha, const MatrixAP& ap,
|
||||
const VectorX& x, const real_type beta, VectorY& y ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAP >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
|
||||
MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
|
||||
detail::spmv( order(), uplo(), bindings::size_column(ap), alpha,
|
||||
bindings::begin_value(ap), bindings::begin_value(x),
|
||||
bindings::stride(x), beta, bindings::begin_value(y),
|
||||
bindings::stride(y) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 spmv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for spmv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP, typename VectorX, typename VectorY >
|
||||
inline typename spmv_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::result_type
|
||||
spmv( const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAP >::type >::type alpha, const MatrixAP& ap, const VectorX& x,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixAP >::type >::type beta, VectorY& y ) {
|
||||
spmv_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( alpha, ap, x, beta, y );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
203
sdk/boost/numeric/bindings/blas/level2/spr.hpp
Normal file
203
sdk/boost/numeric/bindings/blas/level2/spr.hpp
Normal file
@@ -0,0 +1,203 @@
|
||||
//
|
||||
// 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_LEVEL2_SPR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPR_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.hpp>
|
||||
#include <boost/numeric/bindings/has_triangular_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spr( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, float* ap ) {
|
||||
cblas_sspr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spr( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, double* ap ) {
|
||||
cblas_dspr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, ap );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spr( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, float* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSspr( blas_option< UpLo >::value, n, alpha, x, incx, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spr( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, double* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDspr( blas_option< UpLo >::value, n, alpha, x, incx, ap );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spr( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const float* x, const fortran_int_t incx,
|
||||
float* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSPR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spr( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const double* x, const fortran_int_t incx,
|
||||
double* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSPR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, ap );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to spr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct spr_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename VectorX, typename MatrixAP >
|
||||
static result_type invoke( const real_type alpha, const VectorX& x,
|
||||
MatrixAP& ap ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAP >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAP >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
|
||||
MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
detail::spr( order(), uplo(), bindings::size_column(ap), alpha,
|
||||
bindings::begin_value(x), bindings::stride(x),
|
||||
bindings::begin_value(ap) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 spr_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for spr. Its overload differs for
|
||||
//
|
||||
template< typename VectorX, typename MatrixAP >
|
||||
inline typename spr_impl< typename bindings::value_type<
|
||||
VectorX >::type >::result_type
|
||||
spr( const typename remove_imaginary< typename bindings::value_type<
|
||||
VectorX >::type >::type alpha, const VectorX& x, MatrixAP& ap ) {
|
||||
spr_impl< typename bindings::value_type<
|
||||
VectorX >::type >::invoke( alpha, x, ap );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
216
sdk/boost/numeric/bindings/blas/level2/spr2.hpp
Normal file
216
sdk/boost/numeric/bindings/blas/level2/spr2.hpp
Normal file
@@ -0,0 +1,216 @@
|
||||
//
|
||||
// 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_LEVEL2_SPR2_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SPR2_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.hpp>
|
||||
#include <boost/numeric/bindings/has_triangular_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spr2( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, const float* y, const int incy,
|
||||
float* ap ) {
|
||||
cblas_sspr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, y, incy, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spr2( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, const double* y, const int incy,
|
||||
double* ap ) {
|
||||
cblas_dspr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, y, incy, ap );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spr2( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, const float* y, const int incy,
|
||||
float* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSspr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spr2( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, const double* y, const int incy,
|
||||
double* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDspr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, ap );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spr2( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const float* x, const fortran_int_t incx,
|
||||
const float* y, const fortran_int_t incy, float* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSPR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
|
||||
ap );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void spr2( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const double* x, const fortran_int_t incx,
|
||||
const double* y, const fortran_int_t incy, double* ap ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSPR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
|
||||
ap );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to spr2.
|
||||
//
|
||||
template< typename Value >
|
||||
struct spr2_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixAP >
|
||||
static result_type invoke( const real_type alpha, const VectorX& x,
|
||||
const VectorY& y, MatrixAP& ap ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixAP >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixAP >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixAP >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
|
||||
MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixAP >::value) );
|
||||
detail::spr2( order(), uplo(), bindings::size_column(ap), alpha,
|
||||
bindings::begin_value(x), bindings::stride(x),
|
||||
bindings::begin_value(y), bindings::stride(y),
|
||||
bindings::begin_value(ap) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 spr2_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for spr2. Its overload differs for
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixAP >
|
||||
inline typename spr2_impl< typename bindings::value_type<
|
||||
VectorX >::type >::result_type
|
||||
spr2( const typename remove_imaginary< typename bindings::value_type<
|
||||
VectorX >::type >::type alpha, const VectorX& x, const VectorY& y,
|
||||
MatrixAP& ap ) {
|
||||
spr2_impl< typename bindings::value_type<
|
||||
VectorX >::type >::invoke( alpha, x, y, ap );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
221
sdk/boost/numeric/bindings/blas/level2/symv.hpp
Normal file
221
sdk/boost/numeric/bindings/blas/level2/symv.hpp
Normal file
@@ -0,0 +1,221 @@
|
||||
//
|
||||
// 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_LEVEL2_SYMV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYMV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void symv( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* a, const int lda, const float* x, const int incx,
|
||||
const float beta, float* y, const int incy ) {
|
||||
cblas_ssymv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, a, lda, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void symv( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* a, const int lda, const double* x, const int incx,
|
||||
const double beta, double* y, const int incy ) {
|
||||
cblas_dsymv( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, a, lda, x, incx, beta, y, incy );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void symv( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* a, const int lda, const float* x, const int incx,
|
||||
const float beta, float* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSsymv( blas_option< UpLo >::value, n, alpha, a, lda, x, incx, beta,
|
||||
y, incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void symv( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* a, const int lda, const double* x, const int incx,
|
||||
const double beta, double* y, const int incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDsymv( blas_option< UpLo >::value, n, alpha, a, lda, x, incx, beta,
|
||||
y, incy );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void symv( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const float* a, const fortran_int_t lda,
|
||||
const float* x, const fortran_int_t incx, const float beta, float* y,
|
||||
const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSYMV( &blas_option< UpLo >::value, &n, &alpha, a, &lda, x, &incx,
|
||||
&beta, y, &incy );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void symv( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const double* a, const fortran_int_t lda,
|
||||
const double* x, const fortran_int_t incx, const double beta,
|
||||
double* y, const fortran_int_t incy ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSYMV( &blas_option< UpLo >::value, &n, &alpha, a, &lda, x, &incx,
|
||||
&beta, y, &incy );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to symv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct symv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
static result_type invoke( const real_type alpha, const MatrixA& a,
|
||||
const VectorX& x, const real_type beta, VectorY& y ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::symv( order(), uplo(), bindings::size_column(a), alpha,
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(x), bindings::stride(x), beta,
|
||||
bindings::begin_value(y), bindings::stride(y) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 symv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for symv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorX, typename VectorY >
|
||||
inline typename symv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::result_type
|
||||
symv( const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type alpha, const MatrixA& a, const VectorX& x,
|
||||
const typename remove_imaginary< typename bindings::value_type<
|
||||
MatrixA >::type >::type beta, VectorY& y ) {
|
||||
symv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( alpha, a, x, beta, y );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
203
sdk/boost/numeric/bindings/blas/level2/syr.hpp
Normal file
203
sdk/boost/numeric/bindings/blas/level2/syr.hpp
Normal file
@@ -0,0 +1,203 @@
|
||||
//
|
||||
// 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_LEVEL2_SYR_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYR_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void syr( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, float* a, const int lda ) {
|
||||
cblas_ssyr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void syr( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, double* a, const int lda ) {
|
||||
cblas_dsyr( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, a, lda );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void syr( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, float* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSsyr( blas_option< UpLo >::value, n, alpha, x, incx, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void syr( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, double* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDsyr( blas_option< UpLo >::value, n, alpha, x, incx, a, lda );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void syr( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const float* x, const fortran_int_t incx, float* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSYR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, a, &lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void syr( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const double* x, const fortran_int_t incx,
|
||||
double* a, const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSYR( &blas_option< UpLo >::value, &n, &alpha, x, &incx, a, &lda );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to syr.
|
||||
//
|
||||
template< typename Value >
|
||||
struct syr_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename VectorX, typename MatrixA >
|
||||
static result_type invoke( const real_type alpha, const VectorX& x,
|
||||
MatrixA& a ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixA >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::syr( order(), uplo(), bindings::size_column(a), alpha,
|
||||
bindings::begin_value(x), bindings::stride(x),
|
||||
bindings::begin_value(a), bindings::stride_major(a) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 syr_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for syr. Its overload differs for
|
||||
//
|
||||
template< typename VectorX, typename MatrixA >
|
||||
inline typename syr_impl< typename bindings::value_type<
|
||||
VectorX >::type >::result_type
|
||||
syr( const typename remove_imaginary< typename bindings::value_type<
|
||||
VectorX >::type >::type alpha, const VectorX& x, MatrixA& a ) {
|
||||
syr_impl< typename bindings::value_type<
|
||||
VectorX >::type >::invoke( alpha, x, a );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
220
sdk/boost/numeric/bindings/blas/level2/syr2.hpp
Normal file
220
sdk/boost/numeric/bindings/blas/level2/syr2.hpp
Normal file
@@ -0,0 +1,220 @@
|
||||
//
|
||||
// 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_LEVEL2_SYR2_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_SYR2_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/data_order.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void syr2( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, const float* y, const int incy,
|
||||
float* a, const int lda ) {
|
||||
cblas_ssyr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, y, incy, a, lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void syr2( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, const double* y, const int incy,
|
||||
double* a, const int lda ) {
|
||||
cblas_dsyr2( cblas_option< Order >::value, cblas_option< UpLo >::value, n,
|
||||
alpha, x, incx, y, incy, a, lda );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void syr2( const Order, const UpLo, const int n, const float alpha,
|
||||
const float* x, const int incx, const float* y, const int incy,
|
||||
float* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasSsyr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, a,
|
||||
lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void syr2( const Order, const UpLo, const int n, const double alpha,
|
||||
const double* x, const int incx, const double* y, const int incy,
|
||||
double* a, const int lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDsyr2( blas_option< UpLo >::value, n, alpha, x, incx, y, incy, a,
|
||||
lda );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void syr2( const Order, const UpLo, const fortran_int_t n,
|
||||
const float alpha, const float* x, const fortran_int_t incx,
|
||||
const float* y, const fortran_int_t incy, float* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_SSYR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
|
||||
a, &lda );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo >
|
||||
inline void syr2( const Order, const UpLo, const fortran_int_t n,
|
||||
const double alpha, const double* x, const fortran_int_t incx,
|
||||
const double* y, const fortran_int_t incy, double* a,
|
||||
const fortran_int_t lda ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DSYR2( &blas_option< UpLo >::value, &n, &alpha, x, &incx, y, &incy,
|
||||
a, &lda );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to syr2.
|
||||
//
|
||||
template< typename Value >
|
||||
struct syr2_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixA >
|
||||
static result_type invoke( const real_type alpha, const VectorX& x,
|
||||
const VectorY& y, MatrixA& a ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename result_of::data_order< MatrixA >::type order;
|
||||
typedef typename result_of::uplo_tag< MatrixA >::type uplo;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorY >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< VectorX >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
MatrixA >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixA >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::syr2( order(), uplo(), bindings::size_column(a), alpha,
|
||||
bindings::begin_value(x), bindings::stride(x),
|
||||
bindings::begin_value(y), bindings::stride(y),
|
||||
bindings::begin_value(a), bindings::stride_major(a) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 syr2_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for syr2. Its overload differs for
|
||||
//
|
||||
template< typename VectorX, typename VectorY, typename MatrixA >
|
||||
inline typename syr2_impl< typename bindings::value_type<
|
||||
VectorX >::type >::result_type
|
||||
syr2( const typename remove_imaginary< typename bindings::value_type<
|
||||
VectorX >::type >::type alpha, const VectorX& x, const VectorY& y,
|
||||
MatrixA& a ) {
|
||||
syr2_impl< typename bindings::value_type<
|
||||
VectorX >::type >::invoke( alpha, x, y, a );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
305
sdk/boost/numeric/bindings/blas/level2/tbmv.hpp
Normal file
305
sdk/boost/numeric/bindings/blas/level2/tbmv.hpp
Normal file
@@ -0,0 +1,305 @@
|
||||
//
|
||||
// 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_LEVEL2_TBMV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TBMV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
|
||||
#include <boost/numeric/bindings/diag_tag.hpp>
|
||||
#include <boost/numeric/bindings/has_band_array.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const float* a, const int lda, float* x,
|
||||
const int incx ) {
|
||||
cblas_stbmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
|
||||
a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const double* a, const int lda, double* x,
|
||||
const int incx ) {
|
||||
cblas_dtbmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
|
||||
a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const std::complex<float>* a, const int lda,
|
||||
std::complex<float>* x, const int incx ) {
|
||||
cblas_ctbmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
|
||||
a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const std::complex<double>* a,
|
||||
const int lda, std::complex<double>* x, const int incx ) {
|
||||
cblas_ztbmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
|
||||
a, lda, x, incx );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const float* a, const int lda, float* x,
|
||||
const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasStbmv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, k, a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const double* a, const int lda, double* x,
|
||||
const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDtbmv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, k, a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const std::complex<float>* a, const int lda,
|
||||
std::complex<float>* x, const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasCtbmv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, k, a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const std::complex<double>* a,
|
||||
const int lda, std::complex<double>* x, const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZtbmv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, k, a, lda, x, incx );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const fortran_int_t k, const float* a,
|
||||
const fortran_int_t lda, float* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_STBMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const fortran_int_t k, const double* a,
|
||||
const fortran_int_t lda, double* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DTBMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const fortran_int_t k,
|
||||
const std::complex<float>* a, const fortran_int_t lda,
|
||||
std::complex<float>* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CTBMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const fortran_int_t k,
|
||||
const std::complex<double>* a, const fortran_int_t lda,
|
||||
std::complex<double>* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZTBMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to tbmv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct tbmv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixA, typename VectorX >
|
||||
static result_type invoke( const std::ptrdiff_t k, const MatrixA& a,
|
||||
VectorX& x ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename detail::default_order< MatrixA >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
typedef typename result_of::uplo_tag< MatrixA, trans >::type uplo;
|
||||
typedef typename result_of::diag_tag< MatrixA >::type diag;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_band_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::tbmv( order(), uplo(), trans(), diag(),
|
||||
bindings::size_column_op(a, trans()), k,
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(x), bindings::stride(x) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 tbmv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for tbmv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorX >
|
||||
inline typename tbmv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::result_type
|
||||
tbmv( const std::ptrdiff_t k, const MatrixA& a, VectorX& x ) {
|
||||
tbmv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( k, a, x );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
305
sdk/boost/numeric/bindings/blas/level2/tbsv.hpp
Normal file
305
sdk/boost/numeric/bindings/blas/level2/tbsv.hpp
Normal file
@@ -0,0 +1,305 @@
|
||||
//
|
||||
// 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_LEVEL2_TBSV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TBSV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/bandwidth.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
|
||||
#include <boost/numeric/bindings/diag_tag.hpp>
|
||||
#include <boost/numeric/bindings/has_band_array.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const float* a, const int lda, float* x,
|
||||
const int incx ) {
|
||||
cblas_stbsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
|
||||
a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const double* a, const int lda, double* x,
|
||||
const int incx ) {
|
||||
cblas_dtbsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
|
||||
a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const std::complex<float>* a, const int lda,
|
||||
std::complex<float>* x, const int incx ) {
|
||||
cblas_ctbsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
|
||||
a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const std::complex<double>* a,
|
||||
const int lda, std::complex<double>* x, const int incx ) {
|
||||
cblas_ztbsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, k,
|
||||
a, lda, x, incx );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const float* a, const int lda, float* x,
|
||||
const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasStbsv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, k, a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const double* a, const int lda, double* x,
|
||||
const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDtbsv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, k, a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const std::complex<float>* a, const int lda,
|
||||
std::complex<float>* x, const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasCtbsv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, k, a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const int k, const std::complex<double>* a,
|
||||
const int lda, std::complex<double>* x, const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZtbsv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, k, a, lda, x, incx );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const fortran_int_t k, const float* a,
|
||||
const fortran_int_t lda, float* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_STBSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const fortran_int_t k, const double* a,
|
||||
const fortran_int_t lda, double* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DTBSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const fortran_int_t k,
|
||||
const std::complex<float>* a, const fortran_int_t lda,
|
||||
std::complex<float>* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CTBSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tbsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const fortran_int_t k,
|
||||
const std::complex<double>* a, const fortran_int_t lda,
|
||||
std::complex<double>* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZTBSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, &k, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to tbsv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct tbsv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixA, typename VectorX >
|
||||
static result_type invoke( const std::ptrdiff_t k, const MatrixA& a,
|
||||
VectorX& x ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename detail::default_order< MatrixA >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
typedef typename result_of::uplo_tag< MatrixA, trans >::type uplo;
|
||||
typedef typename result_of::diag_tag< MatrixA >::type diag;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_band_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::tbsv( order(), uplo(), trans(), diag(),
|
||||
bindings::size_column_op(a, trans()), k,
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(x), bindings::stride(x) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 tbsv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for tbsv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorX >
|
||||
inline typename tbsv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::result_type
|
||||
tbsv( const std::ptrdiff_t k, const MatrixA& a, VectorX& x ) {
|
||||
tbsv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( k, a, x );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
296
sdk/boost/numeric/bindings/blas/level2/tpmv.hpp
Normal file
296
sdk/boost/numeric/bindings/blas/level2/tpmv.hpp
Normal file
@@ -0,0 +1,296 @@
|
||||
//
|
||||
// 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_LEVEL2_TPMV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TPMV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
|
||||
#include <boost/numeric/bindings/diag_tag.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.hpp>
|
||||
#include <boost/numeric/bindings/has_triangular_array.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/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const float* ap, float* x, const int incx ) {
|
||||
cblas_stpmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
|
||||
x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const double* ap, double* x, const int incx ) {
|
||||
cblas_dtpmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
|
||||
x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<float>* ap, std::complex<float>* x,
|
||||
const int incx ) {
|
||||
cblas_ctpmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
|
||||
x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<double>* ap, std::complex<double>* x,
|
||||
const int incx ) {
|
||||
cblas_ztpmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
|
||||
x, incx );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const float* ap, float* x, const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasStpmv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, ap, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const double* ap, double* x, const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDtpmv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, ap, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<float>* ap, std::complex<float>* x,
|
||||
const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasCtpmv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, ap, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<double>* ap, std::complex<double>* x,
|
||||
const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZtpmv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, ap, x, incx );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const float* ap, float* x,
|
||||
const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_STPMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, ap, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const double* ap, double* x,
|
||||
const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DTPMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, ap, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const std::complex<float>* ap,
|
||||
std::complex<float>* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CTPMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, ap, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const std::complex<double>* ap,
|
||||
std::complex<double>* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZTPMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, ap, x, &incx );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to tpmv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct tpmv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixAP, typename VectorX >
|
||||
static result_type invoke( const MatrixAP& ap, VectorX& x ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename detail::default_order< MatrixAP >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixAP, order >::type trans;
|
||||
typedef typename result_of::uplo_tag< MatrixAP, trans >::type uplo;
|
||||
typedef typename result_of::diag_tag< MatrixAP >::type diag;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
|
||||
MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
|
||||
detail::tpmv( order(), uplo(), trans(), diag(),
|
||||
bindings::size_column_op(ap, trans()),
|
||||
bindings::begin_value(ap), bindings::begin_value(x),
|
||||
bindings::stride(x) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 tpmv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for tpmv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP, typename VectorX >
|
||||
inline typename tpmv_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::result_type
|
||||
tpmv( const MatrixAP& ap, VectorX& x ) {
|
||||
tpmv_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, x );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
296
sdk/boost/numeric/bindings/blas/level2/tpsv.hpp
Normal file
296
sdk/boost/numeric/bindings/blas/level2/tpsv.hpp
Normal file
@@ -0,0 +1,296 @@
|
||||
//
|
||||
// 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_LEVEL2_TPSV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TPSV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
|
||||
#include <boost/numeric/bindings/diag_tag.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.hpp>
|
||||
#include <boost/numeric/bindings/has_triangular_array.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/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const float* ap, float* x, const int incx ) {
|
||||
cblas_stpsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
|
||||
x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const double* ap, double* x, const int incx ) {
|
||||
cblas_dtpsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
|
||||
x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<float>* ap, std::complex<float>* x,
|
||||
const int incx ) {
|
||||
cblas_ctpsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
|
||||
x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<double>* ap, std::complex<double>* x,
|
||||
const int incx ) {
|
||||
cblas_ztpsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, ap,
|
||||
x, incx );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const float* ap, float* x, const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasStpsv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, ap, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const double* ap, double* x, const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDtpsv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, ap, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<float>* ap, std::complex<float>* x,
|
||||
const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasCtpsv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, ap, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<double>* ap, std::complex<double>* x,
|
||||
const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZtpsv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, ap, x, incx );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const float* ap, float* x,
|
||||
const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_STPSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, ap, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const double* ap, double* x,
|
||||
const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DTPSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, ap, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const std::complex<float>* ap,
|
||||
std::complex<float>* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CTPSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, ap, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void tpsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const std::complex<double>* ap,
|
||||
std::complex<double>* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZTPSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, ap, x, &incx );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to tpsv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct tpsv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixAP, typename VectorX >
|
||||
static result_type invoke( const MatrixAP& ap, VectorX& x ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename detail::default_order< MatrixAP >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixAP, order >::type trans;
|
||||
typedef typename result_of::uplo_tag< MatrixAP, trans >::type uplo;
|
||||
typedef typename result_of::diag_tag< MatrixAP >::type diag;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixAP >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_triangular_array<
|
||||
MatrixAP >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
|
||||
detail::tpsv( order(), uplo(), trans(), diag(),
|
||||
bindings::size_column_op(ap, trans()),
|
||||
bindings::begin_value(ap), bindings::begin_value(x),
|
||||
bindings::stride(x) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 tpsv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for tpsv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixAP, typename VectorX >
|
||||
inline typename tpsv_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::result_type
|
||||
tpsv( const MatrixAP& ap, VectorX& x ) {
|
||||
tpsv_impl< typename bindings::value_type<
|
||||
MatrixAP >::type >::invoke( ap, x );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
302
sdk/boost/numeric/bindings/blas/level2/trmv.hpp
Normal file
302
sdk/boost/numeric/bindings/blas/level2/trmv.hpp
Normal file
@@ -0,0 +1,302 @@
|
||||
//
|
||||
// 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_LEVEL2_TRMV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TRMV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
|
||||
#include <boost/numeric/bindings/diag_tag.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const float* a, const int lda, float* x,
|
||||
const int incx ) {
|
||||
cblas_strmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
|
||||
lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const double* a, const int lda, double* x,
|
||||
const int incx ) {
|
||||
cblas_dtrmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
|
||||
lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<float>* a, const int lda,
|
||||
std::complex<float>* x, const int incx ) {
|
||||
cblas_ctrmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
|
||||
lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<double>* a, const int lda,
|
||||
std::complex<double>* x, const int incx ) {
|
||||
cblas_ztrmv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
|
||||
lda, x, incx );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const float* a, const int lda, float* x,
|
||||
const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasStrmv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const double* a, const int lda, double* x,
|
||||
const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDtrmv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<float>* a, const int lda,
|
||||
std::complex<float>* x, const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasCtrmv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<double>* a, const int lda,
|
||||
std::complex<double>* x, const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZtrmv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, a, lda, x, incx );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const float* a, const fortran_int_t lda,
|
||||
float* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_STRMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const double* a, const fortran_int_t lda,
|
||||
double* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DTRMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const std::complex<float>* a,
|
||||
const fortran_int_t lda, std::complex<float>* x,
|
||||
const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CTRMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trmv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const std::complex<double>* a,
|
||||
const fortran_int_t lda, std::complex<double>* x,
|
||||
const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZTRMV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to trmv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct trmv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixA, typename VectorX >
|
||||
static result_type invoke( const MatrixA& a, VectorX& x ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename detail::default_order< MatrixA >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
typedef typename result_of::uplo_tag< MatrixA, trans >::type uplo;
|
||||
typedef typename result_of::diag_tag< MatrixA >::type diag;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::trmv( order(), uplo(), trans(), diag(),
|
||||
bindings::size_column_op(a, trans()),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(x), bindings::stride(x) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 trmv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for trmv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorX >
|
||||
inline typename trmv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::result_type
|
||||
trmv( const MatrixA& a, VectorX& x ) {
|
||||
trmv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, x );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
302
sdk/boost/numeric/bindings/blas/level2/trsv.hpp
Normal file
302
sdk/boost/numeric/bindings/blas/level2/trsv.hpp
Normal file
@@ -0,0 +1,302 @@
|
||||
//
|
||||
// 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_LEVEL2_TRSV_HPP
|
||||
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_TRSV_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/bindings/begin.hpp>
|
||||
#include <boost/numeric/bindings/blas/detail/default_order.hpp>
|
||||
#include <boost/numeric/bindings/diag_tag.hpp>
|
||||
#include <boost/numeric/bindings/has_linear_array.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/trans_tag.hpp>
|
||||
#include <boost/numeric/bindings/uplo_tag.hpp>
|
||||
#include <boost/numeric/bindings/value_type.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.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const float* a, const int lda, float* x,
|
||||
const int incx ) {
|
||||
cblas_strsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
|
||||
lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const double* a, const int lda, double* x,
|
||||
const int incx ) {
|
||||
cblas_dtrsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
|
||||
lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<float>* a, const int lda,
|
||||
std::complex<float>* x, const int incx ) {
|
||||
cblas_ctrsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
|
||||
lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<double>* a, const int lda,
|
||||
std::complex<double>* x, const int incx ) {
|
||||
cblas_ztrsv( cblas_option< Order >::value, cblas_option< UpLo >::value,
|
||||
cblas_option< Trans >::value, cblas_option< Diag >::value, n, a,
|
||||
lda, x, incx );
|
||||
}
|
||||
|
||||
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const float* a, const int lda, float* x,
|
||||
const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasStrsv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const double* a, const int lda, double* x,
|
||||
const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasDtrsv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<float>* a, const int lda,
|
||||
std::complex<float>* x, const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasCtrsv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, a, lda, x, incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * CUBLAS backend, and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const int n, const std::complex<double>* a, const int lda,
|
||||
std::complex<double>* x, const int incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
cublasZtrsv( blas_option< UpLo >::value, blas_option< Trans >::value,
|
||||
blas_option< Diag >::value, n, a, lda, x, incx );
|
||||
}
|
||||
|
||||
#else
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * float value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const float* a, const fortran_int_t lda,
|
||||
float* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_STRSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * double value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const double* a, const fortran_int_t lda,
|
||||
double* x, const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_DTRSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<float> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const std::complex<float>* a,
|
||||
const fortran_int_t lda, std::complex<float>* x,
|
||||
const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_CTRSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
//
|
||||
// Overloaded function for dispatching to
|
||||
// * netlib-compatible BLAS backend (the default), and
|
||||
// * complex<double> value-type.
|
||||
//
|
||||
template< typename Order, typename UpLo, typename Trans, typename Diag >
|
||||
inline void trsv( const Order, const UpLo, const Trans, const Diag,
|
||||
const fortran_int_t n, const std::complex<double>* a,
|
||||
const fortran_int_t lda, std::complex<double>* x,
|
||||
const fortran_int_t incx ) {
|
||||
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
|
||||
BLAS_ZTRSV( &blas_option< UpLo >::value, &blas_option< Trans >::value,
|
||||
&blas_option< Diag >::value, &n, a, &lda, x, &incx );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// Value-type based template class. Use this class if you need a type
|
||||
// for dispatching to trsv.
|
||||
//
|
||||
template< typename Value >
|
||||
struct trsv_impl {
|
||||
|
||||
typedef Value value_type;
|
||||
typedef typename remove_imaginary< Value >::type real_type;
|
||||
typedef void result_type;
|
||||
|
||||
//
|
||||
// Static member function that
|
||||
// * Deduces the required arguments for dispatching to BLAS, and
|
||||
// * Asserts that most arguments make sense.
|
||||
//
|
||||
template< typename MatrixA, typename VectorX >
|
||||
static result_type invoke( const MatrixA& a, VectorX& x ) {
|
||||
namespace bindings = ::boost::numeric::bindings;
|
||||
typedef typename detail::default_order< MatrixA >::type order;
|
||||
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
|
||||
typedef typename result_of::uplo_tag< MatrixA, trans >::type uplo;
|
||||
typedef typename result_of::diag_tag< MatrixA >::type diag;
|
||||
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
|
||||
typename bindings::value_type< MatrixA >::type >::type,
|
||||
typename remove_const< typename bindings::value_type<
|
||||
VectorX >::type >::type >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
|
||||
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
|
||||
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
|
||||
bindings::stride_minor(a) == 1 );
|
||||
detail::trsv( order(), uplo(), trans(), diag(),
|
||||
bindings::size_column_op(a, trans()),
|
||||
bindings::begin_value(a), bindings::stride_major(a),
|
||||
bindings::begin_value(x), bindings::stride(x) );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// 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 trsv_impl classes. In the
|
||||
// documentation, the const-overloads are collapsed to avoid a large number of
|
||||
// prototypes which are very similar.
|
||||
//
|
||||
|
||||
//
|
||||
// Overloaded function for trsv. Its overload differs for
|
||||
//
|
||||
template< typename MatrixA, typename VectorX >
|
||||
inline typename trsv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::result_type
|
||||
trsv( const MatrixA& a, VectorX& x ) {
|
||||
trsv_impl< typename bindings::value_type<
|
||||
MatrixA >::type >::invoke( a, x );
|
||||
}
|
||||
|
||||
} // namespace blas
|
||||
} // namespace bindings
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user