27 std::vector<std::pair<Real,Real> >::const_iterator it;
43 "sample number <=1, unsufficient");
57 "sample number <=2, unsufficient");
72 "sample number <=3, unsufficient");
82 Real c1 = (N/(N-1.0)) * (N/(N-2.0)) * ((N+1.0)/(N-3.0));
83 Real c2 = 3.0 * ((N-1.0)/(N-2.0)) * ((N-1.0)/(N-3.0));
85 return c1*(X/(sigma2*sigma2))-c2;
91 "percentile (" << percent <<
") must be in (0.0, 1.0]");
99 std::vector<std::pair<Real,Real> >::iterator k, l;
104 Real integral = k->second, target = percent*sampleWeight;
105 while (integral < target && k != l) {
107 integral += k->second;
115 "percentile (" << percent <<
") must be in (0.0, 1.0]");
123 std::vector<std::pair<Real,Real> >::reverse_iterator k, l;
128 Real integral = k->second, target = percent*sampleWeight;
129 while (integral < target && k != l) {
131 integral += k->second;
Size samples() const
number of samples collected
Real weightSum() const
sum of data weights
std::vector< std::pair< Real, Real > > samples_
Real percentile(Real y) const
std::pair< Real, Size > expectationValue(const Func &f, const Predicate &inRange) const
Real standardDeviation() const
void sort() const
sort the data set in increasing order
Real topPercentile(Real y) const
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
std::size_t Size
size of a container