20 template<
typename T1,
typename T2>
27 typedef typename T1::elem_type eT;
35 const bool do_trans_A = tmp1.
do_trans;
36 const bool do_trans_B = tmp2.
do_trans;
39 const eT alpha = use_alpha ? (tmp1.
get_val() * tmp2.
get_val()) : eT(0);
46 template<
typename T1,
typename T2,
typename T3>
53 typedef typename T1::elem_type eT;
66 const bool do_trans_A = tmp1.
do_trans;
67 const bool do_trans_B = tmp2.
do_trans;
68 const bool do_trans_C = tmp3.
do_trans;
73 glue_times::apply(out, A, B, C, alpha, do_trans_A, do_trans_B, do_trans_C, use_alpha);
78 template<
typename T1,
typename T2,
typename T3,
typename T4>
85 typedef typename T1::elem_type eT;
100 const bool do_trans_A = tmp1.
do_trans;
101 const bool do_trans_B = tmp2.
do_trans;
102 const bool do_trans_C = tmp3.
do_trans;
103 const bool do_trans_D = tmp4.
do_trans;
108 glue_times::apply(out, A, B, C, D, alpha, do_trans_A, do_trans_B, do_trans_C, do_trans_D, use_alpha);
113 template<
typename T1,
typename T2>
120 typedef typename T1::elem_type eT;
131 template<
typename T1>
138 typedef typename T1::elem_type eT;
148 if(out_n_cols == B.
n_cols)
154 eT* tmp_rowdata = tmp.
memptr();
156 for(
uword row=0; row < out_n_rows; ++row)
160 for(
uword col=0; col < out_n_cols; ++col)
177 template<
typename T1,
typename T2>
185 typedef typename T1::elem_type eT;
194 const bool do_trans_A = tmp1.
do_trans;
195 const bool do_trans_B = tmp2.
do_trans;
207 if( (do_trans_A ==
false) && (do_trans_B ==
false) && (use_alpha ==
false) )
224 if( (do_trans_A ==
false) && (do_trans_B ==
false) && (use_alpha ==
true) )
241 if( (do_trans_A ==
true) && (do_trans_B ==
false) && (use_alpha ==
false) )
258 if( (do_trans_A ==
true) && (do_trans_B ==
false) && (use_alpha ==
true) )
275 if( (do_trans_A ==
false) && (do_trans_B ==
true) && (use_alpha ==
false) )
292 if( (do_trans_A ==
false) && (do_trans_B ==
true) && (use_alpha ==
true) )
309 if( (do_trans_A ==
true) && (do_trans_B ==
true) && (use_alpha ==
false) )
326 if( (do_trans_A ==
true) && (do_trans_B ==
true) && (use_alpha ==
true) )
349 template<
typename eT>
357 return final_A_n_rows * final_B_n_cols;
362 template<
typename eT>
372 const bool do_trans_A,
373 const bool do_trans_B,
384 out.
set_size(final_n_rows, final_n_cols);
388 if( (do_trans_A ==
false) && (do_trans_B ==
false) && (use_alpha ==
false) )
405 if( (do_trans_A ==
false) && (do_trans_B ==
false) && (use_alpha ==
true) )
422 if( (do_trans_A ==
true) && (do_trans_B ==
false) && (use_alpha ==
false) )
439 if( (do_trans_A ==
true) && (do_trans_B ==
false) && (use_alpha ==
true) )
456 if( (do_trans_A ==
false) && (do_trans_B ==
true) && (use_alpha ==
false) )
473 if( (do_trans_A ==
false) && (do_trans_B ==
true) && (use_alpha ==
true) )
490 if( (do_trans_A ==
true) && (do_trans_B ==
true) && (use_alpha ==
false) )
507 if( (do_trans_A ==
true) && (do_trans_B ==
true) && (use_alpha ==
true) )
532 template<
typename eT>
542 const bool do_trans_A,
543 const bool do_trans_B,
544 const bool do_trans_C,
568 template<
typename eT>
579 const bool do_trans_A,
580 const bool do_trans_B,
581 const bool do_trans_C,
582 const bool do_trans_D,
593 glue_times::apply(tmp, A, B, C, alpha, do_trans_A, do_trans_B, do_trans_C, use_alpha);
600 glue_times::apply(tmp, B, C, D, alpha, do_trans_B, do_trans_C, do_trans_D, use_alpha);
612 template<
typename T1,
typename T2>
620 typedef typename T1::elem_type eT;
641 eT* out_coldata = out.
colptr(col);
642 const eT* B_coldata = B.
colptr(col);
646 out_coldata[row] = A[row] * B_coldata[row];
664 const eT val = B[col];
666 eT* out_coldata = out.
colptr(col);
667 const eT* A_coldata = A.
colptr(col);
671 out_coldata[row] = A_coldata[row] * val;
687 out.
at(i,i) = A[i] * B[i];
arma_hot void copy_row(const Mat< eT > &A, const uword row)
arma_inline arma_warn_unused eT * memptr()
returns a pointer to array of eTs used by the matrix
A lightweight array for POD types. If the amount of memory requested is small, the stack is used...
Class which implements the immediate multiplication of two or more matrices.
static const bool do_trans
void set_size(const uword in_elem)
change the matrix to have user specified dimensions (data is not preserved)
arma_hot static arma_pure arma_float_only< eT >::result direct_dot(const uword n_elem, const eT *const A, const eT *const B)
static void apply_inplace(Mat< typename T1::elem_type > &out, const T1 &X)
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_inline uword mul_storage_cost(const Mat< eT > &A, const Mat< eT > &B, const bool do_trans_A, const bool do_trans_B)
void arma_hot arma_assert_same_size(const uword A_n_rows, const uword A_n_cols, const uword B_n_rows, const uword B_n_cols, const char *x)
#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
static const bool do_diagmat
static arma_hot void apply(Mat< typename T1::elem_type > &out, const Glue< T1, T2, glue_times_diag > &X)
const T1 & A
first operand
arma_inline arma_warn_unused eT & at(const uword i)
linear element accessor (treats the matrix as a vector); no bounds check.
static void apply(Mat< eT > &C, const Mat< eT > &A, const Mat< eT > &B, const eT alpha=eT(1), const eT beta=eT(0))
immediate multiplication of matrices A and B, storing the result in C
const T2 & B
second operand
static void apply(Mat< typename T1::elem_type > &out, const Glue< T1, T2, glue_times > &X)
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_inplace_plus(Mat< typename T1::elem_type > &out, const Glue< T1, T2, glue_times > &X, const sword sign)
#define arma_debug_assert_mul_size
arma_inline eT * memptr()
static void apply(Mat< typename T1::elem_type > &out, const Glue< T1, T2, glue_times > &X)
static const bool do_times
Template metaprogram depth_lhs calculates the number of Glue<Tx,Ty, glue_type> instances on the left ...