tatami_stats
Matrix statistics for tatami
|
Functions for computing dimension-wise medians. More...
Classes | |
struct | Options |
Median calculation options. More... | |
Functions | |
template<typename Output_ = double, typename Value_ , typename Index_ > | |
Output_ | direct (Value_ *ptr, Index_ num, bool skip_nan) |
template<typename Output_ = double, typename Value_ , typename Index_ > | |
Output_ | direct (Value_ *value, Index_ num_nonzero, Index_ num_all, bool skip_nan) |
template<typename Value_ , typename Index_ , typename Output_ > | |
void | apply (bool row, const tatami::Matrix< Value_, Index_ > *p, Output_ *output, const medians::Options &mopt) |
template<typename Output_ = double, typename Value_ , typename Index_ > | |
std::vector< Output_ > | by_column (const tatami::Matrix< Value_, Index_ > *p, const Options &mopt) |
template<typename Output_ = double, typename Value_ , typename Index_ > | |
std::vector< Output_ > | by_column (const tatami::Matrix< Value_, Index_ > *p) |
template<typename Output_ = double, typename Value_ , typename Index_ > | |
std::vector< Output_ > | by_row (const tatami::Matrix< Value_, Index_ > *p, const Options &mopt) |
template<typename Output_ = double, typename Value_ , typename Index_ > | |
std::vector< Output_ > | by_row (const tatami::Matrix< Value_, Index_ > *p) |
Functions for computing dimension-wise medians.
Output_ tatami_stats::medians::direct | ( | Value_ * | ptr, |
Index_ | num, | ||
bool | skip_nan | ||
) |
Directly compute the median from a dense objective vector.
[in] | ptr | Pointer to an array of length num , containing the values of the objective vector. This may be modified on output. |
num | Length of the objective vector, i.e., length of the array at ptr . | |
skip_nan | See Options::skip_nan for details. |
Output_ | Type of the output value. This should be floating-point to store potential averages. |
Value_ | Type of the input values. |
Index_ | Type of the row/column indices. |
[ptr, ptr + n)
. Output_ tatami_stats::medians::direct | ( | Value_ * | value, |
Index_ | num_nonzero, | ||
Index_ | num_all, | ||
bool | skip_nan | ||
) |
Directly compute the median from a sparse objective vector.
[in] | value | Pointer to an array of length num_nonzero , containing values of the structural non-zeroes. This may be modified on output. |
num_nonzero | Number of structural non-zeros in the objective vector. | |
num_all | Length of the obejctive vector, including the structural zeros, i.e., num_all - num_nonzero is the number of zeros. | |
skip_nan | See Options::skip_nan for details. |
Output_ | Type of the output value. This should be floating-point to store potential averages. |
Value_ | Type of the input values. |
Index_ | Type of the row/column indices. |
void tatami_stats::medians::apply | ( | bool | row, |
const tatami::Matrix< Value_, Index_ > * | p, | ||
Output_ * | output, | ||
const medians::Options & | mopt | ||
) |
Compute medians for each element of a chosen dimension of a tatami::Matrix
.
Value_ | Type of the matrix value, should be numeric. |
Index_ | Type of the row/column indices. |
Output_ | Type of the output value. This should be floating-point to store potential averages. |
row | Whether to compute the median for each row. If false, the median is computed for each column instead. | |
p | Pointer to 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 medians. |
mopt | Median calculation options. |
std::vector< Output_ > tatami_stats::medians::by_column | ( | const tatami::Matrix< Value_, Index_ > * | p, |
const Options & | mopt | ||
) |
Wrapper around apply()
for column medians.
Output_ | Type of the output. This should be floating-point to store potential averages. |
Value_ | Type of the matrix value. |
Index_ | Type of the row/column indices. |
p | Pointer to a tatami::Matrix . |
mopt | Median calculation options. |
std::vector< Output_ > tatami_stats::medians::by_column | ( | const tatami::Matrix< Value_, Index_ > * | p | ) |
Overload with default options.
Output_ | Type of the output. This should be floating-point to store potential averages. |
Value_ | Type of the matrix value. |
Index_ | Type of the row/column indices. |
p | Pointer to a tatami::Matrix . |
std::vector< Output_ > tatami_stats::medians::by_row | ( | const tatami::Matrix< Value_, Index_ > * | p, |
const Options & | mopt | ||
) |
Wrapper around apply()
for row medians.
Output_ | Type of the output. This should be floating-point to store potential averages. |
Value_ | Type of the matrix value. |
Index_ | Type of the row/column indices. |
p | Pointer to a tatami::Matrix . |
mopt | Median calculation options. |
std::vector< Output_ > tatami_stats::medians::by_row | ( | const tatami::Matrix< Value_, Index_ > * | p | ) |
Overload with default options.
Output_ | Type of the output. This should be floating-point to store potential averages. |
Value_ | Type of the matrix value. |
Index_ | Type of the row/column indices. |
p | Pointer to a tatami::Matrix . |