template<typename Output_, class QuantilesPointer_>
class quickstats::MultipleQuantilesVariableNumber< Output_, QuantilesPointer_ >
Calculate multiple quantiles from a variable number of elements.
- Template Parameters
-
| Output_ | Floating-point type of the output quantile. |
| QuantilesPointer_ | Pointer to a container that has a size() method and supports access by []. This may or may not be a smart pointer. |
This uses the same logic as the MultipleQuantilesFixedNumber class but supports any number of elements, from zero up to a specified maximum.
template<typename Output_ , class QuantilesPointer_ >
template<typename Input_ , class OutputFun_ >
Compute multiple quantiles from a dense array of length equal to num_total.
No consideration is given to special values like NaNs in the array. If these are to be skipped, consider using skip_values() before calling this method.
This method is not thread-safe.
- Template Parameters
-
| Input_ | Numeric type of the input values. |
| OutputFun_ | Functor that accepts a std::size_t and an Output_. |
- Parameters
-
| num_total | Total number of the elements from which to compute the quantile. This should be no greater than max_num_total. |
| [in] | ptr | Pointer to an array of length num_total. On output, the elements may be reordered. |
| output | Function that accepts a std::size_t, the index of the probability in quantiles; and an Output_, the computed value of the quantile. This will be called once for each quantile, in order of increasing index from 0 to quantiles.size() - 1. The value of the quantile will be set to MultipleQuantilesVariableNumberOptions::placeholder if num_total == 0. |
template<typename Output_ , class QuantilesPointer_ >
template<typename Input_ , class OutputFun_ >
Overload to compute the desired quantile from a sparse vector of length num_total. This vector is assumed to have num_non_zero structural non-zeros and num_total - num_non_zero zeros.
No consideration is given to special values like NaNs in the values of the structural non-zeros. If these are to be skipped, consider using skip_values() before calling this method.
This method is not thread-safe.
- Template Parameters
-
| Input_ | Numeric type of the input values. |
| OutputFun_ | Functor that accepts a std::size_t and an Output_. |
- Parameters
-
| num_total | Total number of elements from which to compute the quantile. This should be no greater than max_num_total. |
| num_non_zero | Number of elements that are structural non-zero elements. This should be no greater than num_total. |
| [in] | values | Pointer to the start of an array of length num_non_zero. This is expected to contain the values of the structural non-zero elements of the sparse vector. It should not contain any NaN values. On output, the elements may be reordered. |
| output | Function that accepts a std::size_t, the index of the probability in quantiles; and an Output_, the computed value of the quantile. This will be called once for each quantile, in order of increasing index from 0 to quantiles.size() - 1. The value of the quantile will be set to MultipleQuantilesVariableNumberOptions::placeholder if num_total == 0. |