tatami_stats
Matrix statistics for tatami
Loading...
Searching...
No Matches
Namespaces | Functions
tatami_stats::counts Namespace Reference

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

Namespaces

namespace  nan
 Functions for counting NaNs on each dimension.
 
namespace  zero
 Functions for counting zeros on each dimension.
 

Functions

template<typename Value_ , typename Index_ , typename Output_ , class Condition_ >
void apply (bool row, const tatami::Matrix< Value_, Index_ > *p, Output_ *output, int num_threads, Condition_ condition)
 

Detailed Description

Functions for computing dimension-wise counts.

Function Documentation

◆ apply()

template<typename Value_ , typename Index_ , typename Output_ , class Condition_ >
void tatami_stats::counts::apply ( bool  row,
const tatami::Matrix< Value_, Index_ > *  p,
Output_ *  output,
int  num_threads,
Condition_  condition 
)

Count the number of values that satisfy the condition in each element of a chosen dimension.

Template Parameters
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 at least large enough to hold the dimensions of p.
Parameters
rowWhether to perform the count within each row. If false, the count is performed within each column instead.
pPointer to 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 variances.
num_threadsNumber of threads to use, for parallelization via tatami::parallelize().
conditionFunction that accepts a Value_ and returns a boolean. This function is also responsible for handling any NaNs that might be present in p.