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 (eT *y, const Mat< eT > &A, const eT *x, const eT alpha=eT(1), const eT beta=eT(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 121 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 ( eT *  y,
const Mat< eT > &  A,
const eT *  x,
const eT  alpha = eT(1),
const eT  beta = eT(0) 
) [inline, static]

Definition at line 129 of file gemv.hpp.

References Mat< eT >::mem, Mat< eT >::n_cols, Mat< eT >::n_elem, and Mat< eT >::n_rows.

Referenced by glue_plus::apply().

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