yat
0.14.5pre
|
Functor to calculate percentile of a range. More...
#include <yat/statistics/Percentiler.h>
Public Member Functions | |
Percentiler (double perc=50, bool sorted=false) | |
template<typename RandomAccessIterator > | |
double | operator() (RandomAccessIterator first, RandomAccessIterator last) const |
Functor to calculate percentile of a range.
theplu::yat::statistics::Percentiler::Percentiler | ( | double | perc = 50 , |
bool | sorted = false |
||
) |
perc | percentile to calculate [0,100]. Default value is 50, which implies class will calculate median. |
sorted | if true class assumes that ranges are already sorted, if false the range will copied to a new range which is sorted. |
|
inline |
Function is a non-mutable function, i.e., first and last can be const_iterators.
The Nth percentile is defined such that, for example, when having four numbers , the Nth percentile is:
Similarily, if we have a weighted range , we calculate the accumulated normalized weight and the percentile is
Note, that data point with weight zero is completely ignored.
Type Requirements:
RandomAccessIterator
must be a Data IteratorRandomAccessIterator
must be a Random Access Traversal Iterator