Initial commit.

This commit is contained in:
2018-12-06 16:01:56 +01:00
parent 10867b60c2
commit 18eb3f6047
1011 changed files with 345688 additions and 10 deletions

View File

@@ -0,0 +1,574 @@
//
// Copyright (c) 2003--2009
// 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_DETAIL_BLAS_H
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_BLAS_H
#include <boost/numeric/bindings/blas/detail/blas_names.h>
extern "C" {
//
// BLAS level1 routines
//
// Value-type variants of asum
float BLAS_SASUM( const fortran_int_t* n, const float* x,
const fortran_int_t* incx );
double BLAS_DASUM( const fortran_int_t* n, const double* x,
const fortran_int_t* incx );
float BLAS_SCASUM( const fortran_int_t* n, const void* x,
const fortran_int_t* incx );
double BLAS_DZASUM( const fortran_int_t* n, const void* x,
const fortran_int_t* incx );
// Value-type variants of axpy
void BLAS_SAXPY( const fortran_int_t* n, const float* a, const float* x,
const fortran_int_t* incx, float* y, const fortran_int_t* incy );
void BLAS_DAXPY( const fortran_int_t* n, const double* a, const double* x,
const fortran_int_t* incx, double* y, const fortran_int_t* incy );
void BLAS_CAXPY( const fortran_int_t* n, const void* a, const void* x,
const fortran_int_t* incx, void* y, const fortran_int_t* incy );
void BLAS_ZAXPY( const fortran_int_t* n, const void* a, const void* x,
const fortran_int_t* incx, void* y, const fortran_int_t* incy );
// Value-type variants of copy
void BLAS_SCOPY( const fortran_int_t* n, const float* x,
const fortran_int_t* incx, float* y, const fortran_int_t* incy );
void BLAS_DCOPY( const fortran_int_t* n, const double* x,
const fortran_int_t* incx, double* y, const fortran_int_t* incy );
void BLAS_CCOPY( const fortran_int_t* n, const void* x,
const fortran_int_t* incx, void* y, const fortran_int_t* incy );
void BLAS_ZCOPY( const fortran_int_t* n, const void* x,
const fortran_int_t* incx, void* y, const fortran_int_t* incy );
// Value-type variants of dot
float BLAS_SDOT( const fortran_int_t* n, const float* x,
const fortran_int_t* incx, const float* y, const fortran_int_t* incy );
double BLAS_DDOT( const fortran_int_t* n, const double* x,
const fortran_int_t* incx, const double* y,
const fortran_int_t* incy );
std::complex<float> BLAS_CDOTU( const fortran_int_t* n, const void* x,
const fortran_int_t* incx, const void* y, const fortran_int_t* incy );
std::complex<double> BLAS_ZDOTU( const fortran_int_t* n, const void* x,
const fortran_int_t* incx, const void* y, const fortran_int_t* incy );
// Value-type variants of dotc
std::complex<float> BLAS_CDOTC( const fortran_int_t* n, const void* x,
const fortran_int_t* incx, const void* y, const fortran_int_t* incy );
std::complex<double> BLAS_ZDOTC( const fortran_int_t* n, const void* x,
const fortran_int_t* incx, const void* y, const fortran_int_t* incy );
// Value-type variants of iamax
fortran_int_t BLAS_ISAMAX( const fortran_int_t* n, const float* x,
const fortran_int_t* incx );
fortran_int_t BLAS_IDAMAX( const fortran_int_t* n, const double* x,
const fortran_int_t* incx );
fortran_int_t BLAS_ICAMAX( const fortran_int_t* n, const void* x,
const fortran_int_t* incx );
fortran_int_t BLAS_IZAMAX( const fortran_int_t* n, const void* x,
const fortran_int_t* incx );
// Value-type variants of nrm2
float BLAS_SNRM2( const fortran_int_t* n, const float* x,
const fortran_int_t* incx );
double BLAS_DNRM2( const fortran_int_t* n, const double* x,
const fortran_int_t* incx );
float BLAS_SCNRM2( const fortran_int_t* n, const void* x,
const fortran_int_t* incx );
double BLAS_DZNRM2( const fortran_int_t* n, const void* x,
const fortran_int_t* incx );
// Value-type variants of prec_dot
double BLAS_DSDOT( const fortran_int_t* n, const float* x,
const fortran_int_t* incx, const float* y, const fortran_int_t* incy );
// Value-type variants of rot
void BLAS_SROT( const fortran_int_t* n, float* x, const fortran_int_t* incx,
float* y, const fortran_int_t* incy, const float* c, const float* s );
void BLAS_DROT( const fortran_int_t* n, double* x, const fortran_int_t* incx,
double* y, const fortran_int_t* incy, const double* c,
const double* s );
void BLAS_CSROT( const fortran_int_t* n, void* x, const fortran_int_t* incx,
void* y, const fortran_int_t* incy, const float* c, const float* s );
void BLAS_ZDROT( const fortran_int_t* n, void* x, const fortran_int_t* incx,
void* y, const fortran_int_t* incy, const double* c, const double* s );
// Value-type variants of rotg
void BLAS_SROTG( float* a, float* b, float* c, float* s );
void BLAS_DROTG( double* a, double* b, double* c, double* s );
void BLAS_CROTG( void* a, void* b, float* c, void* s );
void BLAS_ZROTG( void* a, void* b, double* c, void* s );
// Value-type variants of rotm
void BLAS_SROTM( const fortran_int_t* n, float* x, const fortran_int_t* incx,
float* y, const fortran_int_t* incy, float* param );
void BLAS_DROTM( const fortran_int_t* n, double* x, const fortran_int_t* incx,
double* y, const fortran_int_t* incy, double* param );
// Value-type variants of rotmg
void BLAS_SROTMG( float* d1, float* d2, float* x1, const float* y1,
float* sparam );
void BLAS_DROTMG( double* d1, double* d2, double* x1, const double* y1,
double* dparam );
// Value-type variants of scal
void BLAS_SSCAL( const fortran_int_t* n, const float* a, float* x,
const fortran_int_t* incx );
void BLAS_DSCAL( const fortran_int_t* n, const double* a, double* x,
const fortran_int_t* incx );
void BLAS_CSSCAL( const fortran_int_t* n, const float* a, void* x,
const fortran_int_t* incx );
void BLAS_ZDSCAL( const fortran_int_t* n, const double* a, void* x,
const fortran_int_t* incx );
void BLAS_CSCAL( const fortran_int_t* n, const void* a, void* x,
const fortran_int_t* incx );
void BLAS_ZSCAL( const fortran_int_t* n, const void* a, void* x,
const fortran_int_t* incx );
// Value-type variants of swap
void BLAS_SSWAP( const fortran_int_t* n, float* x, const fortran_int_t* incx,
float* y, const fortran_int_t* incy );
void BLAS_DSWAP( const fortran_int_t* n, double* x, const fortran_int_t* incx,
double* y, const fortran_int_t* incy );
void BLAS_CSWAP( const fortran_int_t* n, void* x, const fortran_int_t* incx,
void* y, const fortran_int_t* incy );
void BLAS_ZSWAP( const fortran_int_t* n, void* x, const fortran_int_t* incx,
void* y, const fortran_int_t* incy );
//
// BLAS level2 routines
//
// Value-type variants of gbmv
void BLAS_SGBMV( const char* 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 );
void BLAS_DGBMV( const char* 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 );
void BLAS_CGBMV( const char* trans, const fortran_int_t* m,
const fortran_int_t* n, const fortran_int_t* kl,
const fortran_int_t* ku, const void* alpha, const void* a,
const fortran_int_t* lda, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
void BLAS_ZGBMV( const char* trans, const fortran_int_t* m,
const fortran_int_t* n, const fortran_int_t* kl,
const fortran_int_t* ku, const void* alpha, const void* a,
const fortran_int_t* lda, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
// Value-type variants of gemv
void BLAS_SGEMV( const char* 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 );
void BLAS_DGEMV( const char* 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 );
void BLAS_CGEMV( const char* trans, const fortran_int_t* m,
const fortran_int_t* n, const void* alpha, const void* a,
const fortran_int_t* lda, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
void BLAS_ZGEMV( const char* trans, const fortran_int_t* m,
const fortran_int_t* n, const void* alpha, const void* a,
const fortran_int_t* lda, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
// Value-type variants of ger
void BLAS_SGER( 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 );
void BLAS_DGER( 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 );
// Value-type variants of gerc
void BLAS_CGERC( const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* x, const fortran_int_t* incx,
const void* y, const fortran_int_t* incy, void* a,
const fortran_int_t* lda );
void BLAS_ZGERC( const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* x, const fortran_int_t* incx,
const void* y, const fortran_int_t* incy, void* a,
const fortran_int_t* lda );
// Value-type variants of geru
void BLAS_CGERU( const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* x, const fortran_int_t* incx,
const void* y, const fortran_int_t* incy, void* a,
const fortran_int_t* lda );
void BLAS_ZGERU( const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* x, const fortran_int_t* incx,
const void* y, const fortran_int_t* incy, void* a,
const fortran_int_t* lda );
// Value-type variants of hbmv
void BLAS_CHBMV( const char* uplo, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
void BLAS_ZHBMV( const char* uplo, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
// Value-type variants of hemv
void BLAS_CHEMV( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* a, const fortran_int_t* lda, const void* x,
const fortran_int_t* incx, const void* beta, void* y,
const fortran_int_t* incy );
void BLAS_ZHEMV( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* a, const fortran_int_t* lda, const void* x,
const fortran_int_t* incx, const void* beta, void* y,
const fortran_int_t* incy );
// Value-type variants of her
void BLAS_CHER( const char* uplo, const fortran_int_t* n, const float* alpha,
const void* x, const fortran_int_t* incx, void* a,
const fortran_int_t* lda );
void BLAS_ZHER( const char* uplo, const fortran_int_t* n, const double* alpha,
const void* x, const fortran_int_t* incx, void* a,
const fortran_int_t* lda );
// Value-type variants of her2
void BLAS_CHER2( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* x, const fortran_int_t* incx, const void* y,
const fortran_int_t* incy, void* a, const fortran_int_t* lda );
void BLAS_ZHER2( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* x, const fortran_int_t* incx, const void* y,
const fortran_int_t* incy, void* a, const fortran_int_t* lda );
// Value-type variants of hpmv
void BLAS_CHPMV( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* ap, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
void BLAS_ZHPMV( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* ap, const void* x, const fortran_int_t* incx,
const void* beta, void* y, const fortran_int_t* incy );
// Value-type variants of hpr
void BLAS_CHPR( const char* uplo, const fortran_int_t* n, const float* alpha,
const void* x, const fortran_int_t* incx, void* ap );
void BLAS_ZHPR( const char* uplo, const fortran_int_t* n, const double* alpha,
const void* x, const fortran_int_t* incx, void* ap );
// Value-type variants of hpr2
void BLAS_CHPR2( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* x, const fortran_int_t* incx, const void* y,
const fortran_int_t* incy, void* ap );
void BLAS_ZHPR2( const char* uplo, const fortran_int_t* n, const void* alpha,
const void* x, const fortran_int_t* incx, const void* y,
const fortran_int_t* incy, void* ap );
// Value-type variants of sbmv
void BLAS_SSBMV( const char* 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 );
void BLAS_DSBMV( const char* 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 );
// Value-type variants of spmv
void BLAS_SSPMV( const char* 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 );
void BLAS_DSPMV( const char* 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 );
// Value-type variants of spr
void BLAS_SSPR( const char* uplo, const fortran_int_t* n, const float* alpha,
const float* x, const fortran_int_t* incx, float* ap );
void BLAS_DSPR( const char* uplo, const fortran_int_t* n, const double* alpha,
const double* x, const fortran_int_t* incx, double* ap );
// Value-type variants of spr2
void BLAS_SSPR2( const char* 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 );
void BLAS_DSPR2( const char* 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 );
// Value-type variants of symv
void BLAS_SSYMV( const char* 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 );
void BLAS_DSYMV( const char* 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 );
// Value-type variants of syr
void BLAS_SSYR( const char* uplo, const fortran_int_t* n, const float* alpha,
const float* x, const fortran_int_t* incx, float* a,
const fortran_int_t* lda );
void BLAS_DSYR( const char* uplo, const fortran_int_t* n, const double* alpha,
const double* x, const fortran_int_t* incx, double* a,
const fortran_int_t* lda );
// Value-type variants of syr2
void BLAS_SSYR2( const char* 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 );
void BLAS_DSYR2( const char* 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 );
// Value-type variants of tbmv
void BLAS_STBMV( const char* uplo, const char* trans, const char* 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 );
void BLAS_DTBMV( const char* uplo, const char* trans, const char* 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 );
void BLAS_CTBMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const fortran_int_t* k, const void* a,
const fortran_int_t* lda, void* x, const fortran_int_t* incx );
void BLAS_ZTBMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const fortran_int_t* k, const void* a,
const fortran_int_t* lda, void* x, const fortran_int_t* incx );
// Value-type variants of tbsv
void BLAS_STBSV( const char* uplo, const char* trans, const char* 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 );
void BLAS_DTBSV( const char* uplo, const char* trans, const char* 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 );
void BLAS_CTBSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const fortran_int_t* k, const void* a,
const fortran_int_t* lda, void* x, const fortran_int_t* incx );
void BLAS_ZTBSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const fortran_int_t* k, const void* a,
const fortran_int_t* lda, void* x, const fortran_int_t* incx );
// Value-type variants of tpmv
void BLAS_STPMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const float* ap, float* x,
const fortran_int_t* incx );
void BLAS_DTPMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const double* ap, double* x,
const fortran_int_t* incx );
void BLAS_CTPMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* ap, void* x,
const fortran_int_t* incx );
void BLAS_ZTPMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* ap, void* x,
const fortran_int_t* incx );
// Value-type variants of tpsv
void BLAS_STPSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const float* ap, float* x,
const fortran_int_t* incx );
void BLAS_DTPSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const double* ap, double* x,
const fortran_int_t* incx );
void BLAS_CTPSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* ap, void* x,
const fortran_int_t* incx );
void BLAS_ZTPSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* ap, void* x,
const fortran_int_t* incx );
// Value-type variants of trmv
void BLAS_STRMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const float* a, const fortran_int_t* lda,
float* x, const fortran_int_t* incx );
void BLAS_DTRMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const double* a, const fortran_int_t* lda,
double* x, const fortran_int_t* incx );
void BLAS_CTRMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* a, const fortran_int_t* lda,
void* x, const fortran_int_t* incx );
void BLAS_ZTRMV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* a, const fortran_int_t* lda,
void* x, const fortran_int_t* incx );
// Value-type variants of trsv
void BLAS_STRSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const float* a, const fortran_int_t* lda,
float* x, const fortran_int_t* incx );
void BLAS_DTRSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const double* a, const fortran_int_t* lda,
double* x, const fortran_int_t* incx );
void BLAS_CTRSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* a, const fortran_int_t* lda,
void* x, const fortran_int_t* incx );
void BLAS_ZTRSV( const char* uplo, const char* trans, const char* diag,
const fortran_int_t* n, const void* a, const fortran_int_t* lda,
void* x, const fortran_int_t* incx );
//
// BLAS level3 routines
//
// Value-type variants of gemm
void BLAS_SGEMM( const char* transa, const char* transb,
const fortran_int_t* m, const fortran_int_t* n,
const fortran_int_t* k, const float* alpha, const float* a,
const fortran_int_t* lda, const float* b, const fortran_int_t* ldb,
const float* beta, float* c, const fortran_int_t* ldc );
void BLAS_DGEMM( const char* transa, const char* transb,
const fortran_int_t* m, const fortran_int_t* n,
const fortran_int_t* k, const double* alpha, const double* a,
const fortran_int_t* lda, const double* b, const fortran_int_t* ldb,
const double* beta, double* c, const fortran_int_t* ldc );
void BLAS_CGEMM( const char* transa, const char* transb,
const fortran_int_t* m, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
void BLAS_ZGEMM( const char* transa, const char* transb,
const fortran_int_t* m, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
// Value-type variants of hemm
void BLAS_CHEMM( const char* side, const char* uplo, const fortran_int_t* m,
const fortran_int_t* n, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
void BLAS_ZHEMM( const char* side, const char* uplo, const fortran_int_t* m,
const fortran_int_t* n, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
// Value-type variants of her2k
void BLAS_CHER2K( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const float* beta, void* c, const fortran_int_t* ldc );
void BLAS_ZHER2K( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const double* beta, void* c, const fortran_int_t* ldc );
// Value-type variants of herk
void BLAS_CHERK( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const float* alpha, const void* a,
const fortran_int_t* lda, const float* beta, void* c,
const fortran_int_t* ldc );
void BLAS_ZHERK( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const double* alpha, const void* a,
const fortran_int_t* lda, const double* beta, void* c,
const fortran_int_t* ldc );
// Value-type variants of symm
void BLAS_SSYMM( const char* side, const char* uplo, const fortran_int_t* m,
const fortran_int_t* n, const float* alpha, const float* a,
const fortran_int_t* lda, const float* b, const fortran_int_t* ldb,
const float* beta, float* c, const fortran_int_t* ldc );
void BLAS_DSYMM( const char* side, const char* uplo, const fortran_int_t* m,
const fortran_int_t* n, const double* alpha, const double* a,
const fortran_int_t* lda, const double* b, const fortran_int_t* ldb,
const double* beta, double* c, const fortran_int_t* ldc );
void BLAS_CSYMM( const char* side, const char* uplo, const fortran_int_t* m,
const fortran_int_t* n, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
void BLAS_ZSYMM( const char* side, const char* uplo, const fortran_int_t* m,
const fortran_int_t* n, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
// Value-type variants of syr2k
void BLAS_SSYR2K( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const float* alpha, const float* a,
const fortran_int_t* lda, const float* b, const fortran_int_t* ldb,
const float* beta, float* c, const fortran_int_t* ldc );
void BLAS_DSYR2K( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const double* alpha, const double* a,
const fortran_int_t* lda, const double* b, const fortran_int_t* ldb,
const double* beta, double* c, const fortran_int_t* ldc );
void BLAS_CSYR2K( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
void BLAS_ZSYR2K( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* b, const fortran_int_t* ldb,
const void* beta, void* c, const fortran_int_t* ldc );
// Value-type variants of syrk
void BLAS_SSYRK( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const float* alpha, const float* a,
const fortran_int_t* lda, const float* beta, float* c,
const fortran_int_t* ldc );
void BLAS_DSYRK( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const double* alpha, const double* a,
const fortran_int_t* lda, const double* beta, double* c,
const fortran_int_t* ldc );
void BLAS_CSYRK( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* beta, void* c,
const fortran_int_t* ldc );
void BLAS_ZSYRK( const char* uplo, const char* trans, const fortran_int_t* n,
const fortran_int_t* k, const void* alpha, const void* a,
const fortran_int_t* lda, const void* beta, void* c,
const fortran_int_t* ldc );
// Value-type variants of trmm
void BLAS_STRMM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const float* alpha, const float* a, const fortran_int_t* lda,
float* b, const fortran_int_t* ldb );
void BLAS_DTRMM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const double* alpha, const double* a, const fortran_int_t* lda,
double* b, const fortran_int_t* ldb );
void BLAS_CTRMM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* a, const fortran_int_t* lda, void* b,
const fortran_int_t* ldb );
void BLAS_ZTRMM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* a, const fortran_int_t* lda, void* b,
const fortran_int_t* ldb );
// Value-type variants of trsm
void BLAS_STRSM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const float* alpha, const float* a, const fortran_int_t* lda,
float* b, const fortran_int_t* ldb );
void BLAS_DTRSM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const double* alpha, const double* a, const fortran_int_t* lda,
double* b, const fortran_int_t* ldb );
void BLAS_CTRSM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* a, const fortran_int_t* lda, void* b,
const fortran_int_t* ldb );
void BLAS_ZTRSM( const char* side, const char* uplo, const char* transa,
const char* diag, const fortran_int_t* m, const fortran_int_t* n,
const void* alpha, const void* a, const fortran_int_t* lda, void* b,
const fortran_int_t* ldb );
}
#endif

