Functions to compute statistics from a tatami::Matrix
.
More...
|
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.
|
|
|
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) |
|
Functions to compute statistics from a tatami::Matrix
.
◆ 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] | group | Pointer 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. |
| n | Number 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] | group | Pointer 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. |
| n | Number 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.