gemv< do_trans_A, use_alpha, use_beta > Class Template Reference
[Gemv]

Wrapper for ATLAS/BLAS gemv function, using template arguments to control the arguments passed to gemv. 'y' is assumed to have been set to the correct size (i.e. taking into account the transpose). More...

#include <gemv.hpp>

List of all members.

Static Public Member Functions

template<typename eT >
static void apply_blas_type (eT *y, const Mat< eT > &A, const eT *x, const eT alpha=eT(1), const eT beta=eT(0))
template<typename eT >
static arma_inline void apply (eT *y, const Mat< eT > &A, const eT *x, const eT alpha=eT(1), const eT beta=eT(0))
static arma_inline void apply (float *y, const Mat< float > &A, const float *x, const float alpha=float(1), const float beta=float(0))
static arma_inline void apply (double *y, const Mat< double > &A, const double *x, const double alpha=double(1), const double beta=double(0))
static arma_inline void apply (std::complex< float > *y, const Mat< std::complex< float > > &A, const std::complex< float > *x, const std::complex< float > alpha=std::complex< float >(1), const std::complex< float > beta=std::complex< float >(0))
static arma_inline void apply (std::complex< double > *y, const Mat< std::complex< double > > &A, const std::complex< double > *x, const std::complex< double > alpha=std::complex< double >(1), const std::complex< double > beta=std::complex< double >(0))

Detailed Description

template<const bool do_trans_A = false, const bool use_alpha = false, const bool use_beta = false>
class gemv< do_trans_A, use_alpha, use_beta >

Wrapper for ATLAS/BLAS gemv function, using template arguments to control the arguments passed to gemv. 'y' is assumed to have been set to the correct size (i.e. taking into account the transpose).

Definition at line 123 of file gemv.hpp.


Member Function Documentation

template<const bool do_trans_A = false, const bool use_alpha = false, const bool use_beta = false>
template<typename eT >
static void gemv< do_trans_A, use_alpha, use_beta >::apply_blas_type ( eT *  y,
const Mat< eT > &  A,
const eT *  x,
const eT  alpha = eT(1),
const eT  beta = eT(0) 
) [inline, static]

Definition at line 131 of file gemv.hpp.

References gemv< do_trans_A, use_alpha, use_beta >::apply(), Mat< eT >::mem, Mat< eT >::n_cols, Mat< eT >::n_elem, and Mat< eT >::n_rows.

Referenced by gemv< do_trans_A, use_alpha, use_beta >::apply().

00132     {
00133     arma_extra_debug_sigprint();
00134     
00135     if(A.n_elem <= 256u)
00136      {
00137      gemv_arma<do_trans_A, use_alpha, use_beta>::apply(y,A,x,alpha,beta);
00138      }
00139     else
00140       {
00141       #if defined(ARMA_USE_ATLAS)
00142         {
00143         arma_extra_debug_print("atlas::cblas_gemv()");
00144         
00145         atlas::cblas_gemv<eT>
00146           (
00147           atlas::CblasColMajor,
00148           (do_trans_A) ? atlas::CblasTrans : atlas::CblasNoTrans,
00149           A.n_rows,
00150           A.n_cols,
00151           (use_alpha) ? alpha : eT(1),
00152           A.mem,
00153           A.n_rows,
00154           x,
00155           1,
00156           (use_beta) ? beta : eT(0),
00157           y,
00158           1
00159           );
00160         }
00161       #elif defined(ARMA_USE_BLAS)
00162         {
00163         arma_extra_debug_print("blas::gemv_()");
00164         
00165         const char trans_A     = (do_trans_A) ? 'T' : 'N';
00166         const int  m           = A.n_rows;
00167         const int  n           = A.n_cols;
00168         const eT   local_alpha = (use_alpha) ? alpha : eT(1);
00169         //const int  lda         = A.n_rows;
00170         const int  inc         = 1;
00171         const eT   local_beta  = (use_beta) ? beta : eT(0);
00172         
00173         arma_extra_debug_print( arma_boost::format("blas::gemv_(): trans_A = %c") % trans_A );
00174 
00175         blas::gemv_<eT>
00176           (
00177           &trans_A,
00178           &m,
00179           &n,
00180           &local_alpha,
00181           A.mem,
00182           &m,  // lda
00183           x,
00184           &inc,
00185           &local_beta,
00186           y,
00187           &inc
00188           );
00189         }
00190       #else
00191         {
00192         gemv_arma<do_trans_A, use_alpha, use_beta>::apply(y,A,x,alpha,beta);
00193         }
00194       #endif
00195       }
00196     
00197     }

