49 for(
uword col=0; col<X_n_cols; ++col)
54 const eT result = val / T(X_n_cols);
74 for(
uword i=0; i<X_n_elem; ++i)
79 const eT result = val / T(X_n_elem);
99 for(
uword i=0; i<X_n_elem; ++i)
104 const eT result = val / T(X_n_elem);
115 template<
typename T1>
122 typedef typename T1::elem_type eT;
129 arma_debug_check( (dim > 1),
"mean(): incorrect usage. dim must be 0 or 1");
138 out.
set_size( (X_n_rows > 0) ? 1 : 0, X_n_cols );
142 eT* out_mem = out.
memptr();
144 for(
uword col=0; col<X_n_cols; ++col)
155 out.
set_size(X_n_rows, (X_n_cols > 0) ? 1 : 0);
159 eT* out_mem = out.
memptr();
161 for(
uword row=0; row<X_n_rows; ++row)
171 template<
typename eT>
187 for(i=0, j=1; j<n_elem; i+=2, j+=2)
192 r_mean = r_mean + (Xi - r_mean)/T(j);
193 r_mean = r_mean + (Xj - r_mean)/T(j+1);
201 r_mean = r_mean + (Xi - r_mean)/T(i+1);
209 template<
typename eT>
222 for(
uword col=0; col<X_n_cols; ++col)
224 r_mean = r_mean + (X.
at(row,col) - r_mean)/T(col+1);
232 template<
typename eT>
245 for(
uword i=0; i<X_n_elem; ++i)
247 r_mean = r_mean + (X[i] - r_mean)/T(i+1);
255 template<
typename eT>
268 for(
uword i=0; i<X_n_elem; ++i)
270 r_mean = r_mean + (X[i] - r_mean)/T(i+1);
arma_inline arma_warn_unused eT * memptr()
returns a pointer to array of eTs used by the matrix
void set_size(const uword in_elem)
change the matrix to have user specified dimensions (data is not preserved)
const uword n_cols
number of columns in the matrix (read-only)
static eT direct_mean(const eT *const X, const uword N)
const uword n_rows
number of rows in the matrix (read-only)
#define arma_extra_debug_print
arma_aligned const T1 & m
storage of reference to the operand (eg. a matrix)
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 eT direct_mean_robust(const eT *const X, const uword N)
arma_inline arma_warn_unused eT & at(const uword i)
linear element accessor (treats the matrix as a vector); no bounds check.
#define arma_extra_debug_sigprint
static void apply(Mat< typename T1::elem_type > &out, const Op< T1, op_mean > &in)
For each row or for each column, find the mean value. The result is stored in a dense matrix that has...
Class for storing data required to extract and set the diagonals of a matrix.
arma_hot static arma_pure eT accumulate(const eT *src, const uword n_elem)
arma_aligned uword aux_uword_a
storage of auxiliary data, uword format
arma_inline bool arma_isfinite(eT val)