Calculate a single quantile from a fixed number of elements.
More...
#include <SingleQuantile.hpp>
|
| | SingleQuantileFixedNumber (const std::size_t num_total, const Output_ quantile) |
| |
| std::size_t | get_num_total () const |
| |
| template<typename Input_ > |
| Output_ | operator() (Input_ *const ptr) const |
| |
| template<typename Input_ > |
| Output_ | operator() (const std::size_t num_non_zero, Input_ *const ptr) const |
| |
template<typename Output_ = double>
class quickstats::SingleQuantileFixedNumber< Output_ >
Calculate a single quantile from a fixed number of elements.
- Template Parameters
-
| Output_ | Floating-point type of the output quantile. |
A SingleQuantileFixedNumber instance computes a type 7 quantile, consistent with the default in R's quantile function.
◆ SingleQuantileFixedNumber()
template<typename Output_ = double>
- Parameters
-
| num_total | Total number of elements from which to compute a quantile. This should be positive. |
| quantile | Probability of the quantile to compute, in \([0, 1]\). |
◆ get_num_total()
template<typename Output_ = double>
- Returns
- Total number of elements, as specified in the
num_total argument of the constructor.
◆ operator()() [1/2]
template<typename Output_ = double>
template<typename Input_ >
Compute the quantile of interest from a dense array.
No consideration is given to special values like NaNs in the dense array. If these are to be skipped, consider using skip_values() before calling this method.
- Template Parameters
-
| Input_ | Numeric type of the input values. |
- Parameters
-
| [in] | ptr | Pointer to the start of an array of length num_total. This should not contain any NaN values. On output, the elements may be reordered. |
- Returns
- Quantile of the specified probability.
◆ operator()() [2/2]
template<typename Output_ = double>
template<typename Input_ >
Overload to compute the desired quantile from a sparse vector of length num_total. This vector should have num_non_zero structural non-zeros and num_total - num_non_zero structural zeros.
No consideration is given to special values like NaNs in the structural non-zeros. If these are to be skipped, consider using skip_values() before calling this method.
- Template Parameters
-
| Input_ | Numeric type of the input values. |
- Parameters
-
| num_non_zero | Number of structural non-zeros in the sparse vector. This should be no greater than num_total. |
| [in] | ptr | Pointer to the start of an array of length num_non_zero, containing the values of the structural non-zeros of the sparse vector. It should not contain any NaN values. On output, the elements may be reordered. |
- Returns
- Quantile of the specified probability.
The documentation for this class was generated from the following file: