Honeycomb  0.1
Component-Model Framework
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
honey::Gaussian_< Real > Class Template Reference

Generate a normally (Gaussian) distributed random variate. More...

#include <Gaussian.h>

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

Public Member Functions

 Gaussian_ (optional< RandomGen & > gen, Real mu=0, Real sigma=1)
 
 Gaussian_ (Real mu=0, Real sigma=1)
 
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 cdfInv (Real P) const
 Inverse of the CDF. More...
 
virtual Real mean () const
 Calc mean. More...
 
virtual Real variance () const
 Calc variance. More...
 
- Public Member Functions inherited from honey::RandomDist< Real >
 RandomDist (optional< RandomGen & > gen=optnull)
 Construct with a random generator to use for next() More...
 
virtual ~RandomDist ()
 
virtual Real cdfComp (Real x) const
 Complement of the CDF. 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...
 

Static Public Member Functions

static Real erf (Real x)
 Gauss Error Function, related to Cdf. Input: [-inf, inf] -> Output: [-1, 1]. More...
 
static Real erfComp (Real x)
 Complement of Error Function. More...
 
static Real erfInv (Real y)
 Inverse of Error Function, related to CdfInv. Input: [-1, 1] -> Output: [-inf, inf]. More...
 
static Real erfCompInv (Real y)
 Inverse of complement Error Function. More...
 

Public Attributes

Real mu
 
Real sigma
 

Additional Inherited Members

- Protected Types inherited from honey::RandomDist< Real >
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 inherited from honey::RandomDist< Real >
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::Gaussian_< Real >

Generate a normally (Gaussian) distributed random variate.

The gaussian distribution is a core component for most other distributions.

Example: Toss a coin 1000 times and count number of heads

Probability density function:

$\displaystyle p(x,\mu,\sigma) = \frac{1}{\sigma \sqrt{2\pi}} e^{-\frac{(x-\mu)^2}{2\sigma^2}} $

Default values provide the standard normal distribution around 0

Parameters
mu$\mu$ Mean
sigma$\sigma$ Standard deviation. Range > 0
Return values
xRandom variate. Range [-inf, inf]

Constructor & Destructor Documentation

template<class Real >
honey::Gaussian_< Real >::Gaussian_ ( optional< RandomGen & >  gen,
Real  mu = 0,
Real  sigma = 1 
)
inline
template<class Real >
honey::Gaussian_< Real >::Gaussian_ ( Real  mu = 0,
Real  sigma = 1 
)
inline

Member Function Documentation

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

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 from honey::RandomDist< Real >.

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

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 from honey::RandomDist< Real >.

template<class Real >
static Real honey::Gaussian_< Real >::erf ( Real  x)
inlinestatic

Gauss Error Function, related to Cdf. Input: [-inf, inf] -> Output: [-1, 1].

template<class Real >
static Real honey::Gaussian_< Real >::erfComp ( Real  x)
inlinestatic

Complement of Error Function.

template<class Real >
static Real honey::Gaussian_< Real >::erfCompInv ( Real  y)
inlinestatic

Inverse of complement Error Function.

template<class Real >
static Real honey::Gaussian_< Real >::erfInv ( Real  y)
inlinestatic

Inverse of Error Function, related to CdfInv. Input: [-1, 1] -> Output: [-inf, inf].

template<class Real >
virtual Real honey::Gaussian_< Real >::mean ( ) const
inlinevirtual

Calc mean.

Reimplemented from honey::RandomDist< Real >.

template<class Real >
Real honey::Gaussian_< Real >::next ( ) const
virtual

Get next randomly distributed variate. Requires a random generator (see ctor or setGen())

Reimplemented from honey::RandomDist< Real >.

template<class Real >
Real honey::Gaussian_< Real >::pdf ( Real  x) const
virtual

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 from honey::RandomDist< Real >.

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

Calc variance.

Reimplemented from honey::RandomDist< Real >.

Member Data Documentation

template<class Real >
Real honey::Gaussian_< Real >::mu
template<class Real >
Real honey::Gaussian_< Real >::sigma

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