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

Compute statistics from a tatami::Matrix while skipping NaNs. More...

Classes

struct  GroupRssBuffers
 Result buffers for skip_nan::group_rss(). More...
 
struct  GroupRssOptions
 Options for skip_nan::group_rss(). More...
 
struct  GroupRssResult
 Results of skip_nan::group_rss(). More...
 
struct  RangeBuffers
 Result buffers for skip_nan::range(). More...
 
struct  RangeOptions
 Options for range(). More...
 
struct  RangeResult
 Results of skip_nan::range(). More...
 
struct  RssBuffers
 Result buffers for skip_nan::rss(). More...
 
struct  RssOptions
 Options for skip_nan::rss(). More...
 
struct  RssResult
 Results of skip_nan::rss(). More...
 

Functions

template<typename Value_ , typename Index_ , typename Group_ , typename Output_ , typename Count_ >
void group_rss (bool row, const tatami::Matrix< Value_, Index_ > &mat, const Group_ *const group, const Group_ num_groups, const GroupRssBuffers< Output_, Count_ > &output, const GroupRssOptions< Output_ > &opt)
 
template<typename Output_ , typename Count_ , typename Value_ , typename Index_ , typename Group_ >
GroupRssResult< Output_, Count_ > group_rss (bool row, const tatami::Matrix< Value_, Index_ > &mat, const Group_ *const group, const Group_ num_groups, const GroupRssOptions< Output_ > &opt)
 
template<typename Output_ >
constexpr Output_ default_minimum_placeholder ()
 
template<typename Output_ >
constexpr Output_ default_maximum_placeholder ()
 
template<typename Value_ , typename Index_ , typename Output_ , typename Count_ >
void range (bool row, const tatami::Matrix< Value_, Index_ > &mat, RangeBuffers< Output_, Count_ > &output, const RangeOptions< Output_ > &opt)
 
template<typename Value_ , typename Index_ , typename Output_ = Value_, typename Count_ = Index_>
RangeResult< Output_, Count_ > range (bool row, const tatami::Matrix< Value_, Index_ > &mat, const RangeOptions< Output_ > &opt)
 
template<typename Value_ , typename Index_ , typename Output_ , typename Count_ >
void rss (bool row, const tatami::Matrix< Value_, Index_ > &mat, RssBuffers< Output_, Count_ > &output, const RssOptions< Output_ > &opt)
 
template<typename Output_ = double, typename Count_ , typename Value_ , typename Index_ >
RssResult< Output_, Count_ > rss (bool row, const tatami::Matrix< Value_, Index_ > &mat, const RssOptions< Output_ > &opt)
 

Detailed Description

Compute statistics from a tatami::Matrix while skipping NaNs.

Function Documentation

◆ group_rss() [1/2]

template<typename Value_ , typename Index_ , typename Group_ , typename Output_ , typename Count_ >
void tatami_stats::skip_nan::group_rss ( bool row,
const tatami::Matrix< Value_, Index_ > & mat,
const Group_ *const group,
const Group_ num_groups,
const GroupRssBuffers< Output_, Count_ > & output,
const GroupRssOptions< Output_ > & opt )

Compute per-group variances for each element of a chosen dimension of a tatami::Matrix.

Template Parameters
Value_Numeric type of the matrix value.
Index_Integer type of the row/column indices.
Group_Integer type of the group assignments for each row/column.
Output_Floating-point type of the output value.
Count_Numeric type of the non-NaN counts. This is typically an integer type.
Parameters
rowWhether to compute variances for the rows.
matInstance of a tatami::Matrix.
[in]groupPointer to an array of length equal to the number of columns (if row = true) or rows (otherwise). Each value should be an integer that specifies the group assignment. Values should lie in \([0, N)\) where \(N\) is the number of unique groups.
num_groupsNumber of groups, i.e., \(N\).
[out]outputBuffers in which to store the results. On output, each array stores the means and variances of the corresponding group.
optFurther options.

◆ group_rss() [2/2]

template<typename Output_ , typename Count_ , typename Value_ , typename Index_ , typename Group_ >
GroupRssResult< Output_, Count_ > tatami_stats::skip_nan::group_rss ( bool row,
const tatami::Matrix< Value_, Index_ > & mat,
const Group_ *const group,
const Group_ num_groups,
const GroupRssOptions< Output_ > & opt )

Compute per-group variances for each element of a chosen dimension of a tatami::Matrix.

