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

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

Classes

struct  Options
 Quantile calculation options. More...
 

Functions

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

Detailed Description

Functions for computing dimension-wise quantiles.

Function Documentation

◆ apply()

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

Compute quantiles 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 quantile for each row. If false, the quantile is computed for each column instead.
matInstance of a tatami::Matrix.
quantileProbability of the quantile to compute. This should be in \([0, 1]\).
[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 quantiles.
qoptQuantile calculation options.

◆ by_column()

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

Wrapper around apply() for column quantiles.

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.
quantileProbability of the quantile to compute. This should be in \([0, 1]\).
qoptQuantile calculation options.
Returns
A vector of length equal to the number of columns, containing the column quantiles.

◆ by_row()

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

Wrapper around apply() for row quantiles.

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.
quantileProbability of the quantile to compute. This should be in \([0, 1]\).
qoptQuantile calculation options.
Returns
A vector of length equal to the number of rows, containing the row quantiles.