Lens AI Profiler Cpp
|
#include <quantiles_sorted_view.hpp>
Classes | |
class | const_iterator |
Public Types | |
using | Entry = typename std::conditional< std::is_arithmetic< T >::value, std::pair< T, uint64_t >, std::pair< const T *, uint64_t > >::type |
Entry type. | |
using | AllocEntry = typename std::allocator_traits< Allocator >::template rebind_alloc< Entry > |
using | Container = std::vector< Entry, AllocEntry > |
using | quantile_return_type = typename std::conditional< std::is_arithmetic< T >::value, T, const T & >::type |
using | vector_double = std::vector< double, typename std::allocator_traits< Allocator >::template rebind_alloc< double > > |
Public Member Functions | |
const_iterator | begin () const |
const_iterator | end () const |
size_t | size () const |
double | get_rank (const T &item, bool inclusive=true) const |
quantile_return_type | get_quantile (double rank, bool inclusive=true) const |
vector_double | get_CDF (const T *split_points, uint32_t size, bool inclusive=true) const |
vector_double | get_PMF (const T *split_points, uint32_t size, bool inclusive=true) const |
Sorted view for quantiles sketches (REQ, KLL and Quantiles)
using datasketches::quantiles_sorted_view< T, Comparator, Allocator >::quantile_return_type = typename std::conditional<std::is_arithmetic<T>::value, T, const T&>::type |
Quantile return type. This is to return quantiles either by value (for arithmetic types) or by const reference (for all other types)
auto datasketches::quantiles_sorted_view< T, C, A >::begin |
Iterator pointing to the first entry in the view. If the view is empty, the returned iterator must not be dereferenced or incremented.
auto datasketches::quantiles_sorted_view< T, C, A >::end |
Iterator pointing to the past-the-end entry in the view. The past-the-end entry is the hypothetical entry that would follow the last entry. It does not point to any entry, and must not be dereferenced or incremented.
auto datasketches::quantiles_sorted_view< T, C, A >::get_CDF | ( | const T * | split_points, |
uint32_t | size, | ||
bool | inclusive = true |
||
) | const |
Returns an approximation to the Cumulative Distribution Function (CDF), which is the cumulative analog of the PMF, of the input stream given a set of split points (items).
If the view is empty this throws std::runtime_error.
split_points | an array of m unique, monotonically increasing items that divide the input domain into m+1 consecutive disjoint intervals. |
size | the number of split points in the array |
inclusive | if true the rank of an item includes its own weight, and therefore if the sketch contains items equal to a slit point, then in CDF such items are included into the interval to the left of split point. Otherwise they are included into the interval to the right of split point. |
auto datasketches::quantiles_sorted_view< T, C, A >::get_PMF | ( | const T * | split_points, |
uint32_t | size, | ||
bool | inclusive = true |
||
) | const |
Returns an approximation to the Probability Mass Function (PMF) of the input stream given a set of split points (items).
If the view is empty this throws std::runtime_error.
split_points | an array of m unique, monotonically increasing items that divide the input domain into m+1 consecutive disjoint intervals (bins). |
size | the number of split points in the array |
inclusive | if true the rank of an item includes its own weight, and therefore if the sketch contains items equal to a slit point, then in PMF such items are included into the interval to the left of split point. Otherwise they are included into the interval to the right of split point. |
auto datasketches::quantiles_sorted_view< T, C, A >::get_quantile | ( | double | rank, |
bool | inclusive = true |
||
) | const |
Returns an item from the sketch that is the best approximation to an item from the original stream with the given normalized rank.
If the view is empty this throws std::runtime_error.
rank | of an item in the hypothetical sorted stream. |
inclusive | if true, the given rank is considered inclusive (includes weight of an item) |
double datasketches::quantiles_sorted_view< T, C, A >::get_rank | ( | const T & | item, |
bool | inclusive = true |
||
) | const |
Returns an approximation to the normalized rank of the given item.
If the view is empty this throws std::runtime_error.
item | to be ranked |
inclusive | if true the weight of the given item is included into the rank. Otherwise the rank equals the sum of the weights of all items that are less than the given item according to the Comparator. |
size_t datasketches::quantiles_sorted_view< T, C, A >::size |