arma_hot inline void spglue_plus::apply(SpMat<typename T1::elem_type>& out, const SpGlue<T1,T2,spglue_plus>& X) { arma_extra_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy<T1> pa(X.A); const SpProxy<T2> pb(X.B); const bool is_alias = pa.is_alias(out) || pb.is_alias(out); if(is_alias == false) { spglue_plus::apply_noalias(out, pa, pb); } else { SpMat<eT> tmp; spglue_plus::apply_noalias(tmp, pa, pb); out.steal_mem(tmp); } }
inline void spop_mean::apply(SpMat<typename T1::elem_type>& out, const SpOp<T1, spop_mean>& in) { arma_extra_debug_sigprint(); typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; arma_debug_check( (dim > 1), "mean(): parameter 'dim' must be 0 or 1" ); const SpProxy<T1> p(in.m); if(p.is_alias(out) == false) { spop_mean::apply_noalias_fast(out, p, dim); } else { SpMat<eT> tmp; spop_mean::apply_noalias_fast(tmp, p, dim); out.steal_mem(tmp); } }
inline void spop_var::apply(SpMat<typename T1::pod_type>& out, const mtSpOp<typename T1::pod_type, T1, spop_var>& in) { arma_extra_debug_sigprint(); //typedef typename T1::elem_type in_eT; typedef typename T1::pod_type out_eT; const uword norm_type = in.aux_uword_a; const uword dim = in.aux_uword_b; arma_debug_check( (norm_type > 1), "var(): parameter 'norm_type' must be 0 or 1" ); arma_debug_check( (dim > 1), "var(): parameter 'dim' must be 0 or 1" ); const SpProxy<T1> p(in.m); if(p.is_alias(out) == false) { spop_var::apply_noalias(out, p, norm_type, dim); } else { SpMat<out_eT> tmp; spop_var::apply_noalias(tmp, p, norm_type, dim); out.steal_mem(tmp); } }
inline void spdiagview<eT>::operator/=(const SpBase<eT,T1>& o) { arma_extra_debug_sigprint(); spdiagview<eT>& d = *this; SpMat<eT>& d_m = const_cast< SpMat<eT>& >(d.m); const uword d_n_elem = d.n_elem; const uword d_row_offset = d.row_offset; const uword d_col_offset = d.col_offset; const SpProxy<T1> P( o.get_ref() ); arma_debug_check ( ( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ), "spdiagview: given object has incompatible size" ); if( SpProxy<T1>::must_use_iterator || P.is_alias(d_m) ) { const SpMat<eT> tmp(P.Q); if(tmp.n_cols == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) /= tmp.at(i,0); } } else if(tmp.n_rows == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) /= tmp.at(0,i); } } } else { if(P.get_n_cols() == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) /= P.at(i,0); } } else if(P.get_n_rows() == 1) { for(uword i=0; i < d_n_elem; ++i) { d_m.at(i + d_row_offset, i + d_col_offset) /= P.at(0,i); } } } }
inline void spop_diagmat::apply(SpMat<typename T1::elem_type>& out, const SpOp<T1, spop_diagmat>& in) { arma_extra_debug_sigprint(); typedef typename T1::elem_type eT; const SpProxy<T1> p(in.m); if(p.is_alias(out) == false) { spop_diagmat::apply_noalias(out, p); } else { SpMat<eT> tmp; spop_diagmat::apply_noalias(tmp, p); out.steal_mem(tmp); } }