View File

@@ -0,0 +1,275 @@
//
// Copyright (c) 2003--2009
// 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_DETAIL_BLAS_NAMES_H
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_BLAS_NAMES_H
#include <boost/numeric/bindings/detail/config/fortran.hpp>
//
// BLAS level1 routines
//
// Value-type variants of asum
#define BLAS_SASUM FORTRAN_ID2( sasum, SASUM )
#define BLAS_DASUM FORTRAN_ID2( dasum, DASUM )
#define BLAS_SCASUM FORTRAN_ID2( scasum, SCASUM )
#define BLAS_DZASUM FORTRAN_ID2( dzasum, DZASUM )
// Value-type variants of axpy
#define BLAS_SAXPY FORTRAN_ID2( saxpy, SAXPY )
#define BLAS_DAXPY FORTRAN_ID2( daxpy, DAXPY )
#define BLAS_CAXPY FORTRAN_ID2( caxpy, CAXPY )
#define BLAS_ZAXPY FORTRAN_ID2( zaxpy, ZAXPY )
// Value-type variants of copy
#define BLAS_SCOPY FORTRAN_ID2( scopy, SCOPY )
#define BLAS_DCOPY FORTRAN_ID2( dcopy, DCOPY )
#define BLAS_CCOPY FORTRAN_ID2( ccopy, CCOPY )
#define BLAS_ZCOPY FORTRAN_ID2( zcopy, ZCOPY )
// Value-type variants of dot
#define BLAS_SDOT FORTRAN_ID2( sdot, SDOT )
#define BLAS_DDOT FORTRAN_ID2( ddot, DDOT )
#define BLAS_CDOTU FORTRAN_ID2( cdotu, CDOTU )
#define BLAS_ZDOTU FORTRAN_ID2( zdotu, ZDOTU )
// Value-type variants of dotc
#define BLAS_CDOTC FORTRAN_ID2( cdotc, CDOTC )
#define BLAS_ZDOTC FORTRAN_ID2( zdotc, ZDOTC )
// Value-type variants of iamax
#define BLAS_ISAMAX FORTRAN_ID2( isamax, ISAMAX )
#define BLAS_IDAMAX FORTRAN_ID2( idamax, IDAMAX )
#define BLAS_ICAMAX FORTRAN_ID2( icamax, ICAMAX )
#define BLAS_IZAMAX FORTRAN_ID2( izamax, IZAMAX )
// Value-type variants of nrm2
#define BLAS_SNRM2 FORTRAN_ID2( snrm2, SNRM2 )
#define BLAS_DNRM2 FORTRAN_ID2( dnrm2, DNRM2 )
#define BLAS_SCNRM2 FORTRAN_ID2( scnrm2, SCNRM2 )
#define BLAS_DZNRM2 FORTRAN_ID2( dznrm2, DZNRM2 )
// Value-type variants of prec_dot
#define BLAS_DSDOT FORTRAN_ID2( dsdot, DSDOT )
// Value-type variants of rot
#define BLAS_SROT FORTRAN_ID2( srot, SROT )
#define BLAS_DROT FORTRAN_ID2( drot, DROT )
#define BLAS_CSROT FORTRAN_ID2( csrot, CSROT )
#define BLAS_ZDROT FORTRAN_ID2( zdrot, ZDROT )
// Value-type variants of rotg
#define BLAS_SROTG FORTRAN_ID2( srotg, SROTG )
#define BLAS_DROTG FORTRAN_ID2( drotg, DROTG )
#define BLAS_CROTG FORTRAN_ID2( crotg, CROTG )
#define BLAS_ZROTG FORTRAN_ID2( zrotg, ZROTG )
// Value-type variants of rotm
#define BLAS_SROTM FORTRAN_ID2( srotm, SROTM )
#define BLAS_DROTM FORTRAN_ID2( drotm, DROTM )
// Value-type variants of rotmg
#define BLAS_SROTMG FORTRAN_ID2( srotmg, SROTMG )
#define BLAS_DROTMG FORTRAN_ID2( drotmg, DROTMG )
// Value-type variants of scal
#define BLAS_SSCAL FORTRAN_ID2( sscal, SSCAL )
#define BLAS_DSCAL FORTRAN_ID2( dscal, DSCAL )
#define BLAS_CSSCAL FORTRAN_ID2( csscal, CSSCAL )
#define BLAS_ZDSCAL FORTRAN_ID2( zdscal, ZDSCAL )
#define BLAS_CSCAL FORTRAN_ID2( cscal, CSCAL )
#define BLAS_ZSCAL FORTRAN_ID2( zscal, ZSCAL )
// Value-type variants of swap
#define BLAS_SSWAP FORTRAN_ID2( sswap, SSWAP )
#define BLAS_DSWAP FORTRAN_ID2( dswap, DSWAP )
#define BLAS_CSWAP FORTRAN_ID2( cswap, CSWAP )
#define BLAS_ZSWAP FORTRAN_ID2( zswap, ZSWAP )
//
// BLAS level2 routines
//
// Value-type variants of gbmv
#define BLAS_SGBMV FORTRAN_ID2( sgbmv, SGBMV )
#define BLAS_DGBMV FORTRAN_ID2( dgbmv, DGBMV )
#define BLAS_CGBMV FORTRAN_ID2( cgbmv, CGBMV )
#define BLAS_ZGBMV FORTRAN_ID2( zgbmv, ZGBMV )
// Value-type variants of gemv
#define BLAS_SGEMV FORTRAN_ID2( sgemv, SGEMV )
#define BLAS_DGEMV FORTRAN_ID2( dgemv, DGEMV )
#define BLAS_CGEMV FORTRAN_ID2( cgemv, CGEMV )
#define BLAS_ZGEMV FORTRAN_ID2( zgemv, ZGEMV )
// Value-type variants of ger
#define BLAS_SGER FORTRAN_ID2( sger, SGER )
#define BLAS_DGER FORTRAN_ID2( dger, DGER )
// Value-type variants of gerc
#define BLAS_CGERC FORTRAN_ID2( cgerc, CGERC )
#define BLAS_ZGERC FORTRAN_ID2( zgerc, ZGERC )
// Value-type variants of geru
#define BLAS_CGERU FORTRAN_ID2( cgeru, CGERU )
#define BLAS_ZGERU FORTRAN_ID2( zgeru, ZGERU )
// Value-type variants of hbmv
#define BLAS_CHBMV FORTRAN_ID2( chbmv, CHBMV )
#define BLAS_ZHBMV FORTRAN_ID2( zhbmv, ZHBMV )
// Value-type variants of hemv
#define BLAS_CHEMV FORTRAN_ID2( chemv, CHEMV )
#define BLAS_ZHEMV FORTRAN_ID2( zhemv, ZHEMV )
// Value-type variants of her
#define BLAS_CHER FORTRAN_ID2( cher, CHER )
#define BLAS_ZHER FORTRAN_ID2( zher, ZHER )
// Value-type variants of her2
#define BLAS_CHER2 FORTRAN_ID2( cher2, CHER2 )
#define BLAS_ZHER2 FORTRAN_ID2( zher2, ZHER2 )
// Value-type variants of hpmv
#define BLAS_CHPMV FORTRAN_ID2( chpmv, CHPMV )
#define BLAS_ZHPMV FORTRAN_ID2( zhpmv, ZHPMV )
// Value-type variants of hpr
#define BLAS_CHPR FORTRAN_ID2( chpr, CHPR )
#define BLAS_ZHPR FORTRAN_ID2( zhpr, ZHPR )
// Value-type variants of hpr2
#define BLAS_CHPR2 FORTRAN_ID2( chpr2, CHPR2 )
#define BLAS_ZHPR2 FORTRAN_ID2( zhpr2, ZHPR2 )
// Value-type variants of sbmv
#define BLAS_SSBMV FORTRAN_ID2( ssbmv, SSBMV )
#define BLAS_DSBMV FORTRAN_ID2( dsbmv, DSBMV )
// Value-type variants of spmv
#define BLAS_SSPMV FORTRAN_ID2( sspmv, SSPMV )
#define BLAS_DSPMV FORTRAN_ID2( dspmv, DSPMV )
// Value-type variants of spr
#define BLAS_SSPR FORTRAN_ID2( sspr, SSPR )
#define BLAS_DSPR FORTRAN_ID2( dspr, DSPR )
// Value-type variants of spr2
#define BLAS_SSPR2 FORTRAN_ID2( sspr2, SSPR2 )
#define BLAS_DSPR2 FORTRAN_ID2( dspr2, DSPR2 )
// Value-type variants of symv
#define BLAS_SSYMV FORTRAN_ID2( ssymv, SSYMV )
#define BLAS_DSYMV FORTRAN_ID2( dsymv, DSYMV )
// Value-type variants of syr
#define BLAS_SSYR FORTRAN_ID2( ssyr, SSYR )
#define BLAS_DSYR FORTRAN_ID2( dsyr, DSYR )
// Value-type variants of syr2
#define BLAS_SSYR2 FORTRAN_ID2( ssyr2, SSYR2 )
#define BLAS_DSYR2 FORTRAN_ID2( dsyr2, DSYR2 )
// Value-type variants of tbmv
#define BLAS_STBMV FORTRAN_ID2( stbmv, STBMV )
#define BLAS_DTBMV FORTRAN_ID2( dtbmv, DTBMV )
#define BLAS_CTBMV FORTRAN_ID2( ctbmv, CTBMV )
#define BLAS_ZTBMV FORTRAN_ID2( ztbmv, ZTBMV )
// Value-type variants of tbsv
#define BLAS_STBSV FORTRAN_ID2( stbsv, STBSV )
#define BLAS_DTBSV FORTRAN_ID2( dtbsv, DTBSV )
#define BLAS_CTBSV FORTRAN_ID2( ctbsv, CTBSV )
#define BLAS_ZTBSV FORTRAN_ID2( ztbsv, ZTBSV )
// Value-type variants of tpmv
#define BLAS_STPMV FORTRAN_ID2( stpmv, STPMV )
#define BLAS_DTPMV FORTRAN_ID2( dtpmv, DTPMV )
#define BLAS_CTPMV FORTRAN_ID2( ctpmv, CTPMV )
#define BLAS_ZTPMV FORTRAN_ID2( ztpmv, ZTPMV )
// Value-type variants of tpsv
#define BLAS_STPSV FORTRAN_ID2( stpsv, STPSV )
#define BLAS_DTPSV FORTRAN_ID2( dtpsv, DTPSV )
#define BLAS_CTPSV FORTRAN_ID2( ctpsv, CTPSV )
#define BLAS_ZTPSV FORTRAN_ID2( ztpsv, ZTPSV )
// Value-type variants of trmv
#define BLAS_STRMV FORTRAN_ID2( strmv, STRMV )
#define BLAS_DTRMV FORTRAN_ID2( dtrmv, DTRMV )
#define BLAS_CTRMV FORTRAN_ID2( ctrmv, CTRMV )
#define BLAS_ZTRMV FORTRAN_ID2( ztrmv, ZTRMV )
// Value-type variants of trsv
#define BLAS_STRSV FORTRAN_ID2( strsv, STRSV )
#define BLAS_DTRSV FORTRAN_ID2( dtrsv, DTRSV )
#define BLAS_CTRSV FORTRAN_ID2( ctrsv, CTRSV )
#define BLAS_ZTRSV FORTRAN_ID2( ztrsv, ZTRSV )
//
// BLAS level3 routines
//
// Value-type variants of gemm
#define BLAS_SGEMM FORTRAN_ID2( sgemm, SGEMM )
#define BLAS_DGEMM FORTRAN_ID2( dgemm, DGEMM )
#define BLAS_CGEMM FORTRAN_ID2( cgemm, CGEMM )
#define BLAS_ZGEMM FORTRAN_ID2( zgemm, ZGEMM )
// Value-type variants of hemm
#define BLAS_CHEMM FORTRAN_ID2( chemm, CHEMM )
#define BLAS_ZHEMM FORTRAN_ID2( zhemm, ZHEMM )
// Value-type variants of her2k
#define BLAS_CHER2K FORTRAN_ID2( cher2k, CHER2K )
#define BLAS_ZHER2K FORTRAN_ID2( zher2k, ZHER2K )
// Value-type variants of herk
#define BLAS_CHERK FORTRAN_ID2( cherk, CHERK )
#define BLAS_ZHERK FORTRAN_ID2( zherk, ZHERK )
// Value-type variants of symm
#define BLAS_SSYMM FORTRAN_ID2( ssymm, SSYMM )
#define BLAS_DSYMM FORTRAN_ID2( dsymm, DSYMM )
#define BLAS_CSYMM FORTRAN_ID2( csymm, CSYMM )
#define BLAS_ZSYMM FORTRAN_ID2( zsymm, ZSYMM )
// Value-type variants of syr2k
#define BLAS_SSYR2K FORTRAN_ID2( ssyr2k, SSYR2K )
#define BLAS_DSYR2K FORTRAN_ID2( dsyr2k, DSYR2K )
#define BLAS_CSYR2K FORTRAN_ID2( csyr2k, CSYR2K )
#define BLAS_ZSYR2K FORTRAN_ID2( zsyr2k, ZSYR2K )
// Value-type variants of syrk
#define BLAS_SSYRK FORTRAN_ID2( ssyrk, SSYRK )
#define BLAS_DSYRK FORTRAN_ID2( dsyrk, DSYRK )
#define BLAS_CSYRK FORTRAN_ID2( csyrk, CSYRK )
#define BLAS_ZSYRK FORTRAN_ID2( zsyrk, ZSYRK )
// Value-type variants of trmm
#define BLAS_STRMM FORTRAN_ID2( strmm, STRMM )
#define BLAS_DTRMM FORTRAN_ID2( dtrmm, DTRMM )
#define BLAS_CTRMM FORTRAN_ID2( ctrmm, CTRMM )
#define BLAS_ZTRMM FORTRAN_ID2( ztrmm, ZTRMM )
// Value-type variants of trsm
#define BLAS_STRSM FORTRAN_ID2( strsm, STRSM )
#define BLAS_DTRSM FORTRAN_ID2( dtrsm, DTRSM )
#define BLAS_CTRSM FORTRAN_ID2( ctrsm, CTRSM )
#define BLAS_ZTRSM FORTRAN_ID2( ztrsm, ZTRSM )
#endif

