|
Alexandria
2.27.0
SDC-CH common library for the Euclid project
|
#include <InverseCumulative.h>
Public Member Functions | |
| InverseCumulative (std::vector< TKnot > knots, std::vector< double > pdf) | |
| TKnot | operator() (double p) const |
Model an inverse cumulative, used to sample a value given a PDF
| TKnot | Knot type, may be discrete or continuous |
| E | Used by the discrete and continuous specializations. |
The PDF is linearly interpolated. This implies that the CDF is computed deriving analytically each segment into a quadratic function.
Definition at line 39 of file InverseCumulative.h.
| Euclid::MathUtils::InverseCumulative< TKnot, E >::InverseCumulative | ( | std::vector< TKnot > | knots, |
| std::vector< double > | |||
| ) |
Constructor
| knots | PDF knots. For continuous distributions, they must be in order. Discrete distributions do not need to be sorted. |
| Distribution PDF |
| TKnot Euclid::MathUtils::InverseCumulative< TKnot, E >::operator() | ( | double | p | ) | const |
Return the first value where the CDF has a value >= p For continuous distributions each segment of the PDF is assumed to be linearly interpolated, so the integral of the PDF is used to interpolate the knot value.
1.8.5