Template Parameters
Output_Floating-point type of the output value.
Count_Numeric type of the non-NaN counts. This is typically an integer type.
Value_Numeric type of the matrix value.
Index_Integer type of the row/column indices.
Group_Integer type of the group assignments for each row/column.
Parameters
rowWhether to compute variances for the rows.
matInstance of a tatami::Matrix.
[in]groupPointer to an array of length equal to the number of columns (if row = true) or rows (otherwise). Each value should be an integer that specifies the group assignment. Values should lie in \([0, N)\) where \(N\) is the number of unique groups.
num_groupsNumber of groups, i.e., \(N\).
optFurther options.
Returns
RSS and mean of each group for each row/column.

◆ default_minimum_placeholder()

template<typename Output_ >
Output_ tatami_stats::skip_nan::default_minimum_placeholder ( )
constexpr
Template Parameters
Output_Numeric type of the output of skip_nan::range().
Returns
Default placeholder value for the minimum in the output of skip_nan::range(). This is positive infinity if supported by Output_, otherwise it is the largest finite value.

◆ default_maximum_placeholder()

template<typename Output_ >
Output_ tatami_stats::skip_nan::default_maximum_placeholder ( )
constexpr
Template Parameters
Output_Numeric type of the output of skip_nan::range().
Returns
Default placeholder value for the maximum in the output of skip_nan::range(). This is negative infinity if supported by Output_, otherwise it is the smallest finite value.

◆ range() [1/2]

template<typename Value_ , typename Index_ , typename Output_ , typename Count_ >
void tatami_stats::skip_nan::range ( bool row,
const tatami::Matrix< Value_, Index_ > & mat,
RangeBuffers< Output_, Count_ > & output,
const RangeOptions< Output_ > & opt )

Compute ranges for each element of a chosen dimension of a tatami::Matrix, after skipping any NaNs.

Template Parameters
Value_Numeric type of the input data.
Index_Integer type of the row/column indices.
Output_Numeric type of the output data. It is assumed that this is large enough to store the maxima/minima.
Count_Numeric type of the non-NaN counts. This is typically an integer type.
Parameters
rowWhether to compute the range for each row. If false, the range is computed for each column instead.
matInstance of a tatami::Matrix.
[out]outputBuffers to output arrays. On output, this will contain the row/column variances.
optFurther options.

◆ range() [2/2]

template<typename Value_ , typename Index_ , typename Output_ = Value_, typename Count_ = Index_>
RangeResult< Output_, Count_ > tatami_stats::skip_nan::range ( bool row,
const tatami::Matrix< Value_, Index_ > & mat,
const RangeOptions< Output_ > & opt )

Overload of skip_nan::range() that allocates memory for the minimum/maximum.

Template Parameters
Value_Numeric type of the input data.
Index_Integer type of the row/column indices.
Output_Numeric type of the output data. It is assumed that this is large enough to store the maxima/minima.
Parameters
rowWhether to compute the range for each row. If false, the range is computed for each column instead.
matInstance of a tatami::Matrix.
optFurther options.
Returns
Minimum and maximum for each row/column.

◆ rss() [1/2]

template<typename Value_ , typename Index_ , typename Output_ , typename Count_ >
void tatami_stats::skip_nan::rss ( bool row,
const tatami::Matrix< Value_, Index_ > & mat,
RssBuffers< Output_, Count_ > & output,
const RssOptions< Output_ > & opt )

Compute residual sums of squares (RSS) for each element of a chosen dimension of a tatami::Matrix, after skipping any NaNs. This may use either Welford's method or the standard two-pass method, depending on the dimension in row and the preferred access dimension of p.

Template Parameters
Value_Numeric type of the input data.
Index_Integer type of the row/column indices.
Output_Floating-point type of the output data.
Count_Numeric type of the non-NaN counts. This is typically an integer type.
Parameters
rowWhether to compute the RSS for each row. If false, the RSS is computed for each column instead.
matInstance of a tatami::Matrix.
[out]outputBuffers to output arrays. On output, this will contain the row/column RSSs.
optFurther options.

◆ rss() [2/2]

template<typename Output_ = double, typename Count_ , typename Value_ , typename Index_ >
RssResult< Output_, Count_ > tatami_stats::skip_nan::rss ( bool row,
const tatami::Matrix< Value_, Index_ > & mat,
const RssOptions< Output_ > & opt )

Overload of skip_nan::rss() that allocates memory for the output arrays.

Template Parameters
Output_Floating-point type of the output data.
Count_Numeric type of the non-NaN counts. This is typically an integer type.
Value_Numeric type of the input data.
Index_Integer type of the row/column indices.
Parameters
rowWhether to compute the RSS for each row. If false, the RSS is computed for each column instead.
matInstance of a tatami::Matrix.
optFurther options.
Returns
The mean and RSS of each row/column.