View File

@@ -0,0 +1,57 @@
//
// Copyright (c) 2009 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)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_BLAS_OPTION_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_BLAS_OPTION_HPP
#include <boost/mpl/char.hpp>
#include <boost/numeric/bindings/tag.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
namespace detail {
template< typename Tag >
struct blas_option {};
template<>
struct blas_option< tag::transpose >: mpl::char_< 'T' > {};
template<>
struct blas_option< tag::no_transpose >: mpl::char_< 'N' > {};
template<>
struct blas_option< tag::conjugate >: mpl::char_< 'C' > {};
template<>
struct blas_option< tag::upper >: mpl::char_< 'U' > {};
template<>
struct blas_option< tag::lower >: mpl::char_< 'L' > {};
template<>
struct blas_option< tag::unit >: mpl::char_< 'U' > {};
template<>
struct blas_option< tag::non_unit >: mpl::char_< 'N' > {};
template<>
struct blas_option< tag::left >: mpl::char_< 'L' > {};
template<>
struct blas_option< tag::right >: mpl::char_< 'R' > {};
} // namespace detail
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,41 @@
/*
*
* Copyright (c) Kresimir Fresl 2002
*
* 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)
*
* Author acknowledges the support of the Faculty of Civil Engineering,
* University of Zagreb, Croatia.
*
*/
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_CBLAS_H
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_CBLAS_H
//
// MKL-specific CBLAS include
//
#if defined BOOST_NUMERIC_BINDINGS_BLAS_MKL
extern "C" {
#include <mkl_cblas.h>
#include <mkl_service.h>
//
// mkl_types.h defines P4 macro which breaks MPL, undefine it here.
//
#undef P4
}
//
// Default CBLAS include
//
#else
extern "C" {
#include <cblas.h>
}
#endif
#endif

View File

