Honeycomb  0.1
Component-Model Framework
Public Member Functions | Protected Types | Protected Member Functions | List of all members
honey::RandomDist< Real > Class Template Reference

Base class for all random distributions. More...

#include <Dist.h>

Inheritance diagram for honey::RandomDist< Real >:
Inheritance graph
[legend]

Public Member Functions

 RandomDist (optional< RandomGen & > gen=optnull)
 Construct with a random generator to use for next() More...
 
virtual ~RandomDist ()
 
virtual Real next () const
 Get next randomly distributed variate. Requires a random generator (see ctor or setGen()) More...
 
virtual Real pdf (Real x) const
 Probability Density Function. More...
 
virtual Real cdf (Real x) const
 Cumulative Distribution Function. More...
 
virtual Real cdfComp (Real x) const
 Complement of the CDF. More...
 
virtual Real cdfInv (Real P) const
 Inverse of the CDF. More...
 
virtual Real mean () const
 Calc mean. More...
 
virtual Real variance () const
 Calc variance. More...
 
Real stdDev () const
 Calc standard deviation. More...
 
void setGen (RandomGen &gen)
 Set random generator to use for next() More...
 
RandomGengetGen () const
 Get random generator. More...
 

Protected Types

typedef Numeral< Real >::Real_ Real_
 
typedef Real_::DoubleType Double_
 
typedef Double_::Real Double
 
typedef Alge_< RealAlge
 
typedef Alge_< DoubleAlge_d
 
typedef Uniform_< DoubleUniform
 

Protected Member Functions

Real cdfInvFind (Real P, Real min, Real max, bool discrete=false) const
 Generic binary search algorithm to find Cdf. More...
 

Detailed Description

template<class Real>
class honey::RandomDist< Real >

Base class for all random distributions.

Member Typedef Documentation

template<class Real>
typedef Alge_<Real> honey::RandomDist< Real >::Alge
protected
template<class Real>
typedef Alge_<Double> honey::RandomDist< Real >::Alge_d
protected
template<class Real>
typedef Double_::Real honey::RandomDist< Real >::Double
protected
template<class Real>
typedef Real_::DoubleType honey::RandomDist< Real >::Double_
protected
template<class Real>
typedef Numeral<Real>::Real_ honey::RandomDist< Real >::Real_
protected
template<class Real>
typedef Uniform_<Double> honey::RandomDist< Real >::Uniform
protected

Constructor & Destructor Documentation

template<class Real>
honey::RandomDist< Real >::RandomDist ( optional< RandomGen & >  gen = optnull)
inline

Construct with a random generator to use for next()

template<class Real>
virtual honey::RandomDist< Real >::~RandomDist ( )
inlinevirtual

Member Function Documentation

template<class Real>
virtual Real honey::RandomDist< Real >::cdf ( Real  x) const
inlinevirtual

Cumulative Distribution Function.

The integral of the PDF from -inf to x.

Parameters
xvalue, range depends on distribution.
Return values
Pa probability in range [0,1] that a random variate will be <= x.

Reimplemented in honey::ChiSqr_< Real >, honey::StudentT_< Real >, honey::Beta_< Real >, honey::HyperGeo_< Real >, honey::Gamma_< Real >, honey::Poisson_< Real >, honey::BinomialNeg_< Real >, honey::DiscreteGen_< Real >, honey::Weibull_< Real >, honey::Binomial_< Real >, honey::Gaussian_< Real >, and honey::Uniform_< Real >.

template<class Real>
virtual Real honey::RandomDist< Real >::cdfComp ( Real  x) const
inlinevirtual

Complement of the CDF.

The integral of the PDF from x to inf.

Parameters
xvalue, range depends on distribution.
Return values
Qa probability in range [0,1] that a random variate will be > x.

Reimplemented in honey::StudentT_< Real >, honey::Gamma_< Real >, honey::Poisson_< Real >, and honey::Weibull_< Real >.

template<class Real>
virtual Real honey::RandomDist< Real >::cdfInv ( Real  P) const
inlinevirtual

Inverse of the CDF.

Parameters
Pcumulative probability
Return values
xA value that has probability P of being >= a random variate X. Also, x satisfies: cdf(x) = P.

Reimplemented in honey::ChiSqr_< Real >, honey::StudentT_< Real >, honey::Beta_< Real >, honey::Gamma_< Real >, honey::HyperGeo_< Real >, honey::Poisson_< Real >, honey::BinomialNeg_< Real >, honey::DiscreteGen_< Real >, honey::Weibull_< Real >, honey::Binomial_< Real >, honey::Gaussian_< Real >, and honey::Uniform_< Real >.

template<class Real>
Real honey::RandomDist< Real >::cdfInvFind ( Real  P,
Real  min,
Real  max,
bool  discrete = false 
) const
protected

Generic binary search algorithm to find Cdf.

template<class Real>
RandomGen& honey::RandomDist< Real >::getGen ( ) const
inline

Get random generator.

template<class Real>
virtual Real honey::RandomDist< Real >::mean ( ) const
inlinevirtual
template<class Real>
virtual Real honey::RandomDist< Real >::next ( ) const
inlinevirtual
template<class Real>
virtual Real honey::RandomDist< Real >::pdf ( Real  x) const
inlinevirtual

Probability Density Function.

The PDF integrates to 1 over the entire range of possible values of x.

Parameters
xvalue, range depends on distribution.
Return values
pa relative likelihood in range [0,inf] that a random variate X will equal x.

Reimplemented in honey::ChiSqr_< Real >, honey::StudentT_< Real >, honey::Beta_< Real >, honey::HyperGeo_< Real >, honey::Gamma_< Real >, honey::Poisson_< Real >, honey::BinomialNeg_< Real >, honey::DiscreteGen_< Real >, honey::Weibull_< Real >, honey::Binomial_< Real >, honey::Gaussian_< Real >, and honey::Uniform_< Real >.

template<class Real>
void honey::RandomDist< Real >::setGen ( RandomGen gen)
inline

Set random generator to use for next()

template<class Real>
Real honey::RandomDist< Real >::stdDev ( ) const
inline

Calc standard deviation.

template<class Real>
virtual Real honey::RandomDist< Real >::variance ( ) const
inlinevirtual

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