npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0

#include <InterpolatedDistribution1D.hh>

Inheritance diagram for npstat::InterpolatedDistribution1D:
npstat::AbsInterpolatedDistribution1D npstat::AbsDistribution1D

Public Member Functions

 InterpolatedDistribution1D (unsigned expectedNDistros)
 
virtual InterpolatedDistribution1Dclone () const
 
void add (const AbsDistribution1D &d, double weight)
 
void replace (unsigned i, const AbsDistribution1D &d, double weight)
 
void setWeight (unsigned i, double weight)
 
void clear ()
 
void normalizeAutomatically (bool allow)
 
unsigned size () const
 
unsigned expectedSize () const
 
double density (double x) const
 
double cdf (double x) const
 
double exceedance (double x) const
 
double quantile (double x) const
 
void densityAndCdf (double x, double *pdensity, double *pcdf) const
 
virtual gs::ClassId classId () const
 
- Public Member Functions inherited from npstat::AbsDistribution1D
bool operator== (const AbsDistribution1D &r) const
 
bool operator!= (const AbsDistribution1D &r) const
 
virtual unsigned random (AbsRandomGenerator &g, double *generatedRandom) const
 
long double empiricalMoment (long double center, unsigned order, unsigned nIntegrationPoints=1024U, bool useFejerQuadrature=false) const
 
template<class Functor >
double expectation (const Functor &fcn, unsigned nIntegrationPoints=1024U, bool useFejerQuadrature=false) const
 
virtual bool write (std::ostream &) const
 

Static Public Member Functions

static const char * classname ()
 
static unsigned version ()
 
- Static Public Member Functions inherited from npstat::AbsDistribution1D
static const char * classname ()
 
static unsigned version ()
 
static AbsDistribution1Dread (const gs::ClassId &id, std::istream &)
 

Protected Member Functions

virtual bool isEqual (const AbsDistribution1D &) const
 

Detailed Description

1-d continuous statistical distribution which interpolates between other distributions by performing linear interpolation of the quantile function.

Note that the interpolated distributions must still exist while this object is in use (this class neither owns nor copies them).

Constructor & Destructor Documentation

◆ InterpolatedDistribution1D()

npstat::InterpolatedDistribution1D::InterpolatedDistribution1D ( unsigned  expectedNDistros)
explicit

It is expected that the object will be constructed incrementally: first, the constructor will be called using the expected number of distributions to use and then function "add" will be used to put the distributions and weights in. Use the default constructor if the number of distributions is not known in advance (the class will still operate as expected but the performance will take a hit).

Member Function Documentation

◆ add()

void npstat::InterpolatedDistribution1D::add ( const AbsDistribution1D d,
double  weight 
)
virtual

Add a new distribution. Note that the distribution will not be copied internally. Make sure that all added distributions still exist when you call methods "density", etc.

Implements npstat::AbsInterpolatedDistribution1D.

◆ cdf()

double npstat::InterpolatedDistribution1D::cdf ( double  x) const
virtual

Cumulative distribution function

Implements npstat::AbsDistribution1D.

◆ classId()

virtual gs::ClassId npstat::InterpolatedDistribution1D::classId ( ) const
inlinevirtual

Prototype needed for I/O

Implements npstat::AbsDistribution1D.

◆ clear()

void npstat::InterpolatedDistribution1D::clear ( )
virtual

Clear all distributions

Implements npstat::AbsInterpolatedDistribution1D.

◆ clone()

virtual InterpolatedDistribution1D* npstat::InterpolatedDistribution1D::clone ( ) const
inlinevirtual

"Virtual copy constructor"

Implements npstat::AbsInterpolatedDistribution1D.

◆ density()

double npstat::InterpolatedDistribution1D::density ( double  x) const
virtual

Probability density

Implements npstat::AbsDistribution1D.

◆ densityAndCdf()

void npstat::InterpolatedDistribution1D::densityAndCdf ( double  x,
double *  pdensity,
double *  pcdf 
) const

Return both density and cumulative distribution function. More efficient than obtaining these two results separately.

◆ exceedance()

double npstat::InterpolatedDistribution1D::exceedance ( double  x) const
virtual

1 - cdf, known as "survival function" or "exceedance". Implementations should avoid subtractive cancellation.

Implements npstat::AbsDistribution1D.

◆ expectedSize()

unsigned npstat::InterpolatedDistribution1D::expectedSize ( ) const
inlinevirtual

The number of distributions expected to participate in the interpolation

Implements npstat::AbsInterpolatedDistribution1D.

◆ isEqual()

virtual bool npstat::InterpolatedDistribution1D::isEqual ( const AbsDistribution1D ) const
protectedvirtual

Comparison for equality. To be implemented by derived classes.

Implements npstat::AbsDistribution1D.

◆ normalizeAutomatically()

void npstat::InterpolatedDistribution1D::normalizeAutomatically ( bool  allow)
virtual

The following function should be called to disable (and later enable) automatic weight normalization if you want to use the "setWeight" or "replace" methods many times and, especially, if at some point in this process the sum of the weights becomes zero. The "density" method can not be called if normalization is not enabled.

Implements npstat::AbsInterpolatedDistribution1D.

◆ quantile()

double npstat::InterpolatedDistribution1D::quantile ( double  x) const
virtual

The quantile function (inverse cdf)

Implements npstat::AbsDistribution1D.

◆ replace()

void npstat::InterpolatedDistribution1D::replace ( unsigned  i,
const AbsDistribution1D d,
double  weight 
)
virtual

Replace an existing distribution

Implements npstat::AbsInterpolatedDistribution1D.

◆ setWeight()

void npstat::InterpolatedDistribution1D::setWeight ( unsigned  i,
double  weight 
)
virtual

Modify the weight for an existing dostribution

Implements npstat::AbsInterpolatedDistribution1D.

◆ size()

unsigned npstat::InterpolatedDistribution1D::size ( ) const
inlinevirtual

The number of distributions participating in the interpolation

Implements npstat::AbsInterpolatedDistribution1D.


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