@@ -0,0 +1,85 @@
//
// Copyright (c) 2009 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)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_CBLAS_OPTION_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_CBLAS_OPTION_HPP
#include <boost/numeric/bindings/blas/detail/cblas.h>
#include <boost/numeric/bindings/tag.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
namespace detail {
template< typename Tag >
struct cblas_option {};
template<>
struct cblas_option< tag::row_major > {
static const CBLAS_ORDER value = CblasRowMajor;
};
template<>
struct cblas_option< tag::column_major > {
static const CBLAS_ORDER value = CblasColMajor;
};
template<>
struct cblas_option< tag::transpose > {
static const CBLAS_TRANSPOSE value = CblasTrans;
};
template<>
struct cblas_option< tag::no_transpose > {
static const CBLAS_TRANSPOSE value = CblasNoTrans;
};
template<>
struct cblas_option< tag::conjugate > {
static const CBLAS_TRANSPOSE value = CblasConjTrans;
};
template<>
struct cblas_option< tag::upper > {
static const CBLAS_UPLO value = CblasUpper;
};
template<>
struct cblas_option< tag::lower > {
static const CBLAS_UPLO value = CblasLower;
};
template<>
struct cblas_option< tag::unit > {
static const CBLAS_DIAG value = CblasUnit;
};
template<>
struct cblas_option< tag::non_unit > {
static const CBLAS_DIAG value = CblasNonUnit;
};
template<>
struct cblas_option< tag::left > {
static const CBLAS_SIDE value = CblasLeft;
};
template<>
struct cblas_option< tag::right > {
static const CBLAS_SIDE value = CblasRight;
};
} // namespace detail
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,16 @@
//
// Copyright (c) 2009 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)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_CUBLAS_H
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_CUBLAS_H
extern "C" {
#include <cublas.h>
}
#endif

View File

@@ -0,0 +1,38 @@
//
// Copyright (c) 2009 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)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_DEFAULT_ORDER_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_DETAIL_DEFAULT_ORDER_HPP
#include <boost/mpl/if.hpp>
#include <boost/numeric/bindings/is_row_major.hpp>
#include <boost/numeric/bindings/tag.hpp>
#include <boost/numeric/bindings/detail/property_map.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
namespace detail {
template< typename T >
struct default_order {
typedef typename mpl::if_<
bindings::detail::is_same_at< T, tag::value_transform, tag::conjugate >,
typename mpl::if_< is_row_major< T >, tag::column_major, tag::row_major >::type,
tag::column_major
>::type type;
};
} // namespace detail
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,29 @@
//
// Copyright (c) 2009 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)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_HPP
#include <boost/numeric/bindings/blas/level1/asum.hpp>
#include <boost/numeric/bindings/blas/level1/axpy.hpp>
#include <boost/numeric/bindings/blas/level1/copy.hpp>
#include <boost/numeric/bindings/blas/level1/dotc.hpp>
#include <boost/numeric/bindings/blas/level1/dot.hpp>
#include <boost/numeric/bindings/blas/level1/dotu.hpp>
#include <boost/numeric/bindings/blas/level1/iamax.hpp>
#include <boost/numeric/bindings/blas/level1/nrm2.hpp>
#include <boost/numeric/bindings/blas/level1/prec_dot.hpp>
#include <boost/numeric/bindings/blas/level1/rotg.hpp>
#include <boost/numeric/bindings/blas/level1/rot.hpp>
#include <boost/numeric/bindings/blas/level1/rotmg.hpp>
#include <boost/numeric/bindings/blas/level1/rotm.hpp>
#include <boost/numeric/bindings/blas/level1/scal.hpp>
#include <boost/numeric/bindings/blas/level1/set.hpp>
#include <boost/numeric/bindings/blas/level1/swap.hpp>
#endif

View File