template<const bool do_trans_A = false, const bool use_alpha = false, const bool use_beta = false>
template<typename eT >
static arma_inline void gemv< do_trans_A, use_alpha, use_beta >::apply ( eT *  y,
const Mat< eT > &  A,
const eT *  x,
const eT  alpha = eT(1),
const eT  beta = eT(0) 
) [inline, static]

Definition at line 205 of file gemv.hpp.

Referenced by glue_times::apply(), and gemv< do_trans_A, use_alpha, use_beta >::apply_blas_type().

00206     {
00207     gemv_arma<do_trans_A, use_alpha, use_beta>::apply(y,A,x,alpha,beta);
00208     }

template<const bool do_trans_A = false, const bool use_alpha = false, const bool use_beta = false>
static arma_inline void gemv< do_trans_A, use_alpha, use_beta >::apply ( float *  y,
const Mat< float > &  A,
const float *  x,
const float  alpha = float(1),
const float  beta = float(0) 
) [inline, static]

Definition at line 216 of file gemv.hpp.

References gemv< do_trans_A, use_alpha, use_beta >::apply_blas_type().

00223     {
00224     gemv<do_trans_A, use_alpha, use_beta>::apply_blas_type(y,A,x,alpha,beta);
00225     }

template<const bool do_trans_A = false, const bool use_alpha = false, const bool use_beta = false>
static arma_inline void gemv< do_trans_A, use_alpha, use_beta >::apply ( double *  y,
const Mat< double > &  A,
const double *  x,
const double  alpha = double(1),
const double  beta = double(0) 
) [inline, static]

Definition at line 233 of file gemv.hpp.

References gemv< do_trans_A, use_alpha, use_beta >::apply_blas_type().

00240     {
00241     gemv<do_trans_A, use_alpha, use_beta>::apply_blas_type(y,A,x,alpha,beta);
00242     }

template<const bool do_trans_A = false, const bool use_alpha = false, const bool use_beta = false>
static arma_inline void gemv< do_trans_A, use_alpha, use_beta >::apply ( std::complex< float > *  y,
const Mat< std::complex< float > > &  A,
const std::complex< float > *  x,
const std::complex< float >  alpha = std::complex<float>(1),
const std::complex< float >  beta = std::complex<float>(0) 
) [inline, static]

Definition at line 250 of file gemv.hpp.

References gemv< do_trans_A, use_alpha, use_beta >::apply_blas_type().

00257     {
00258     gemv<do_trans_A, use_alpha, use_beta>::apply_blas_type(y,A,x,alpha,beta);
00259     }

template<const bool do_trans_A = false, const bool use_alpha = false, const bool use_beta = false>
static arma_inline void gemv< do_trans_A, use_alpha, use_beta >::apply ( std::complex< double > *  y,
const Mat< std::complex< double > > &  A,
const std::complex< double > *  x,
const std::complex< double >  alpha = std::complex<double>(1),
const std::complex< double >  beta = std::complex<double>(0) 
) [inline, static]

Definition at line 267 of file gemv.hpp.

References gemv< do_trans_A, use_alpha, use_beta >::apply_blas_type().

00274     {
00275     gemv<do_trans_A, use_alpha, use_beta>::apply_blas_type(y,A,x,alpha,beta);
00276     }