20 template<const
bool do_trans_A=false, const
bool use_alpha=false, const
bool use_beta=false>
26 template<const uword row, const uword col>
29 static const uword n2 = (do_trans_A ==
false) ? (row + col*2) : (col + row*2);
30 static const uword n3 = (do_trans_A ==
false) ? (row + col*3) : (col + row*3);
31 static const uword n4 = (do_trans_A ==
false) ? (row + col*4) : (col + row*4);
36 template<
typename eT, const uword i>
41 assign(eT* y,
const eT acc,
const eT alpha,
const eT beta)
45 y[i] = (use_alpha ==
false) ? acc : alpha*acc;
51 y[i] = beta*tmp + ( (use_alpha ==
false) ? acc : alpha*acc );
62 apply( eT* y,
const Mat<eT>& A,
const eT* x,
const eT alpha = eT(1),
const eT beta = eT(0) )
72 const eT acc = Am[0] * x[0];
74 assign<eT, 0>(y, acc, alpha, beta);
87 assign<eT, 0>(y, acc0, alpha, beta);
88 assign<eT, 1>(y, acc1, alpha, beta);
103 assign<eT, 0>(y, acc0, alpha, beta);
104 assign<eT, 1>(y, acc1, alpha, beta);
105 assign<eT, 2>(y, acc2, alpha, beta);
122 assign<eT, 0>(y, acc0, alpha, beta);
123 assign<eT, 1>(y, acc1, alpha, beta);
124 assign<eT, 2>(y, acc2, alpha, beta);
125 assign<eT, 3>(y, acc3, alpha, beta);
143 template<const
bool do_trans_A=false, const
bool use_alpha=false, const
bool use_beta=false>
148 template<
typename eT>
153 apply( eT* y,
const Mat<eT>& A,
const eT* x,
const eT alpha = eT(1),
const eT beta = eT(0) )
160 if(do_trans_A ==
false)
166 if( (use_alpha ==
false) && (use_beta ==
false) )
171 if( (use_alpha ==
true) && (use_beta ==
false) )
176 if( (use_alpha ==
false) && (use_beta ==
true) )
178 y[0] = acc + beta*y[0];
181 if( (use_alpha ==
true) && (use_beta ==
true) )
183 y[0] = alpha*acc + beta*y[0];
187 for(
uword row=0; row < A_n_rows; ++row)
191 for(
uword i=0; i < A_n_cols; ++i)
193 acc += A.
at(row,i) * x[i];
196 if( (use_alpha ==
false) && (use_beta ==
false) )
201 if( (use_alpha ==
true) && (use_beta ==
false) )
203 y[row] = alpha * acc;
206 if( (use_alpha ==
false) && (use_beta ==
true) )
208 y[row] = acc + beta*y[row];
211 if( (use_alpha ==
true) && (use_beta ==
true) )
213 y[row] = alpha*acc + beta*y[row];
218 if(do_trans_A ==
true)
220 for(
uword col=0; col < A_n_cols; ++col)
235 if( (use_alpha ==
false) && (use_beta ==
false) )
240 if( (use_alpha ==
true) && (use_beta ==
false) )
242 y[col] = alpha * acc;
245 if( (use_alpha ==
false) && (use_beta ==
true) )
247 y[col] = acc + beta*y[col];
250 if( (use_alpha ==
true) && (use_beta ==
true) )
252 y[col] = alpha*acc + beta*y[col];
263 template<const
bool do_trans_A=false, const
bool use_alpha=false, const
bool use_beta=false>
268 template<
typename eT>
281 if( (A_n_rows <= 4) && (A_n_rows == A_n_cols) )
293 template<
typename eT>
309 const Mat<eT>& AA = (do_trans_A ==
false) ? A : tmp_A;
314 if( (AA_n_rows <= 4) && (AA_n_rows == AA_n_cols) )
331 template<const
bool do_trans_A=false, const
bool use_alpha=false, const
bool use_beta=false>
336 template<
typename eT>
350 #if defined(ARMA_USE_ATLAS) 354 atlas::cblas_gemv<eT>
356 atlas::CblasColMajor,
360 (use_alpha) ? alpha : eT(1),
365 (use_beta) ? beta : eT(0),
370 #elif defined(ARMA_USE_BLAS) 377 const eT local_alpha = (use_alpha) ? alpha : eT(1);
380 const eT local_beta = (use_beta) ? beta : eT(0);
410 template<
typename eT>
414 apply( eT* y,
const Mat<eT>& A,
const eT* x,
const eT alpha = eT(1),
const eT beta = eT(0) )
429 const float alpha =
float(1),
430 const float beta =
float(0)
446 const double alpha =
double(1),
447 const double beta =
double(0)
460 std::complex<float>* y,
461 const Mat< std::complex<float > >& A,
462 const std::complex<float>* x,
463 const std::complex<float> alpha = std::complex<float>(1),
464 const std::complex<float> beta = std::complex<float>(0)
477 std::complex<double>* y,
478 const Mat< std::complex<double> >& A,
479 const std::complex<double>* x,
480 const std::complex<double> alpha = std::complex<double>(1),
481 const std::complex<double> beta = std::complex<double>(0)
static arma_hot void apply(eT *y, const Mat< eT > &A, const eT *x, const eT alpha=eT(1), const eT beta=eT(0))
arma_inline arma_warn_unused eT * memptr()
returns a pointer to array of eTs used by the matrix
static arma_hot void apply(eT *y, const Mat< eT > &A, const eT *x, const eT alpha=eT(1), const eT beta=eT(0), const typename arma_not_cx< eT >::result *junk=0)
Wrapper for ATLAS/BLAS gemv function, using template arguments to control the arguments passed to gem...
const uword n_cols
number of columns in the matrix (read-only)
const uword n_elem
number of elements in the matrix (read-only)
const uword n_rows
number of rows in the matrix (read-only)
static arma_hot void apply(eT *y, const Mat< eT > &A, const eT *x, const eT alpha=eT(1), const eT beta=eT(0))
#define arma_extra_debug_print
arma_inline arma_warn_unused eT * colptr(const uword in_col)
returns a pointer to array of eTs for a specified column; no bounds check
for tiny square matrices, size <= 4x4
arma_inline arma_warn_unused eT & at(const uword i)
linear element accessor (treats the matrix as a vector); no bounds check.
#define arma_ignore(variable)
static arma_inline void apply_noalias(Mat< eT > &out, const Mat< eT > &A, const typename arma_not_cx< eT >::result *junk=0)
static arma_inline void apply(eT *y, const Mat< eT > &A, const eT *x, const eT alpha=eT(1), const eT beta=eT(0))
#define arma_extra_debug_sigprint
static arma_hot void apply(eT *y, const Mat< eT > &A, const eT *x, const eT alpha=eT(1), const eT beta=eT(0), const typename arma_cx_only< eT >::result *junk=0)
arma_hot static arma_inline void assign(eT *y, const eT acc, const eT alpha, const eT beta)
static void apply_blas_type(eT *y, const Mat< eT > &A, const eT *x, const eT alpha=eT(1), const eT beta=eT(0))
Partial emulation of ATLAS/BLAS gemv(). 'y' is assumed to have been set to the correct size (i...
arma_aligned const eT *const mem
pointer to the memory used by the matrix (memory is read-only)
arma_hot static arma_pure eT direct_dot_arma(const uword n_elem, const eT *const A, const eT *const B)