@@ -0,0 +1,230 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ASUM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ASUM_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.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.
//
inline float asum( const int n, const float* x, const int incx ) {
return cblas_sasum( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline double asum( const int n, const double* x, const int incx ) {
return cblas_dasum( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline float asum( const int n, const std::complex<float>* x,
const int incx ) {
return cblas_scasum( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline double asum( const int n, const std::complex<double>* x,
const int incx ) {
return cblas_dzasum( n, x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline float asum( const int n, const float* x, const int incx ) {
return cublasSasum( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline double asum( const int n, const double* x, const int incx ) {
return cublasDasum( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline float asum( const int n, const std::complex<float>* x,
const int incx ) {
return cublasScasum( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline double asum( const int n, const std::complex<double>* x,
const int incx ) {
return cublasDzasum( n, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline float asum( const fortran_int_t n, const float* x,
const fortran_int_t incx ) {
return BLAS_SASUM( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline double asum( const fortran_int_t n, const double* x,
const fortran_int_t incx ) {
return BLAS_DASUM( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline float asum( const fortran_int_t n, const std::complex<float>* x,
const fortran_int_t incx ) {
return BLAS_SCASUM( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline double asum( const fortran_int_t n, const std::complex<double>* x,
const fortran_int_t incx ) {
return BLAS_DZASUM( &n, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to asum.
//
template< typename Value >
struct asum_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef real_type result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX >
static result_type invoke( const VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
return detail::asum( bindings::size(x),
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 asum_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for asum. Its overload differs for
//
template< typename VectorX >
inline typename asum_impl< typename bindings::value_type<
VectorX >::type >::result_type
asum( const VectorX& x ) {
return asum_impl< typename bindings::value_type<
VectorX >::type >::invoke( x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,249 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_AXPY_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_AXPY_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.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.
//
inline void axpy( const int n, const float a, const float* x, const int incx,
float* y, const int incy ) {
cblas_saxpy( n, a, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void axpy( const int n, const double a, const double* x,
const int incx, double* y, const int incy ) {
cblas_daxpy( n, a, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline void axpy( const int n, const std::complex<float> a,
const std::complex<float>* x, const int incx, std::complex<float>* y,
const int incy ) {
cblas_caxpy( n, &a, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline void axpy( const int n, const std::complex<double> a,
const std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy ) {
cblas_zaxpy( n, &a, x, incx, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void axpy( const int n, const float a, const float* x, const int incx,
float* y, const int incy ) {
cublasSaxpy( n, a, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void axpy( const int n, const double a, const double* x,
const int incx, double* y, const int incy ) {
cublasDaxpy( n, a, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline void axpy( const int n, const std::complex<float> a,
const std::complex<float>* x, const int incx, std::complex<float>* y,
const int incy ) {
cublasCaxpy( n, a, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline void axpy( const int n, const std::complex<double> a,
const std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy ) {
cublasZaxpy( n, a, x, incx, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void axpy( const fortran_int_t n, const float a, const float* x,
const fortran_int_t incx, float* y, const fortran_int_t incy ) {
BLAS_SAXPY( &n, &a, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void axpy( const fortran_int_t n, const double a, const double* x,
const fortran_int_t incx, double* y, const fortran_int_t incy ) {
BLAS_DAXPY( &n, &a, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline void axpy( const fortran_int_t n, const std::complex<float> a,
const std::complex<float>* x, const fortran_int_t incx,
std::complex<float>* y, const fortran_int_t incy ) {
BLAS_CAXPY( &n, &a, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline void axpy( const fortran_int_t n, const std::complex<double> a,
const std::complex<double>* x, const fortran_int_t incx,
std::complex<double>* y, const fortran_int_t incy ) {
BLAS_ZAXPY( &n, &a, x, &incx, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to axpy.
//
template< typename Value >
struct axpy_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 >
static result_type invoke( const value_type a, const VectorX& x,
VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
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( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
detail::axpy( bindings::size(x), a, bindings::begin_value(x),
bindings::stride(x), 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 axpy_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for axpy. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename axpy_impl< typename bindings::value_type<
VectorX >::type >::result_type
axpy( const typename bindings::value_type< VectorX >::type a,
const VectorX& x, VectorY& y ) {
axpy_impl< typename bindings::value_type<
VectorX >::type >::invoke( a, x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,243 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_COPY_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_COPY_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.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.
//
inline void copy( const int n, const float* x, const int incx, float* y,
const int incy ) {
cblas_scopy( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void copy( const int n, const double* x, const int incx, double* y,
const int incy ) {
cblas_dcopy( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline void copy( const int n, const std::complex<float>* x, const int incx,
std::complex<float>* y, const int incy ) {
cblas_ccopy( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline void copy( const int n, const std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy ) {
cblas_zcopy( n, x, incx, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void copy( const int n, const float* x, const int incx, float* y,
const int incy ) {
cublasScopy( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void copy( const int n, const double* x, const int incx, double* y,
const int incy ) {
cublasDcopy( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline void copy( const int n, const std::complex<float>* x, const int incx,
std::complex<float>* y, const int incy ) {
cublasCcopy( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline void copy( const int n, const std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy ) {
cublasZcopy( n, x, incx, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void copy( const fortran_int_t n, const float* x,
const fortran_int_t incx, float* y, const fortran_int_t incy ) {
BLAS_SCOPY( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void copy( const fortran_int_t n, const double* x,
const fortran_int_t incx, double* y, const fortran_int_t incy ) {
BLAS_DCOPY( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline void copy( const fortran_int_t n, const std::complex<float>* x,
const fortran_int_t incx, std::complex<float>* y,
const fortran_int_t incy ) {
BLAS_CCOPY( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline void copy( const fortran_int_t n, const std::complex<double>* x,
const fortran_int_t incx, std::complex<double>* y,
const fortran_int_t incy ) {
BLAS_ZCOPY( &n, x, &incx, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to copy.
//
template< typename Value >
struct copy_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 >
static result_type invoke( const VectorX& x, VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
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( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
detail::copy( bindings::size(x), bindings::begin_value(x),
bindings::stride(x), 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 copy_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for copy. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename copy_impl< typename bindings::value_type<
VectorX >::type >::result_type
copy( const VectorX& x, VectorY& y ) {
copy_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,246 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOT_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOT_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.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.
//
inline float dot( const int n, const float* x, const int incx, const float* y,
const int incy ) {
return cblas_sdot( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline double dot( const int n, const double* x, const int incx,
const double* y, const int incy ) {
return cblas_ddot( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline std::complex<float> dot( const int n, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy ) {
std::complex<float> result;
cblas_cdotu_sub( n, x, incx, y, incy, &result );
return result;
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline std::complex<double> dot( const int n, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy ) {
std::complex<double> result;
cblas_zdotu_sub( n, x, incx, y, incy, &result );
return result;
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline float dot( const int n, const float* x, const int incx, const float* y,
const int incy ) {
return cublasSdot( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline double dot( const int n, const double* x, const int incx,
const double* y, const int incy ) {
return cublasDdot( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline std::complex<float> dot( const int n, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy ) {
return cublasCdotu( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline std::complex<double> dot( const int n, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy ) {
return cublasZdotu( n, x, incx, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline float dot( const fortran_int_t n, const float* x,
const fortran_int_t incx, const float* y, const fortran_int_t incy ) {
return BLAS_SDOT( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline double dot( const fortran_int_t n, const double* x,
const fortran_int_t incx, const double* y, const fortran_int_t incy ) {
return BLAS_DDOT( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline std::complex<float> dot( const fortran_int_t n,
const std::complex<float>* x, const fortran_int_t incx,
const std::complex<float>* y, const fortran_int_t incy ) {
return BLAS_CDOTU( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline std::complex<double> dot( const fortran_int_t n,
const std::complex<double>* x, const fortran_int_t incx,
const std::complex<double>* y, const fortran_int_t incy ) {
return BLAS_ZDOTU( &n, x, &incx, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to dot.
//
template< typename Value >
struct dot_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef value_type 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 >
static result_type invoke( const VectorX& x, const VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
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( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
return detail::dot( bindings::size(x),
bindings::begin_value(x), bindings::stride(x),
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 dot_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for dot. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename dot_impl< typename bindings::value_type<
VectorX >::type >::result_type
dot( const VectorX& x, const VectorY& y ) {
return dot_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,186 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOTC_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOTC_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.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.
//
inline std::complex<float> dotc( const int n, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy ) {
std::complex<float> result;
cblas_cdotc_sub( n, x, incx, y, incy, &result );
return result;
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline std::complex<double> dotc( const int n, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy ) {
std::complex<double> result;
cblas_zdotc_sub( n, x, incx, y, incy, &result );
return result;
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline std::complex<float> dotc( const int n, const std::complex<float>* x,
const int incx, const std::complex<float>* y, const int incy ) {
return cublasCdotc( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline std::complex<double> dotc( const int n, const std::complex<double>* x,
const int incx, const std::complex<double>* y, const int incy ) {
return cublasZdotc( n, x, incx, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline std::complex<float> dotc( const fortran_int_t n,
const std::complex<float>* x, const fortran_int_t incx,
const std::complex<float>* y, const fortran_int_t incy ) {
return BLAS_CDOTC( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline std::complex<double> dotc( const fortran_int_t n,
const std::complex<double>* x, const fortran_int_t incx,
const std::complex<double>* y, const fortran_int_t incy ) {
return BLAS_ZDOTC( &n, x, &incx, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to dotc.
//
template< typename Value >
struct dotc_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef value_type 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 >
static result_type invoke( const VectorX& x, const VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
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( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
return detail::dotc( bindings::size(x),
bindings::begin_value(x), bindings::stride(x),
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 dotc_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for dotc. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename dotc_impl< typename bindings::value_type<
VectorX >::type >::result_type
dotc( const VectorX& x, const VectorY& y ) {
return dotc_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,42 @@
//
// 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)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOTU_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_DOTU_HPP
#include <boost/numeric/bindings/blas/level1/dot.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// dotu is a synonym for dot
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access.
//
//
// Overloaded function for dotu.
//
template< typename VectorX, typename VectorY >
inline typename dot_impl< typename bindings::value_type< VectorX >::type >::result_type
dotu( const VectorX& x, const VectorY& y ) {
return dot_impl< typename bindings::value_type< VectorX >::type >::invoke( x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,232 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_IAMAX_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_IAMAX_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/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.
//
inline std::ptrdiff_t iamax( const int n, const float* x, const int incx ) {
return cblas_isamax( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline std::ptrdiff_t iamax( const int n, const double* x,
const int incx ) {
return cblas_idamax( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline std::ptrdiff_t iamax( const int n, const std::complex<float>* x,
const int incx ) {
return cblas_icamax( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline std::ptrdiff_t iamax( const int n, const std::complex<double>* x,
const int incx ) {
return cblas_izamax( n, x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline std::ptrdiff_t iamax( const int n, const float* x, const int incx ) {
return cublasIsamax( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline std::ptrdiff_t iamax( const int n, const double* x,
const int incx ) {
return cublasIdamax( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline std::ptrdiff_t iamax( const int n, const std::complex<float>* x,
const int incx ) {
return cublasIcamax( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline std::ptrdiff_t iamax( const int n, const std::complex<double>* x,
const int incx ) {
return cublasIzamax( n, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline std::ptrdiff_t iamax( const fortran_int_t n, const float* x,
const fortran_int_t incx ) {
return BLAS_ISAMAX( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline std::ptrdiff_t iamax( const fortran_int_t n, const double* x,
const fortran_int_t incx ) {
return BLAS_IDAMAX( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline std::ptrdiff_t iamax( const fortran_int_t n,
const std::complex<float>* x, const fortran_int_t incx ) {
return BLAS_ICAMAX( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline std::ptrdiff_t iamax( const fortran_int_t n,
const std::complex<double>* x, const fortran_int_t incx ) {
return BLAS_IZAMAX( &n, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to iamax.
//
template< typename Value >
struct iamax_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef std::ptrdiff_t result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX >
static result_type invoke( const VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
return detail::iamax( bindings::size(x),
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 iamax_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for iamax. Its overload differs for
//
template< typename VectorX >
inline typename iamax_impl< typename bindings::value_type<
VectorX >::type >::result_type
iamax( const VectorX& x ) {
return iamax_impl< typename bindings::value_type<
VectorX >::type >::invoke( x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,230 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_NRM2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_NRM2_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.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.
//
inline float nrm2( const int n, const float* x, const int incx ) {
return cblas_snrm2( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline double nrm2( const int n, const double* x, const int incx ) {
return cblas_dnrm2( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline float nrm2( const int n, const std::complex<float>* x,
const int incx ) {
return cblas_scnrm2( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline double nrm2( const int n, const std::complex<double>* x,
const int incx ) {
return cblas_dznrm2( n, x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline float nrm2( const int n, const float* x, const int incx ) {
return cublasSnrm2( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline double nrm2( const int n, const double* x, const int incx ) {
return cublasDnrm2( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline float nrm2( const int n, const std::complex<float>* x,
const int incx ) {
return cublasScnrm2( n, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline double nrm2( const int n, const std::complex<double>* x,
const int incx ) {
return cublasDznrm2( n, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline float nrm2( const fortran_int_t n, const float* x,
const fortran_int_t incx ) {
return BLAS_SNRM2( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline double nrm2( const fortran_int_t n, const double* x,
const fortran_int_t incx ) {
return BLAS_DNRM2( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline float nrm2( const fortran_int_t n, const std::complex<float>* x,
const fortran_int_t incx ) {
return BLAS_SCNRM2( &n, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline double nrm2( const fortran_int_t n, const std::complex<double>* x,
const fortran_int_t incx ) {
return BLAS_DZNRM2( &n, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to nrm2.
//
template< typename Value >
struct nrm2_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef real_type result_type;
//
// Static member function that
// * Deduces the required arguments for dispatching to BLAS, and
// * Asserts that most arguments make sense.
//
template< typename VectorX >
static result_type invoke( const VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
return detail::nrm2( bindings::size(x),
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 nrm2_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for nrm2. Its overload differs for
//
template< typename VectorX >
inline typename nrm2_impl< typename bindings::value_type<
VectorX >::type >::result_type
nrm2( const VectorX& x ) {
return nrm2_impl< typename bindings::value_type<
VectorX >::type >::invoke( x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,150 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_PREC_DOT_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_PREC_DOT_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.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
// * double value-type.
//
inline double prec_dot( const int n, const float* x, const int incx,
const float* y, const int incy ) {
return cblas_dsdot( n, x, incx, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline double prec_dot( const int n, const float* x, const int incx,
const float* y, const int incy ) {
return // NOT FOUND();
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline double prec_dot( const fortran_int_t n, const float* x,
const fortran_int_t incx, const float* y, const fortran_int_t incy ) {
return BLAS_DSDOT( &n, x, &incx, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to prec_dot.
//
template< typename Value >
struct prec_dot_impl {
typedef Value value_type;
typedef typename remove_imaginary< Value >::type real_type;
typedef double 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 >
static result_type invoke( const VectorX& x, const VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
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( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
return detail::prec_dot( bindings::size(x),
bindings::begin_value(x), bindings::stride(x),
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 prec_dot_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for prec_dot. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename prec_dot_impl< typename bindings::value_type<
VectorX >::type >::result_type
prec_dot( const VectorX& x, const VectorY& y ) {
return prec_dot_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,250 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROT_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROT_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.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.
//
inline void rot( const int n, float* x, const int incx, float* y,
const int incy, const float c, const float s ) {
cblas_srot( n, x, incx, y, incy, c, s );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void rot( const int n, double* x, const int incx, double* y,
const int incy, const double c, const double s ) {
cblas_drot( n, x, incx, y, incy, c, s );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline void rot( const int n, std::complex<float>* x, const int incx,
std::complex<float>* y, const int incy, const float c,
const float s ) {
// NOT FOUND();
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline void rot( const int n, std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy, const double c,
const double s ) {
// NOT FOUND();
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void rot( const int n, float* x, const int incx, float* y,
const int incy, const float c, const float s ) {
cublasSrot( n, x, incx, y, incy, c, s );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void rot( const int n, double* x, const int incx, double* y,
const int incy, const double c, const double s ) {
cublasDrot( n, x, incx, y, incy, c, s );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline void rot( const int n, std::complex<float>* x, const int incx,
std::complex<float>* y, const int incy, const float c,
const float s ) {
cublasCsrot( n, x, incx, y, incy, c, s );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline void rot( const int n, std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy, const double c,
const double s ) {
cublasZdrot( n, x, incx, y, incy, c, s );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void rot( const fortran_int_t n, float* x, const fortran_int_t incx,
float* y, const fortran_int_t incy, const float c, const float s ) {
BLAS_SROT( &n, x, &incx, y, &incy, &c, &s );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void rot( const fortran_int_t n, double* x, const fortran_int_t incx,
double* y, const fortran_int_t incy, const double c, const double s ) {
BLAS_DROT( &n, x, &incx, y, &incy, &c, &s );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline void rot( const fortran_int_t n, std::complex<float>* x,
const fortran_int_t incx, std::complex<float>* y,
const fortran_int_t incy, const float c, const float s ) {
BLAS_CSROT( &n, x, &incx, y, &incy, &c, &s );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline void rot( const fortran_int_t n, std::complex<double>* x,
const fortran_int_t incx, std::complex<double>* y,
const fortran_int_t incy, const double c, const double s ) {
BLAS_ZDROT( &n, x, &incx, y, &incy, &c, &s );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to rot.
//
template< typename Value >
struct rot_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 >
static result_type invoke( VectorX& x, VectorY& y, const real_type c,
const real_type s ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< VectorX >::type >::type,
typename remove_const< typename bindings::value_type<
VectorY >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
detail::rot( bindings::size(x), bindings::begin_value(x),
bindings::stride(x), bindings::begin_value(y),
bindings::stride(y), c, s );
}
};
//
// 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 rot_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for rot. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename rot_impl< typename bindings::value_type<
VectorX >::type >::result_type
rot( VectorX& x, VectorY& y, const typename remove_imaginary<
typename bindings::value_type< VectorX >::type >::type c,
const typename remove_imaginary< typename bindings::value_type<
VectorX >::type >::type s ) {
rot_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y, c, s );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,223 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTG_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTG_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_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.
//
inline void rotg( float& a, float& b, float& c, float& s ) {
cblas_srotg( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void rotg( double& a, double& b, double& c, double& s ) {
cblas_drotg( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline void rotg( std::complex<float>& a, std::complex<float>& b, float& c,
std::complex<float>& s ) {
// NOT FOUND();
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline void rotg( std::complex<double>& a, std::complex<double>& b, double& c,
std::complex<double>& s ) {
// NOT FOUND();
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void rotg( float& a, float& b, float& c, float& s ) {
cublasSrotg( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void rotg( double& a, double& b, double& c, double& s ) {
cublasDrotg( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline void rotg( std::complex<float>& a, std::complex<float>& b, float& c,
std::complex<float>& s ) {
cublasCrotg( &a, b, &c, &s );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline void rotg( std::complex<double>& a, std::complex<double>& b, double& c,
std::complex<double>& s ) {
cublasZrotg( &a, b, &c, &s );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void rotg( float& a, float& b, float& c, float& s ) {
BLAS_SROTG( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void rotg( double& a, double& b, double& c, double& s ) {
BLAS_DROTG( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline void rotg( std::complex<float>& a, std::complex<float>& b, float& c,
std::complex<float>& s ) {
BLAS_CROTG( &a, &b, &c, &s );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline void rotg( std::complex<double>& a, std::complex<double>& b, double& c,
std::complex<double>& s ) {
BLAS_ZROTG( &a, &b, &c, &s );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to rotg.
//
template< typename Value >
struct rotg_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.
//
static result_type invoke( value_type& a, value_type& b, real_type& c,
value_type& s ) {
namespace bindings = ::boost::numeric::bindings;
detail::rotg( a, b, c, s );
}
};
//
// 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 rotg_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for rotg. Its overload differs for
//
template< typename Value >
inline typename rotg_impl< Value >::result_type
rotg( Value& a, Value& b, Value& c, Value& s ) {
rotg_impl< Value >::invoke( a, b, c, s );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,187 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTM_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.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.
//
inline void rotm( const int n, float* x, const int incx, float* y,
const int incy, float* param ) {
cblas_srotm( n, x, incx, y, incy, param );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void rotm( const int n, double* x, const int incx, double* y,
const int incy, double* param ) {
cblas_drotm( n, x, incx, y, incy, param );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void rotm( const int n, float* x, const int incx, float* y,
const int incy, float* param ) {
cublasSrotm( n, x, incx, y, incy, param );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void rotm( const int n, double* x, const int incx, double* y,
const int incy, double* param ) {
cublasDrotm( n, x, incx, y, incy, param );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void rotm( const fortran_int_t n, float* x, const fortran_int_t incx,
float* y, const fortran_int_t incy, float* param ) {
BLAS_SROTM( &n, x, &incx, y, &incy, param );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void rotm( const fortran_int_t n, double* x, const fortran_int_t incx,
double* y, const fortran_int_t incy, double* param ) {
BLAS_DROTM( &n, x, &incx, y, &incy, param );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to rotm.
//
template< typename Value >
struct rotm_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 VectorPARAM >
static result_type invoke( VectorX& x, VectorY& y, VectorPARAM& param ) {
namespace bindings = ::boost::numeric::bindings;
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<
VectorPARAM >::type >::type >::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< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorPARAM >::value) );
detail::rotm( bindings::size(x), bindings::begin_value(x),
bindings::stride(x), bindings::begin_value(y),
bindings::stride(y), bindings::begin_value(param) );
}
};
//
// 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 rotm_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for rotm. Its overload differs for
//
template< typename VectorX, typename VectorY, typename VectorPARAM >
inline typename rotm_impl< typename bindings::value_type<
VectorX >::type >::result_type
rotm( VectorX& x, VectorY& y, VectorPARAM& param ) {
rotm_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y, param );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,179 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTMG_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_ROTMG_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/remove_imaginary.hpp>
#include <boost/numeric/bindings/size.hpp>
#include <boost/numeric/bindings/stride.hpp>
#include <boost/numeric/bindings/value_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.
//
inline void rotmg( float& d1, float& d2, float& x1, const float y1,
float* sparam ) {
cblas_srotmg( &d1, &d2, &x1, y1, sparam );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void rotmg( double& d1, double& d2, double& x1, const double y1,
double* dparam ) {
cblas_drotmg( &d1, &d2, &x1, y1, dparam );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void rotmg( float& d1, float& d2, float& x1, const float y1,
float* sparam ) {
cublasSrotmg( &d1, &d2, &x1, &y1, sparam );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void rotmg( double& d1, double& d2, double& x1, const double y1,
double* dparam ) {
cublasDrotmg( &d1, &d2, &x1, &y1, dparam );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void rotmg( float& d1, float& d2, float& x1, const float y1,
float* sparam ) {
BLAS_SROTMG( &d1, &d2, &x1, &y1, sparam );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void rotmg( double& d1, double& d2, double& x1, const double y1,
double* dparam ) {
BLAS_DROTMG( &d1, &d2, &x1, &y1, dparam );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to rotmg.
//
template< typename Value >
struct rotmg_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 VectorDPARAM >
static result_type invoke( real_type& d1, real_type& d2, real_type& x1,
const real_type y1, VectorDPARAM& dparam ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorDPARAM >::value) );
detail::rotmg( d1, d2, x1, y1, bindings::begin_value(dparam) );
}
};
//
// 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 rotmg_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for rotmg. Its overload differs for
//
template< typename VectorDPARAM >
inline typename rotmg_impl< typename bindings::value_type<
VectorDPARAM >::type >::result_type
rotmg( typename remove_imaginary< typename bindings::value_type<
VectorDPARAM >::type >::type& d1, typename remove_imaginary<
typename bindings::value_type< VectorDPARAM >::type >::type& d2,
typename remove_imaginary< typename bindings::value_type<
VectorDPARAM >::type >::type& x1, const typename remove_imaginary<
typename bindings::value_type< VectorDPARAM >::type >::type y1,
VectorDPARAM& dparam ) {
rotmg_impl< typename bindings::value_type<
VectorDPARAM >::type >::invoke( d1, d2, x1, y1, dparam );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,291 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SCAL_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SCAL_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.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.
//
inline void scal( const int n, const float a, float* x, const int incx ) {
cblas_sscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void scal( const int n, const double a, double* x, const int incx ) {
cblas_dscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * combined float and complex<float> value-type.
//
inline void scal( const int n, const float a, std::complex<float>* x,
const int incx ) {
cblas_csscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * combined double and complex<double> value-type.
//
inline void scal( const int n, const double a, std::complex<double>* x,
const int incx ) {
cblas_zdscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline void scal( const int n, const std::complex<float> a,
std::complex<float>* x, const int incx ) {
cblas_cscal( n, &a, x, incx );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline void scal( const int n, const std::complex<double> a,
std::complex<double>* x, const int incx ) {
cblas_zscal( n, &a, x, incx );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void scal( const int n, const float a, float* x, const int incx ) {
cublasSscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void scal( const int n, const double a, double* x, const int incx ) {
cublasDscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * combined float and complex<float> value-type.
//
inline void scal( const int n, const float a, std::complex<float>* x,
const int incx ) {
cublasCsscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * combined double and complex<double> value-type.
//
inline void scal( const int n, const double a, std::complex<double>* x,
const int incx ) {
cublasZdscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline void scal( const int n, const std::complex<float> a,
std::complex<float>* x, const int incx ) {
cublasCscal( n, a, x, incx );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline void scal( const int n, const std::complex<double> a,
std::complex<double>* x, const int incx ) {
cublasZscal( n, a, x, incx );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void scal( const fortran_int_t n, const float a, float* x,
const fortran_int_t incx ) {
BLAS_SSCAL( &n, &a, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void scal( const fortran_int_t n, const double a, double* x,
const fortran_int_t incx ) {
BLAS_DSCAL( &n, &a, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * combined float and complex<float> value-type.
//
inline void scal( const fortran_int_t n, const float a,
std::complex<float>* x, const fortran_int_t incx ) {
BLAS_CSSCAL( &n, &a, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * combined double and complex<double> value-type.
//
inline void scal( const fortran_int_t n, const double a,
std::complex<double>* x, const fortran_int_t incx ) {
BLAS_ZDSCAL( &n, &a, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline void scal( const fortran_int_t n, const std::complex<float> a,
std::complex<float>* x, const fortran_int_t incx ) {
BLAS_CSCAL( &n, &a, x, &incx );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline void scal( const fortran_int_t n, const std::complex<double> a,
std::complex<double>* x, const fortran_int_t incx ) {
BLAS_ZSCAL( &n, &a, x, &incx );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to scal.
//
template< typename Value >
struct scal_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 ScalarA, typename VectorX >
static result_type invoke( const ScalarA a, VectorX& x ) {
namespace bindings = ::boost::numeric::bindings;
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
detail::scal( bindings::size(x), 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 scal_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for scal. Its overload differs for
//
template< typename ScalarA, typename VectorX >
inline typename scal_impl< typename bindings::value_type<
VectorX >::type >::result_type
scal( const ScalarA a, VectorX& x ) {
scal_impl< typename bindings::value_type<
VectorX >::type >::invoke( a, x );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,62 @@
//
// 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)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SET_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SET_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/end.hpp>
#include <boost/numeric/bindings/is_mutable.hpp>
#include <boost/numeric/bindings/value_type.hpp>
#include <boost/static_assert.hpp>
namespace boost {
namespace numeric {
namespace bindings {
namespace blas {
//
// set is an extension, not part of the BLAS API.
//
// TODO implement ATLAS backend call(s)
//
// Functions for direct use. These functions are overloaded for temporaries,
// so that wrapped types can still be passed and used for write-access.
//
//
// Overloaded function for set. Its overload differs for
// * VectorX&
//
template< typename VectorX >
inline void
set( const typename bindings::value_type< VectorX >::type a, VectorX& x ) {
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
std::fill( bindings::begin(x), bindings::end(x), a );
}
//
// Overloaded function for set. Its overload differs for
// * const VectorX&
//
template< typename VectorX >
inline void
set( const typename bindings::value_type< const VectorX >::type a, const VectorX& x ) {
BOOST_STATIC_ASSERT( (bindings::is_mutable< const VectorX >::value) );
std::fill( bindings::begin(x), bindings::end(x), a );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,244 @@
//
// Copyright (c) 2002--2010
// Toon Knapen, Karl Meerbergen, Kresimir Fresl,
// Thomas Klimpel and Rutger ter Borg
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// THIS FILE IS AUTOMATICALLY GENERATED
// PLEASE DO NOT EDIT!
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SWAP_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL1_SWAP_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.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.
//
inline void swap( const int n, float* x, const int incx, float* y,
const int incy ) {
cblas_sswap( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
inline void swap( const int n, double* x, const int incx, double* y,
const int incy ) {
cblas_dswap( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
inline void swap( const int n, std::complex<float>* x, const int incx,
std::complex<float>* y, const int incy ) {
cblas_cswap( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
inline void swap( const int n, std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy ) {
cblas_zswap( n, x, incx, y, incy );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
inline void swap( const int n, float* x, const int incx, float* y,
const int incy ) {
cublasSswap( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
inline void swap( const int n, double* x, const int incx, double* y,
const int incy ) {
cublasDswap( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
inline void swap( const int n, std::complex<float>* x, const int incx,
std::complex<float>* y, const int incy ) {
cublasCswap( n, x, incx, y, incy );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
inline void swap( const int n, std::complex<double>* x, const int incx,
std::complex<double>* y, const int incy ) {
cublasZswap( n, x, incx, y, incy );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
inline void swap( const fortran_int_t n, float* x, const fortran_int_t incx,
float* y, const fortran_int_t incy ) {
BLAS_SSWAP( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
inline void swap( const fortran_int_t n, double* x, const fortran_int_t incx,
double* y, const fortran_int_t incy ) {
BLAS_DSWAP( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
inline void swap( const fortran_int_t n, std::complex<float>* x,
const fortran_int_t incx, std::complex<float>* y,
const fortran_int_t incy ) {
BLAS_CSWAP( &n, x, &incx, y, &incy );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
inline void swap( const fortran_int_t n, std::complex<double>* x,
const fortran_int_t incx, std::complex<double>* y,
const fortran_int_t incy ) {
BLAS_ZSWAP( &n, x, &incx, y, &incy );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to swap.
//
template< typename Value >
struct swap_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 >
static result_type invoke( VectorX& x, VectorY& y ) {
namespace bindings = ::boost::numeric::bindings;
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( (bindings::has_linear_array< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< VectorY >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorX >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< VectorY >::value) );
detail::swap( bindings::size(x), bindings::begin_value(x),
bindings::stride(x), 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 swap_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for swap. Its overload differs for
//
template< typename VectorX, typename VectorY >
inline typename swap_impl< typename bindings::value_type<
VectorX >::type >::result_type
swap( VectorX& x, VectorY& y ) {
swap_impl< typename bindings::value_type<
VectorX >::type >::invoke( x, y );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,38 @@
//
// Copyright (c) 2009 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)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL2_HPP
#include <boost/numeric/bindings/blas/level2/gbmv.hpp>
#include <boost/numeric/bindings/blas/level2/gemv.hpp>
#include <boost/numeric/bindings/blas/level2/gerc.hpp>
#include <boost/numeric/bindings/blas/level2/ger.hpp>
#include <boost/numeric/bindings/blas/level2/geru.hpp>
#include <boost/numeric/bindings/blas/level2/hbmv.hpp>
#include <boost/numeric/bindings/blas/level2/hemv.hpp>
#include <boost/numeric/bindings/blas/level2/her2.hpp>
#include <boost/numeric/bindings/blas/level2/her.hpp>
#include <boost/numeric/bindings/blas/level2/hpmv.hpp>
#include <boost/numeric/bindings/blas/level2/hpr2.hpp>
#include <boost/numeric/bindings/blas/level2/hpr.hpp>
#include <boost/numeric/bindings/blas/level2/sbmv.hpp>
#include <boost/numeric/bindings/blas/level2/spmv.hpp>
#include <boost/numeric/bindings/blas/level2/spr2.hpp>
#include <boost/numeric/bindings/blas/level2/spr.hpp>
#include <boost/numeric/bindings/blas/level2/symv.hpp>
#include <boost/numeric/bindings/blas/level2/syr2.hpp>
#include <boost/numeric/bindings/blas/level2/syr.hpp>
#include <boost/numeric/bindings/blas/level2/tbmv.hpp>
#include <boost/numeric/bindings/blas/level2/tbsv.hpp>
#include <boost/numeric/bindings/blas/level2/tpmv.hpp>
#include <boost/numeric/bindings/blas/level2/tpsv.hpp>
#include <boost/numeric/bindings/blas/level2/trmv.hpp>
#include <boost/numeric/bindings/blas/level2/trsv.hpp>
#endif

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1,22 @@
//
// Copyright (c) 2009 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)
//
#ifndef BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HPP
#include <boost/numeric/bindings/blas/level3/gemm.hpp>
#include <boost/numeric/bindings/blas/level3/hemm.hpp>
#include <boost/numeric/bindings/blas/level3/her2k.hpp>
#include <boost/numeric/bindings/blas/level3/herk.hpp>
#include <boost/numeric/bindings/blas/level3/symm.hpp>
#include <boost/numeric/bindings/blas/level3/syr2k.hpp>
#include <boost/numeric/bindings/blas/level3/syrk.hpp>
#include <boost/numeric/bindings/blas/level3/trmm.hpp>
#include <boost/numeric/bindings/blas/level3/trsm.hpp>
#endif

View File

@@ -0,0 +1,338 @@
//
// 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_LEVEL3_GEMM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_GEMM_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/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 TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const float alpha, const float* a,
const int lda, const float* b, const int ldb, const float beta,
float* c, const int ldc ) {
cblas_sgemm( cblas_option< Order >::value, cblas_option< TransA >::value,
cblas_option< TransB >::value, m, n, k, alpha, a, lda, b, ldb,
beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const double alpha, const double* a,
const int lda, const double* b, const int ldb, const double beta,
double* c, const int ldc ) {
cblas_dgemm( cblas_option< Order >::value, cblas_option< TransA >::value,
cblas_option< TransB >::value, m, n, k, alpha, a, lda, b, ldb,
beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
cblas_cgemm( cblas_option< Order >::value, cblas_option< TransA >::value,
cblas_option< TransB >::value, m, n, k, &alpha, a, lda, b, ldb,
&beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
cblas_zgemm( cblas_option< Order >::value, cblas_option< TransA >::value,
cblas_option< TransB >::value, m, n, k, &alpha, a, lda, b, ldb,
&beta, c, ldc );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const float alpha, const float* a,
const int lda, const float* b, const int ldb, const float beta,
float* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSgemm( blas_option< TransA >::value, blas_option< TransB >::value,
m, n, k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const double alpha, const double* a,
const int lda, const double* b, const int ldb, const double beta,
double* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDgemm( blas_option< TransA >::value, blas_option< TransB >::value,
m, n, k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCgemm( blas_option< TransA >::value, blas_option< TransB >::value,
m, n, k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB, const int m,
const int n, const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZgemm( blas_option< TransA >::value, blas_option< TransB >::value,
m, n, k, alpha, a, lda, b, ldb, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB,
const fortran_int_t m, const fortran_int_t n, const fortran_int_t k,
const float alpha, const float* a, const fortran_int_t lda,
const float* b, const fortran_int_t ldb, const float beta, float* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SGEMM( &blas_option< TransA >::value, &blas_option< TransB >::value,
&m, &n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB,
const fortran_int_t m, const fortran_int_t n, const fortran_int_t k,
const double alpha, const double* a, const fortran_int_t lda,
const double* b, const fortran_int_t ldb, const double beta,
double* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DGEMM( &blas_option< TransA >::value, &blas_option< TransB >::value,
&m, &n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB,
const fortran_int_t m, 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>* b,
const fortran_int_t ldb, const std::complex<float> beta,
std::complex<float>* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CGEMM( &blas_option< TransA >::value, &blas_option< TransB >::value,
&m, &n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename TransA, typename TransB >
inline void gemm( const Order, const TransA, const TransB,
const fortran_int_t m, 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>* b,
const fortran_int_t ldb, const std::complex<double> beta,
std::complex<double>* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZGEMM( &blas_option< TransA >::value, &blas_option< TransB >::value,
&m, &n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to gemm.
//
template< typename Value >
struct gemm_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 MatrixB, typename MatrixC >
static result_type invoke( const value_type alpha, const MatrixA& a,
const MatrixB& b, const value_type beta, MatrixC& c ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixC >::type order;
typedef typename result_of::trans_tag< MatrixB, order >::type transb;
typedef typename result_of::trans_tag< MatrixA, order >::type transa;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixB >::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<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::gemm( order(), transa(), transb(),
bindings::size_row(c), bindings::size_column(c),
bindings::size_column(a), alpha, bindings::begin_value(a),
bindings::stride_major(a), bindings::begin_value(b),
bindings::stride_major(b), beta, bindings::begin_value(c),
bindings::stride_major(c) );
}
};
//
// 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 gemm_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for gemm. Its overload differs for
//
template< typename MatrixA, typename MatrixB, typename MatrixC >
inline typename gemm_impl< typename bindings::value_type<
MatrixA >::type >::result_type
gemm( const typename bindings::value_type< MatrixA >::type alpha,
const MatrixA& a, const MatrixB& b,
const typename bindings::value_type< MatrixA >::type beta,
MatrixC& c ) {
gemm_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, b, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,336 @@
//
// 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_LEVEL3_HEMM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HEMM_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 Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
cblas_ssymm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, alpha, a, lda, b, ldb, beta, c,
ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
cblas_dsymm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, alpha, a, lda, b, ldb, beta, c,
ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
cblas_chemm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, &alpha, a, lda, b, ldb, &beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
cblas_zhemm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, &alpha, a, lda, b, ldb, &beta,
c, ldc );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsymm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsymm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasChemm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZhemm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const fortran_int_t m,
const fortran_int_t n, const float alpha, const float* a,
const fortran_int_t lda, const float* b, const fortran_int_t ldb,
const float beta, float* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, const fortran_int_t m,
const fortran_int_t n, const double alpha, const double* a,
const fortran_int_t lda, const double* b, const fortran_int_t ldb,
const double beta, double* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, 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>* b, const fortran_int_t ldb,
const std::complex<float> beta, std::complex<float>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHEMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void hemm( const Order, const Side, const UpLo, 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>* b, const fortran_int_t ldb,
const std::complex<double> beta, std::complex<double>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHEMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to hemm.
//
template< typename Value >
struct hemm_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 Side, typename MatrixA, typename MatrixB,
typename MatrixC >
static result_type invoke( const Side side, const value_type alpha,
const MatrixA& a, const MatrixB& b, const value_type beta,
MatrixC& c ) {
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<
MatrixB >::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<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::hemm( order(), side, uplo(), bindings::size_row(c),
bindings::size_column(c), alpha, bindings::begin_value(a),
bindings::stride_major(a), bindings::begin_value(b),
bindings::stride_major(b), beta, bindings::begin_value(c),
bindings::stride_major(c) );
}
};
//
// 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 hemm_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for hemm. Its overload differs for
//
template< typename Side, typename MatrixA, typename MatrixB, typename MatrixC >
inline typename hemm_impl< typename bindings::value_type<
MatrixA >::type >::result_type
hemm( const Side side, const typename bindings::value_type<
MatrixA >::type alpha, const MatrixA& a, const MatrixB& b,
const typename bindings::value_type< MatrixA >::type beta,
MatrixC& c ) {
hemm_impl< typename bindings::value_type<
MatrixA >::type >::invoke( side, alpha, a, b, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,334 @@
//
// 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_LEVEL3_HER2K_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HER2K_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/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 >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
cblas_ssyr2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, b, ldb, beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
cblas_dsyr2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, b, ldb, beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb, const float beta,
std::complex<float>* c, const int ldc ) {
cblas_cher2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, &alpha, a, lda, b, ldb, beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb, const double beta,
std::complex<double>* c, const int ldc ) {
cblas_zher2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, &alpha, a, lda, b, ldb, beta,
c, ldc );
}
#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 >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsyr2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsyr2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb, const float beta,
std::complex<float>* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCher2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb, const double beta,
std::complex<double>* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZher2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans,
const fortran_int_t n, const fortran_int_t k, const float alpha,
const float* a, const fortran_int_t lda, const float* b,
const fortran_int_t ldb, const float beta, float* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYR2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans,
const fortran_int_t n, const fortran_int_t k, const double alpha,
const double* a, const fortran_int_t lda, const double* b,
const fortran_int_t ldb, const double beta, double* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYR2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans,
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>* b,
const fortran_int_t ldb, const float beta, std::complex<float>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHER2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void her2k( const Order, const UpLo, const Trans,
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>* b,
const fortran_int_t ldb, const double beta, std::complex<double>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHER2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to her2k.
//
template< typename Value >
struct her2k_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 MatrixB, typename MatrixC >
static result_type invoke( const value_type alpha, const MatrixA& a,
const MatrixB& b, const real_type beta, MatrixC& c ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixB >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::uplo_tag< MatrixC >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixB >::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<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::her2k( order(), uplo(), trans(),
bindings::size_column(c), bindings::size_column(a), alpha,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(b), bindings::stride_major(b), beta,
bindings::begin_value(c), bindings::stride_major(c) );
}
};
//
// 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 her2k_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for her2k. Its overload differs for
//
template< typename MatrixA, typename MatrixB, typename MatrixC >
inline typename her2k_impl< typename bindings::value_type<
MatrixA >::type >::result_type
her2k( const typename bindings::value_type< MatrixA >::type alpha,
const MatrixA& a, const MatrixB& b, const typename remove_imaginary<
typename bindings::value_type< MatrixA >::type >::type beta,
MatrixC& c ) {
her2k_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, b, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,308 @@
//
// 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_LEVEL3_HERK_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_HERK_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/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 >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float beta, float* c, const int ldc ) {
cblas_ssyrk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double beta, double* c, const int ldc ) {
cblas_dsyrk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const std::complex<float>* a,
const int lda, const float beta, std::complex<float>* c,
const int ldc ) {
cblas_cherk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const std::complex<double>* a,
const int lda, const double beta, std::complex<double>* c,
const int ldc ) {
cblas_zherk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, beta, c, ldc );
}
#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 >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float beta, float* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsyrk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double beta, double* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsyrk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const std::complex<float>* a,
const int lda, const float beta, std::complex<float>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCherk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const std::complex<double>* a,
const int lda, const double beta, std::complex<double>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZherk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const float alpha, const float* a,
const fortran_int_t lda, const float beta, float* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYRK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const double alpha, const double* a,
const fortran_int_t lda, const double beta, double* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYRK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const float alpha,
const std::complex<float>* a, const fortran_int_t lda,
const float beta, std::complex<float>* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CHERK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void herk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const double alpha,
const std::complex<double>* a, const fortran_int_t lda,
const double beta, std::complex<double>* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZHERK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to herk.
//
template< typename Value >
struct herk_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 MatrixC >
static result_type invoke( const real_type alpha, const MatrixA& a,
const real_type beta, MatrixC& c ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixC >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::uplo_tag< MatrixC >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::herk( order(), uplo(), trans(),
bindings::size_column(c), bindings::size_column(a), alpha,
bindings::begin_value(a), bindings::stride_major(a), beta,
bindings::begin_value(c), bindings::stride_major(c) );
}
};
//
// 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 herk_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for herk. Its overload differs for
//
template< typename MatrixA, typename MatrixC >
inline typename herk_impl< typename bindings::value_type<
MatrixA >::type >::result_type
herk( const typename remove_imaginary< typename bindings::value_type<
MatrixA >::type >::type alpha, const MatrixA& a,
const typename remove_imaginary< typename bindings::value_type<
MatrixA >::type >::type beta, MatrixC& c ) {
herk_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,336 @@
//
// 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_LEVEL3_SYMM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYMM_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 Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
cblas_ssymm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, alpha, a, lda, b, ldb, beta, c,
ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
cblas_dsymm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, alpha, a, lda, b, ldb, beta, c,
ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
cblas_csymm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, &alpha, a, lda, b, ldb, &beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
cblas_zsymm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, m, n, &alpha, a, lda, b, ldb, &beta,
c, ldc );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsymm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsymm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCsymm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const int m,
const int n, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZsymm( blas_option< Side >::value, blas_option< UpLo >::value, m, n,
alpha, a, lda, b, ldb, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const fortran_int_t m,
const fortran_int_t n, const float alpha, const float* a,
const fortran_int_t lda, const float* b, const fortran_int_t ldb,
const float beta, float* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, const fortran_int_t m,
const fortran_int_t n, const double alpha, const double* a,
const fortran_int_t lda, const double* b, const fortran_int_t ldb,
const double beta, double* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, 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>* b, const fortran_int_t ldb,
const std::complex<float> beta, std::complex<float>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CSYMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo >
inline void symm( const Order, const Side, const UpLo, 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>* b, const fortran_int_t ldb,
const std::complex<double> beta, std::complex<double>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZSYMM( &blas_option< Side >::value, &blas_option< UpLo >::value, &m,
&n, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to symm.
//
template< typename Value >
struct symm_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 Side, typename MatrixA, typename MatrixB,
typename MatrixC >
static result_type invoke( const Side side, const value_type alpha,
const MatrixA& a, const MatrixB& b, const value_type beta,
MatrixC& c ) {
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<
MatrixB >::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<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::symm( order(), side, uplo(), bindings::size_row(c),
bindings::size_column(c), alpha, bindings::begin_value(a),
bindings::stride_major(a), bindings::begin_value(b),
bindings::stride_major(b), beta, bindings::begin_value(c),
bindings::stride_major(c) );
}
};
//
// 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 symm_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for symm. Its overload differs for
//
template< typename Side, typename MatrixA, typename MatrixB, typename MatrixC >
inline typename symm_impl< typename bindings::value_type<
MatrixA >::type >::result_type
symm( const Side side, const typename bindings::value_type<
MatrixA >::type alpha, const MatrixA& a, const MatrixB& b,
const typename bindings::value_type< MatrixA >::type beta,
MatrixC& c ) {
symm_impl< typename bindings::value_type<
MatrixA >::type >::invoke( side, alpha, a, b, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,338 @@
//
// 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_LEVEL3_SYR2K_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYR2K_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/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 >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
cblas_ssyr2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, b, ldb, beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
cblas_dsyr2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, b, ldb, beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
cblas_csyr2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, &alpha, a, lda, b, ldb, &beta,
c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
cblas_zsyr2k( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, &alpha, a, lda, b, ldb, &beta,
c, ldc );
}
#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 >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float* b, const int ldb, const float beta, float* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsyr2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double* b, const int ldb, const double beta, double* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsyr2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float>* b, const int ldb,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCsyr2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double>* b, const int ldb,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZsyr2k( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, b, ldb, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans,
const fortran_int_t n, const fortran_int_t k, const float alpha,
const float* a, const fortran_int_t lda, const float* b,
const fortran_int_t ldb, const float beta, float* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYR2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans,
const fortran_int_t n, const fortran_int_t k, const double alpha,
const double* a, const fortran_int_t lda, const double* b,
const fortran_int_t ldb, const double beta, double* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYR2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans,
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>* b,
const fortran_int_t ldb, const std::complex<float> beta,
std::complex<float>* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CSYR2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syr2k( const Order, const UpLo, const Trans,
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>* b,
const fortran_int_t ldb, const std::complex<double> beta,
std::complex<double>* c, const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZSYR2K( &blas_option< UpLo >::value, &blas_option< Trans >::value,
&n, &k, &alpha, a, &lda, b, &ldb, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to syr2k.
//
template< typename Value >
struct syr2k_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 MatrixB, typename MatrixC >
static result_type invoke( const value_type alpha, const MatrixA& a,
const MatrixB& b, const value_type beta, MatrixC& c ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixB >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::uplo_tag< MatrixC >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixB >::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<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::syr2k( order(), uplo(), trans(),
bindings::size_column(c), bindings::size_column(a), alpha,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(b), bindings::stride_major(b), beta,
bindings::begin_value(c), bindings::stride_major(c) );
}
};
//
// 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 syr2k_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for syr2k. Its overload differs for
//
template< typename MatrixA, typename MatrixB, typename MatrixC >
inline typename syr2k_impl< typename bindings::value_type<
MatrixA >::type >::result_type
syr2k( const typename bindings::value_type< MatrixA >::type alpha,
const MatrixA& a, const MatrixB& b,
const typename bindings::value_type< MatrixA >::type beta,
MatrixC& c ) {
syr2k_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, b, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View 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_LEVEL3_SYRK_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_SYRK_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/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 >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float beta, float* c, const int ldc ) {
cblas_ssyrk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double beta, double* c, const int ldc ) {
cblas_dsyrk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
cblas_csyrk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, &alpha, a, lda, &beta, c,
ldc );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
cblas_zsyrk( cblas_option< Order >::value, cblas_option< UpLo >::value,
cblas_option< Trans >::value, n, k, &alpha, a, lda, &beta, c,
ldc );
}
#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 >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const float alpha, const float* a, const int lda,
const float beta, float* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasSsyrk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const double alpha, const double* a, const int lda,
const double beta, double* c, const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDsyrk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<float> alpha,
const std::complex<float>* a, const int lda,
const std::complex<float> beta, std::complex<float>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCsyrk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const int n,
const int k, const std::complex<double> alpha,
const std::complex<double>* a, const int lda,
const std::complex<double> beta, std::complex<double>* c,
const int ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZsyrk( blas_option< UpLo >::value, blas_option< Trans >::value, n,
k, alpha, a, lda, beta, c, ldc );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const float alpha, const float* a,
const fortran_int_t lda, const float beta, float* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_SSYRK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, const fortran_int_t n,
const fortran_int_t k, const double alpha, const double* a,
const fortran_int_t lda, const double beta, double* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DSYRK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, 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> beta, std::complex<float>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CSYRK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename UpLo, typename Trans >
inline void syrk( const Order, const UpLo, const Trans, 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> beta, std::complex<double>* c,
const fortran_int_t ldc ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZSYRK( &blas_option< UpLo >::value, &blas_option< Trans >::value, &n,
&k, &alpha, a, &lda, &beta, c, &ldc );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to syrk.
//
template< typename Value >
struct syrk_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 MatrixC >
static result_type invoke( const value_type alpha, const MatrixA& a,
const value_type beta, MatrixC& c ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixC >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type trans;
typedef typename result_of::uplo_tag< MatrixC >::type uplo;
BOOST_STATIC_ASSERT( (is_same< typename remove_const<
typename bindings::value_type< MatrixA >::type >::type,
typename remove_const< typename bindings::value_type<
MatrixC >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixC >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixC >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(c) == 1 ||
bindings::stride_minor(c) == 1 );
detail::syrk( order(), uplo(), trans(),
bindings::size_column(c), bindings::size_column(a), alpha,
bindings::begin_value(a), bindings::stride_major(a), beta,
bindings::begin_value(c), bindings::stride_major(c) );
}
};
//
// 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 syrk_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for syrk. Its overload differs for
//
template< typename MatrixA, typename MatrixC >
inline typename syrk_impl< typename bindings::value_type<
MatrixA >::type >::result_type
syrk( const typename bindings::value_type< MatrixA >::type alpha,
const MatrixA& a, const typename bindings::value_type<
MatrixA >::type beta, MatrixC& c ) {
syrk_impl< typename bindings::value_type<
MatrixA >::type >::invoke( alpha, a, beta, c );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,334 @@
//
// 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_LEVEL3_TRMM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_TRMM_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_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 Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const float alpha,
const float* a, const int lda, float* b, const int ldb ) {
cblas_strmm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const double alpha,
const double* a, const int lda, double* b, const int ldb ) {
cblas_dtrmm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda, std::complex<float>* b,
const int ldb ) {
cblas_ctrmm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, &alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, std::complex<double>* b, const int ldb ) {
cblas_ztrmm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, &alpha, a, lda, b, ldb );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const float alpha,
const float* a, const int lda, float* b, const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasStrmm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const double alpha,
const double* a, const int lda, double* b, const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDtrmm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda, std::complex<float>* b,
const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCtrmm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, std::complex<double>* b, const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZtrmm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const fortran_int_t m, const fortran_int_t n,
const float alpha, const float* a, const fortran_int_t lda, float* b,
const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_STRMM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, const fortran_int_t m, const fortran_int_t n,
const double alpha, const double* a, const fortran_int_t lda,
double* b, const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DTRMM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, 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, std::complex<float>* b,
const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CTRMM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trmm( const Order, const Side, const UpLo, const TransA,
const Diag, 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, std::complex<double>* b,
const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZTRMM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to trmm.
//
template< typename Value >
struct trmm_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 Side, typename MatrixA, typename MatrixB >
static result_type invoke( const Side side, const value_type alpha,
const MatrixA& a, MatrixB& b ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixB >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type transa;
typedef typename result_of::uplo_tag< MatrixA, transa >::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<
MatrixB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
detail::trmm( order(), side, uplo(), transa(), diag(),
bindings::size_row(b), bindings::size_column(b), alpha,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(b), bindings::stride_major(b) );
}
};
//
// 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 trmm_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for trmm. Its overload differs for
//
template< typename Side, typename MatrixA, typename MatrixB >
inline typename trmm_impl< typename bindings::value_type<
MatrixA >::type >::result_type
trmm( const Side side, const typename bindings::value_type<
MatrixA >::type alpha, const MatrixA& a, MatrixB& b ) {
trmm_impl< typename bindings::value_type<
MatrixA >::type >::invoke( side, alpha, a, b );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif

View File

@@ -0,0 +1,334 @@
//
// 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_LEVEL3_TRSM_HPP
#define BOOST_NUMERIC_BINDINGS_BLAS_LEVEL3_TRSM_HPP
#include <boost/assert.hpp>
#include <boost/numeric/bindings/begin.hpp>
#include <boost/numeric/bindings/data_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 Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const float alpha,
const float* a, const int lda, float* b, const int ldb ) {
cblas_strsm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const double alpha,
const double* a, const int lda, double* b, const int ldb ) {
cblas_dtrsm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda, std::complex<float>* b,
const int ldb ) {
cblas_ctrsm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, &alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, std::complex<double>* b, const int ldb ) {
cblas_ztrsm( cblas_option< Order >::value, cblas_option< Side >::value,
cblas_option< UpLo >::value, cblas_option< TransA >::value,
cblas_option< Diag >::value, m, n, &alpha, a, lda, b, ldb );
}
#elif defined BOOST_NUMERIC_BINDINGS_BLAS_CUBLAS
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const float alpha,
const float* a, const int lda, float* b, const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasStrsm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const double alpha,
const double* a, const int lda, double* b, const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasDtrsm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n, const std::complex<float> alpha,
const std::complex<float>* a, const int lda, std::complex<float>* b,
const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasCtrsm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
//
// Overloaded function for dispatching to
// * CUBLAS backend, and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const int m, const int n,
const std::complex<double> alpha, const std::complex<double>* a,
const int lda, std::complex<double>* b, const int ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
cublasZtrsm( blas_option< Side >::value, blas_option< UpLo >::value,
blas_option< TransA >::value, blas_option< Diag >::value, m, n,
alpha, a, lda, b, ldb );
}
#else
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * float value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const fortran_int_t m, const fortran_int_t n,
const float alpha, const float* a, const fortran_int_t lda, float* b,
const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_STRSM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * double value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, const fortran_int_t m, const fortran_int_t n,
const double alpha, const double* a, const fortran_int_t lda,
double* b, const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_DTRSM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<float> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, 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, std::complex<float>* b,
const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_CTRSM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
//
// Overloaded function for dispatching to
// * netlib-compatible BLAS backend (the default), and
// * complex<double> value-type.
//
template< typename Order, typename Side, typename UpLo, typename TransA,
typename Diag >
inline void trsm( const Order, const Side, const UpLo, const TransA,
const Diag, 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, std::complex<double>* b,
const fortran_int_t ldb ) {
BOOST_STATIC_ASSERT( (is_same<Order, tag::column_major>::value) );
BLAS_ZTRSM( &blas_option< Side >::value, &blas_option< UpLo >::value,
&blas_option< TransA >::value, &blas_option< Diag >::value, &m,
&n, &alpha, a, &lda, b, &ldb );
}
#endif
} // namespace detail
//
// Value-type based template class. Use this class if you need a type
// for dispatching to trsm.
//
template< typename Value >
struct trsm_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 Side, typename MatrixA, typename MatrixB >
static result_type invoke( const Side side, const value_type alpha,
const MatrixA& a, MatrixB& b ) {
namespace bindings = ::boost::numeric::bindings;
typedef typename result_of::data_order< MatrixB >::type order;
typedef typename result_of::trans_tag< MatrixA, order >::type transa;
typedef typename result_of::uplo_tag< MatrixA, transa >::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<
MatrixB >::type >::type >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixA >::value) );
BOOST_STATIC_ASSERT( (bindings::has_linear_array< MatrixB >::value) );
BOOST_STATIC_ASSERT( (bindings::is_mutable< MatrixB >::value) );
BOOST_ASSERT( bindings::size_minor(a) == 1 ||
bindings::stride_minor(a) == 1 );
BOOST_ASSERT( bindings::size_minor(b) == 1 ||
bindings::stride_minor(b) == 1 );
detail::trsm( order(), side, uplo(), transa(), diag(),
bindings::size_row(b), bindings::size_column(b), alpha,
bindings::begin_value(a), bindings::stride_major(a),
bindings::begin_value(b), bindings::stride_major(b) );
}
};
//
// 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 trsm_impl classes. In the
// documentation, the const-overloads are collapsed to avoid a large number of
// prototypes which are very similar.
//
//
// Overloaded function for trsm. Its overload differs for
//
template< typename Side, typename MatrixA, typename MatrixB >
inline typename trsm_impl< typename bindings::value_type<
MatrixA >::type >::result_type
trsm( const Side side, const typename bindings::value_type<
MatrixA >::type alpha, const MatrixA& a, MatrixB& b ) {
trsm_impl< typename bindings::value_type<
MatrixA >::type >::invoke( side, alpha, a, b );
}
} // namespace blas
} // namespace bindings
} // namespace numeric
} // namespace boost
#endif