tatami_stats
Matrix statistics for tatami
Loading...
Searching...
No Matches
tatami_stats::medians Namespace Reference

Functions for computing dimension-wise medians. More...

Classes

struct  Options
 Median calculation options. More...
 

Functions

template<typename Value_ , typename Index_ , typename Output_ >
void apply (bool row, const tatami::Matrix< Value_, Index_ > &mat, Output_ *output, const medians::Options &mopt)
 
template<typename Output_ = double, typename Value_ , typename Index_ >
std::vector< Output_ > by_column (const tatami::Matrix< Value_, Index_ > &mat, const Options &mopt)
 
template<typename Output_ = double, typename Value_ , typename Index_ >
std::vector< Output_ > by_row (const tatami::Matrix< Value_, Index_ > &mat, const Options &mopt)
 

Detailed Description

Functions for computing dimension-wise medians.

Function Documentation

◆ apply()

template<typename Value_ , typename Index_ , typename Output_ >
void tatami_stats::medians::apply ( bool row,
const tatami::Matrix< Value_, Index_ > & mat,
Output_ * output,
const medians::Options & mopt )

Compute medians for each element of a chosen dimension of a tatami::Matrix.

Template Parameters
Value_Numeric type of the input values.
Index_Integer type of the row/column indices.
Output_Floating-point type of the output value. This should be capable of storing NaNs.
Parameters
rowWhether to compute the median for each row. If false, the median is computed for each column instead.
matInstance of a tatami::Matrix.
[out]outputPointer 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.
moptMedian calculation options.

◆ by_column()

template<typename Output_ = double, typename Value_ , typename Index_ >
std::vector< Output_ > tatami_stats::medians::by_column ( const tatami::Matrix< Value_, Index_ > & mat,
const Options & mopt )

Wrapper around apply() for column medians.

Template Parameters
Output_Floating-point type of the output value. This should be capable of storing NaNs.
Value_Numeric type of the input values.
Index_Integer type of the row/column indices.
Parameters
matInstance of a tatami::Matrix.
moptMedian calculation options.
Returns
A vector of length equal to the number of columns, containing the column medians.

◆ by_row()

template<typename Output_ = double, typename Value_ , typename Index_ >
std::vector< Output_ > tatami_stats::medians::by_row ( const tatami::Matrix< Value_, Index_ > & mat,
const Options & mopt )

Wrapper around apply() for row medians.

Template Parameters
Output_Floating-point type of the output value. This should be capable of storing NaNs.
Value_Numeric type of the input values.
Index_Integer type of the row/column indices.
Parameters
matInstance of a tatami::Matrix.
moptMedian calculation options.
Returns
A vector of length equal to the number of rows, containing the row medians.