|
tatami_stats
Matrix statistics for tatami
|
Functions to compute statistics from a tatami::Matrix.
More...
Namespaces | |
| namespace | skip_nan |
Compute statistics from a tatami::Matrix while skipping NaNs. | |
Functions | |
| template<typename Value_ , typename Index_ , typename Output_ , class Condition_ > | |
| void | count (const bool row, const tatami::Matrix< Value_, Index_ > &mat, Output_ *const output, Condition_ condition, const CountOptions &opt) |
| template<typename Output_ , typename Value_ , typename Index_ , class Condition_ > | |
| std::vector< Output_ > | count (const bool row, const tatami::Matrix< Value_, Index_ > &mat, Condition_ condition, const CountOptions &opt) |
| template<typename Value_ , typename Index_ , typename Group_ , typename Output_ > | |
| void | group_median (bool row, const tatami::Matrix< Value_, Index_ > &mat, const Group_ *const group, const std::size_t num_groups, std::vector< Output_ * > &output, const GroupMedianOptions &opt) |
| template<typename Output_ = double, typename Value_ , typename Index_ , typename Group_ > | |
| std::vector< std::vector< Output_ > > | group_median (bool row, const tatami::Matrix< Value_, Index_ > &mat, const Group_ *const group, const std::size_t num_groups, const GroupMedianOptions &opt) |
| 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 std::size_t num_groups, GroupRssBuffers< Output_, Count_ > &output, const GroupRssOptions &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 std::size_t num_groups, const GroupRssOptions &opt) |
| template<typename Value_ , typename Index_ , typename Group_ , typename Output_ > | |
| void | group_sum (bool row, const tatami::Matrix< Value_, Index_ > &mat, const Group_ *group, const std::size_t num_groups, std::vector< Output_ * > &output, const GroupSumOptions &opt) |
| template<typename Output_ = double, typename Value_ , typename Index_ , typename Group_ > | |
| std::vector< std::vector< Output_ > > | group_sum (bool row, const tatami::Matrix< Value_, Index_ > &mat, const Group_ *group, const std::size_t num_groups, const GroupSumOptions &opt) |
| template<typename Value_ , typename Index_ , typename Group_ , typename Output_ > | |
| void | group_variance (bool row, const tatami::Matrix< Value_, Index_ > &mat, const Group_ *const group, const std::size_t num_groups, GroupVarianceBuffers< Output_ > &output, const GroupVarianceOptions &opt) |
| template<typename Output_ = double, typename Value_ , typename Index_ , typename Group_ > | |
| GroupVarianceResult< Output_ > | group_variance (bool row, const tatami::Matrix< Value_, Index_ > &mat, const Group_ *const group, const std::size_t num_groups, const GroupVarianceOptions &opt) |
| template<typename Value_ , typename Index_ , typename Output_ > | |
| void | median (const bool row, const tatami::Matrix< Value_, Index_ > &mat, Output_ *const output, const MedianOptions &opt) |
| template<typename Output_ = double, typename Value_ , typename Index_ > | |
| std::vector< Output_ > | median (const bool row, const tatami::Matrix< Value_, Index_ > &mat, const MedianOptions &opt) |
| template<typename Value_ , typename Index_ , typename Output_ > | |
| void | quantile (const bool row, const tatami::Matrix< Value_, Index_ > &mat, const double prob, Output_ *const output, const QuantileOptions &opt) |
| template<typename Output_ = double, typename Value_ , typename Index_ > | |
| std::vector< Output_ > | quantile (const bool row, const tatami::Matrix< Value_, Index_ > &mat, const double prob, const QuantileOptions &opt) |
| template<typename Value_ , typename Index_ , typename Output_ > | |
| void | range (bool row, const tatami::Matrix< Value_, Index_ > &mat, RangeBuffers< Output_ > &output, const RangeOptions &opt) |
| template<typename Value_ , typename Index_ , typename Output_ = Value_> | |
| RangeResult< Output_ > | range (bool row, const tatami::Matrix< Value_, Index_ > &mat, const RangeOptions &opt) |
| template<typename Value_ , typename Index_ , typename Output_ > | |
| void | rss (bool row, const tatami::Matrix< Value_, Index_ > &mat, RssBuffers< Output_ > &output, const RssOptions &opt) |
| template<typename Output_ = double, typename Value_ , typename Index_ > | |
| RssResult< Output_ > | rss (bool row, const tatami::Matrix< Value_, Index_ > &mat, const RssOptions &opt) |
| template<typename Value_ , typename Index_ , typename Output_ > | |
| void | sum (bool row, const tatami::Matrix< Value_, Index_ > &mat, Output_ *output, const SumOptions &opt) |
| template<typename Output_ = double, typename Value_ , typename Index_ > | |
| std::vector< Output_ > | sum (bool row, const tatami::Matrix< Value_, Index_ > &mat, const SumOptions &opt) |
| template<typename Value_ , typename Index_ , typename Output_ > | |
| void | variance (bool row, const tatami::Matrix< Value_, Index_ > &mat, VarianceBuffers< Output_ > &output, const VarianceOptions &opt) |
| template<typename Output_ = double, typename Value_ , typename Index_ > | |
| VarianceResult< Output_ > | variance (bool row, const tatami::Matrix< Value_, Index_ > &mat, const VarianceOptions &opt) |
Functions to compute statistics from a tatami::Matrix.
| void tatami_stats::count | ( | const bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| Output_ *const | output, | ||
| Condition_ | condition, | ||
| const CountOptions & | opt ) |
Count the number of values that satisfy the condition in each element of a chosen dimension.
| Value_ | Numeric type of the matrix value. |
| Index_ | Integer type of the row/column indices. |
| Output_ | Numeric type of the output count. To avoid overflow, we recommend using a type that is large enough to hold the dimension extents of mat. |
| Condition_ | Function that accepts a single Value_ and returns a bool. |
| row | Whether to perform the count within each row. If false, the count is performed within each column instead. | |
| mat | Instance of a tatami::Matrix. | |
| [out] | output | Pointer 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 counts. |
| condition | Function to indicate whether a value should be counted. This function is responsible for handling any NaNs that might be present in p. This function should be thread-safe. | |
| opt | Further options. |
| std::vector< Output_ > tatami_stats::count | ( | const bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| Condition_ | condition, | ||
| const CountOptions & | opt ) |
Overload of count() that allocates memory for the output vector.
| Output_ | Numeric type of the output count. To avoid overflow, we recommend using a type that is large enough to hold the dimension extents of mat. |
| Value_ | Numeric type of the matrix value. |
| Index_ | Integer type of the row/column indices. |
| Condition_ | Function that accepts a single Value_ and returns a bool. |
| row | Whether to perform the count within each row. If false, the count is performed within each column instead. |
| mat | Instance of a tatami::Matrix. |
| condition | Function to indicate whether a value should be counted. This function is also responsible for handling any NaNs that might be present in p. This function should be thread-safe. |
| opt | Further options. |
| void tatami_stats::group_median | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const Group_ *const | group, | ||
| const std::size_t | num_groups, | ||
| std::vector< Output_ * > & | output, | ||
| const GroupMedianOptions & | opt ) |
Compute per-group medians for each element of a chosen dimension of a tatami::Matrix.
| Value_ | Numeric type of the matrix value. |
| Index_ | Integer type of the row/column indices. |
| Group_ | Integer type of the group assignments for each column. |
| GroupSizes_ | Vector-like class that has size() and [ methods and contains integers. |
| Output_ | Floating-point type of the output value, capable of storing averages or NaNs. |
| row | Whether to compute group-wise medians within each row. If false, medians are computed in each column instead. | |
| mat | Instance of a tatami::Matrix. | |
| [in] | group | Pointer 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_groups | Number of groups, i.e., \(N\). | |
| [out] | output | Pointer to an array of pointers of length equal to the number of groups. Each inner pointer should reference an array of length equal to the number of rows (if row = true) or columns (otherwise). On output, this will contain the row/column medians for each group (indexed according to the assignment in group). |
| opt | Further options. |
| std::vector< std::vector< Output_ > > tatami_stats::group_median | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const Group_ *const | group, | ||
| const std::size_t | num_groups, | ||
| const GroupMedianOptions & | opt ) |
Overload of group_median() that allocates memory for the output medians.
| Output_ | Floating-point type of the output value, capable of storing averages or NaNs. |
| Value_ | Numeric type of the matrix value. |
| Index_ | Integer type of the row/column indices. |
| Group_ | Integer type of the group assignments for each column. |
| row | Whether to compute group-wise medians within each row. If false, medians are computed in each column instead. | |
| mat | Instance of a tatami::Matrix. | |
| [in] | group | Pointer 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_groups | Number of groups, i.e., \(N\). | |
| opt | Further options. |
row = true) or columns (otherwise), containing the row/column medians for the corresponding group. | void tatami_stats::group_rss | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const Group_ *const | group, | ||
| const std::size_t | num_groups, | ||
| GroupRssBuffers< Output_, Count_ > & | output, | ||
| const GroupRssOptions & | opt ) |
Compute per-group residual sums of squares (RSS) for each element of a chosen dimension of a tatami::Matrix.
| 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. This should be capable of storing NaNs. |
| Count_ | Numeric type of the group sizes, typically integer. |
| row | Whether to compute RSS values for the rows. | |
| mat | Instance of a tatami::Matrix. | |
| [in] | group | Pointer 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_groups | Number of groups, i.e., \(N\). | |
| [out] | output | Buffers in which to store the results. On output, each array stores the means and RSS values of the corresponding group. |
| opt | Further options. |
| GroupRssResult< Output_, Count_ > tatami_stats::group_rss | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const Group_ *const | group, | ||
| const std::size_t | num_groups, | ||
| const GroupRssOptions & | opt ) |
Compute per-group residual sums of squares (RSS) for each element of a chosen dimension of a tatami::Matrix.
| Output_ | Floating-point type of the output value. This should be capable of storing NaNs. |
| Count_ | Numeric type of the group sizes, typically integer. |
| 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. |
| row | Whether to compute RSS values for the rows. | |
| mat | Instance of a tatami::Matrix. | |
| [in] | group | Pointer 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_groups | Number of groups, i.e., \(N\). | |
| opt | Further options. |
| void tatami_stats::group_sum | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const Group_ * | group, | ||
| const std::size_t | num_groups, | ||
| std::vector< Output_ * > & | output, | ||
| const GroupSumOptions & | opt ) |
Compute per-group sums for each element of a chosen dimension of a tatami::Matrix.
| 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. |
| Output_ | Numeric type of the output value. It is assumed that this is large enough to store the sums. |
| row | Whether to compute group-wise sums within each row. If false, sums are computed within the column instead. | |
| mat | Instance of a tatami::Matrix. | |
| [in] | group | Pointer 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_groups | Number of groups, i.e., \(N\). This can be determined by calling tatami_stats::total_groups() on group. | |
| [out] | output | Vector of length equal to the number of groups. Each element is a pointer to an array of length equal to the number of rows (if row = true) or columns (otherwise). On output, each array will contain the row/column sums for the corresponding group. |
| opt | Further options. |
| std::vector< std::vector< Output_ > > tatami_stats::group_sum | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const Group_ * | group, | ||
| const std::size_t | num_groups, | ||
| const GroupSumOptions & | opt ) |
Overload of group_sum() that allocates memory for the output sums.
| Output_ | Numeric type of the output value. It is assumed that this is large enough to store the sums. |
| 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. |
| row | Whether to compute group-wise sums within each row. If false, sums are computed within the column instead. | |
| mat | Instance of a tatami::Matrix. | |
| [in] | group | Pointer 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_groups | Number of groups, i.e., \(N\). This can be determined by calling tatami_stats::total_groups() on group. | |
| opt | Further options. |
row = true) or columns (otherwise), containing the row/column sums for the corresponding group. | void tatami_stats::group_variance | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const Group_ *const | group, | ||
| const std::size_t | num_groups, | ||
| GroupVarianceBuffers< Output_ > & | output, | ||
| const GroupVarianceOptions & | opt ) |
Compute per-group variances for each element of a chosen dimension of a tatami::Matrix.
| 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. This should be capable of storing NaNs. |
| row | Whether to compute variances for the rows. | |
| mat | Instance of a tatami::Matrix. | |
| [in] | group | Pointer 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_groups | Number of groups, i.e., \(N\). | |
| [out] | output | Buffers in which to store the results. On output, each array stores the means and variances of the corresponding group. |
| opt | Further options. |
| GroupVarianceResult< Output_ > tatami_stats::group_variance | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const Group_ *const | group, | ||
| const std::size_t | num_groups, | ||
| const GroupVarianceOptions & | opt ) |
Compute per-group variances for each element of a chosen dimension of a tatami::Matrix.
| Output_ | Floating-point type of the output value. This should be capable of storing NaNs. |
| 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. |
| row | Whether to compute variances for the rows. | |
| mat | Instance of a tatami::Matrix. | |
| [in] | group | Pointer 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_groups | Number of groups, i.e., \(N\). | |
| opt | Further options. |
| void tatami_stats::median | ( | const bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| Output_ *const | output, | ||
| const MedianOptions & | opt ) |
Compute medians for each element of a chosen dimension of a tatami::Matrix.
| 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. |
| row | Whether to compute the median for each row. If false, the median is computed for each column instead. | |
| mat | Instance of a tatami::Matrix. | |
| [out] | output | Pointer 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 medians. |
| opt | Further options. |
| std::vector< Output_ > tatami_stats::median | ( | const bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const MedianOptions & | opt ) |
Overload of median() that allocates memory for the output medians.
| 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. |
| row | Whether to compute the median for each row. If false, the median is computed for each column instead. |
| mat | Instance of a tatami::Matrix. |
| opt | Further options. |
row = true) or columns (otherwise). On output, this will contain the row/column medians. | void tatami_stats::quantile | ( | const bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const double | prob, | ||
| Output_ *const | output, | ||
| const QuantileOptions & | opt ) |
Compute quantiles for each element of a chosen dimension of a tatami::Matrix.
| 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. |
| row | Whether to compute the quantile for each row. If false, the quantile is computed for each column instead. | |
| mat | Instance of a tatami::Matrix. | |
| prob | Probability of the quantile to compute. This should be in \([0, 1]\). | |
| [out] | output | Pointer 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. |
| opt | Further options. |
| std::vector< Output_ > tatami_stats::quantile | ( | const bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const double | prob, | ||
| const QuantileOptions & | opt ) |
Overload of quantile() that allocates memory for the output quantiles.
| 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. |
| row | Whether to compute the quantile for each row. If false, the quantile is computed for each column instead. |
| mat | Instance of a tatami::Matrix. |
| prob | Probability of the quantile to compute. This should be in \([0, 1]\). |
| opt | Further options. |
row = true) or columns (otherwise), containing the row/column quantiles. | void tatami_stats::range | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| RangeBuffers< Output_ > & | output, | ||
| const RangeOptions & | opt ) |
Compute ranges for each element of a chosen dimension of a tatami::Matrix.
| 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. |
| row | Whether to compute the range for each row. If false, the range is computed for each column instead. | |
| mat | Instance of a tatami::Matrix. | |
| [out] | output | Buffers to output arrays. On output, this will contain the row/column variances. |
| opt | Further options. |
| RangeResult< Output_ > tatami_stats::range | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const RangeOptions & | opt ) |
Overload of range() that allocates memory for the minimum/maximum.
| 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. |
| row | Whether to compute the range for each row. If false, the range is computed for each column instead. |
| mat | Instance of a tatami::Matrix. |
| opt | Further options. |
| void tatami_stats::rss | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| RssBuffers< Output_ > & | output, | ||
| const RssOptions & | opt ) |
Compute residual sums of squares (RSS) for each element of a chosen dimension of a tatami::Matrix. 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.
| Value_ | Numeric type of the input data. |
| Index_ | Integer type of the row/column indices. |
| Output_ | Floating-point type of the output data. This should be capable of storing NaNs. |
| row | Whether to compute the RSS for each row. If false, the RSS is computed for each column instead. | |
| mat | Instance of a tatami::Matrix. | |
| [out] | output | Buffers to output arrays. On output, this will contain the row/column RSSs. |
| opt | Further options. |
| RssResult< Output_ > tatami_stats::rss | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const RssOptions & | opt ) |
Overload of rss() that allocates memory for the output arrays.
| Output_ | Floating-point type of the output data. This should be capable of storing NaNs. |
| Value_ | Numeric type of the input data. |
| Index_ | Integer type of the row/column indices. |
| row | Whether to compute the RSS for each row. If false, the RSS is computed for each column instead. |
| mat | Instance of a tatami::Matrix. |
| opt | Further options. |
| void tatami_stats::sum | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| Output_ * | output, | ||
| const SumOptions & | opt ) |
Compute sums for each element of a chosen dimension of a tatami::Matrix. This may either use pairwise summation or direct accumulation, depending on the requested dimension in row, the preferred dimension for access in p and whether NaNs are to be skipped. It is best to use a sufficiently high-precision Output_ to mitigate round-off errors.
| Value_ | Numeric type of the matrix value. |
| Index_ | Integer type of the row/column indices. |
| Output_ | Numeric type of the output value. It is assumed that this is large enough to store the sums. |
| row | Whether to compute the sum for each row. If false, the sum is computed for each column instead. | |
| mat | Instance of a tatami::Matrix. | |
| [out] | output | Pointer 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 sums. |
| opt | Further options. |
| std::vector< Output_ > tatami_stats::sum | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const SumOptions & | opt ) |
Overload of sum() that allocates memory for the output sums.
| Output_ | Numeric type of the output value. It is assumed that this is large enough to store the sums. |
| Value_ | Numeric type of the matrix value. |
| Index_ | Integer type of the row/column indices. |
| row | Whether to compute the sum for each row. If false, the sum is computed for each column instead. |
| mat | Instance of a tatami::Matrix. |
| opt | Further options. |
row = true) or columns (otherwise), containing the row/column sums. | void tatami_stats::variance | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| VarianceBuffers< Output_ > & | output, | ||
| const VarianceOptions & | opt ) |
Compute sample variances for each element of a chosen dimension of a tatami::Matrix. 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.
| Value_ | Numeric type of the input data. |
| Index_ | Integer type of the row/column indices. |
| Output_ | Floating-point type of the output data. This should be capable of storing NaNs. |
| row | Whether to compute the variance for each row. If false, the variance is computed for each column instead. | |
| mat | Instance of a tatami::Matrix. | |
| [out] | output | Buffers to output arrays. On output, this will contain the row/column variances. |
| opt | Further options. |
| VarianceResult< Output_ > tatami_stats::variance | ( | bool | row, |
| const tatami::Matrix< Value_, Index_ > & | mat, | ||
| const VarianceOptions & | opt ) |
Overload of variance() that allocates memory for the output arrays.
| Output_ | Floating-point type of the output data. This should be capable of storing NaNs. |
| Value_ | Numeric type of the input data. |
| Index_ | Integer type of the row/column indices. |
| row | Whether to compute the variance for each row. If false, the variance is computed for each column instead. |
| mat | Instance of a tatami::Matrix. |
| opt | Further options. |