55 xs.push_back((*iter).first);
56 ys.push_back((*iter).second);
90 if (ratio > 1. || ratio < 0.) {
91 throw Elements::Exception(
"Cumulative::findValue : ratio parameter must be in range [0,1]");
131 throw Elements::Exception(
"Cumulative::findMinInterval : rate parameter must be in range ]0,1]");
167 throw Elements::Exception(
"Cumulative::findCenteredInterval : rate parameter must be in range ]0,1]");
Class for build cumulative from PDF and extract feature out of it.
Cumulative(Cumulative &&other)=default
move constructor
TrayPosition
when looking for the position having a given value, one may encounter tray where the value is constan...
std::vector< double > m_x_sampling
std::pair< double, double > findCenteredInterval(double rate) const
return the horizontal interval starting where the Cumulative has value (1-ratio)/2 and ending where t...
std::vector< double > m_y_sampling
void normalize()
Normalize the Cumulative. After calling this function the last vertical value is 1....
double findValue(double ratio, TrayPosition position=TrayPosition::middle) const
Find the first horizontal sample which vertical value is bigger or equal to the ratio value....
std::pair< double, double > findMinInterval(double rate) const
Scan the horizontal axis looking for the smallest x-interval for which the vertical interval is at le...
static Cumulative fromPdf(std::vector< double > &x_sampling, std::vector< double > &pdf_sampling)
Factory from the sampling of a PDF. The Cumulative vertical samples are build as the sum of the the p...
double eval(double x_value) const
return the value of the cumulative at a given value of the horizontal axis. If the value do not match...
This module provides an interface for accessing two dimensional datasets (pairs of (X,...
ELEMENTS_API std::unique_ptr< Function > interpolate(const std::vector< double > &x, const std::vector< double > &y, InterpolationType type, bool extrapolate=false)
std::array< std::vector< double >, N > Coordinates
Used to pass the grid coordinates to interpn. Internally will make a copy of the required values.