Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Euclid::MathUtils::InverseCumulative< TKnot, E > Class Template Reference

#include <InverseCumulative.h>

Public Member Functions

 InverseCumulative (std::vector< TKnot > knots, std::vector< double > pdf)
 
TKnot operator() (double p) const
 

Detailed Description

template<typename TKnot, typename E = void>
class Euclid::MathUtils::InverseCumulative< TKnot, E >

Model an inverse cumulative, used to sample a value given a PDF

Template Parameters
TKnotKnot type, may be discrete or continuous
EUsed 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.

Constructor & Destructor Documentation

◆ InverseCumulative()

template<typename TKnot , typename E = void>
Euclid::MathUtils::InverseCumulative< TKnot, E >::InverseCumulative ( std::vector< TKnot knots,
std::vector< double pdf 
)

Constructor

Parameters
knotsPDF knots. For continuous distributions, they must be in order. Discrete distributions do not need to be sorted.
pdfDistribution PDF

Member Function Documentation

◆ operator()()

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.


The documentation for this class was generated from the following file: