|
| template<typename Output_ = double, typename Value_ , typename Index_ > |
| Output_ | direct (const Value_ *ptr, Index_ num, bool skip_nan) |
| |
| template<typename Value_ , typename Index_ , typename Output_ > |
| void | apply (bool row, const tatami::Matrix< Value_, Index_ > &mat, Output_ *output, const Options &sopt) |
| |
| template<typename Output_ = double, typename Value_ , typename Index_ > |
| std::vector< Output_ > | by_column (const tatami::Matrix< Value_, Index_ > &mat, const Options &sopt) |
| |
| template<typename Output_ = double, typename Value_ , typename Index_ > |
| std::vector< Output_ > | by_row (const tatami::Matrix< Value_, Index_ > &mat, const Options &sopt) |
| |
Functions for computing dimension-wise sums.
template<typename Value_ , typename Index_ , typename Output_ >
| void tatami_stats::sums::apply |
( |
bool | row, |
|
|
const tatami::Matrix< Value_, Index_ > & | mat, |
|
|
Output_ * | output, |
|
|
const Options & | sopt ) |
Compute sums for each element of a chosen dimension of a tatami::Matrix. This is done using direct(), RunningDense or RunningSparse, depending on the requested dimension in row and the preferred dimension for access in p. Note that all sums are obtained using naive accumulation, so it is best to use a sufficiently high-precision Output_ to mitigate round-off errors.
- Template Parameters
-
| Value_ | Type of the matrix value, should be numeric. |
| Index_ | Type of the row/column indices. |
| Output_ | Type of the output value. |
- Parameters
-
| row | Whether to compute the sum for each row. If false, the sum is computed for each column instead. |
| mat | Instance of a tatami::Matrix. |
| [out] | output | Pointer to an array of length equal to the number of rows (if row = true) or columns (otherwise). On output, this will contain the row/column variances. |
| sopt | Summation options. |