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

Functions to compute statistics from a tatami::Matrix. More...

Namespaces

namespace  counts
 Functions for computing dimension-wise counts.
 
namespace  grouped_medians
 Functions for computing dimension-wise grouped medians.
 
namespace  grouped_sums
 Functions for computing dimension-wise grouped sums.
 
namespace  grouped_variances
 Functions for computing dimension-wise grouped variances.
 
namespace  medians
 Functions for computing dimension-wise medians.
 
namespace  ranges
 Functions for computing dimension-wise ranges.
 
namespace  sums
 Functions for computing dimension-wise sums.
 
namespace  variances
 Functions for computing dimension-wise variances.
 

Classes

class  LocalOutputBuffer
 Local output buffer for running calculations. More...
 

Functions

template<typename Group_ >
size_t total_groups (const Group_ *group, size_t n)
 
template<typename Group_ , typename Size_ >
std::vector< Size_ > tabulate_groups (const Group_ *group, Size_ n)
 

Detailed Description

Functions to compute statistics from a tatami::Matrix.

Function Documentation

◆ total_groups()

template<typename Group_ >
size_t tatami_stats::total_groups ( const Group_ *  group,
size_t  n 
)

Count the total number of groups, typically for per-group memory allocations.

Template Parameters
Group_Integer type for the group assignments.
Parameters
[in]groupPointer to an array of group assignments per observation. Each assignment should be an integer in \([0, G)\) where \(G\) is the total number of groups.
nNumber of observations, i.e., the length of the array referenced by group.
Returns
Total number of groups, i.e., \(G\). Note that not all groups may actually have non-zero occurrences in group.

◆ tabulate_groups()

template<typename Group_ , typename Size_ >
std::vector< Size_ > tatami_stats::tabulate_groups ( const Group_ *  group,
Size_  n 
)

Count the occurrences of each group.

Template Parameters
Group_Integer type for the group assignments.
Size_Integer type for the number of observations.
Parameters
[in]groupPointer to an array of group assignments per observation. Each assignment should be an integer in \([0, G)\) where \(G\) is the total number of groups.
nNumber of observations, i.e., the length of the array referenced by group.
Returns
Vector of length equal to \(G\), containing the number of occurrences of each group.