ExponentialSampler Class Reference

Represents an exponential distribution: X ~ Exp(lambda) ; lambda > 0 f(x) = lambda * exp(-lambda * x) ; x >= 0 E(X) = 1 / lambda Var(X) = 1 / (lambda ^ 2). More...

#include <ExponentialSampler.h>

Inheritance diagram for ExponentialSampler:

Sampler

List of all members.

Public Member Functions

Constructors
 ExponentialSampler (const real_t lambda=1.0)
 ExponentialSampler (const ExponentialSampler &copy)
virtual ~ExponentialSampler ()
Initialization
virtual void init ()
 Should perform any initialization of this random variable which may be necessary to speed or prepare sampling.
Main usage interface
virtual Event sample ()
virtual real_t getPdf (const Event &event) PURE_FUNCTION
Accessors/Mutators
real_t getLambda () const

Protected Attributes

Random::BoostExponentialSampler m_sampler
real_t m_lambda


Detailed Description

Represents an exponential distribution: X ~ Exp(lambda) ; lambda > 0 f(x) = lambda * exp(-lambda * x) ; x >= 0 E(X) = 1 / lambda Var(X) = 1 / (lambda ^ 2).

Author:
Travis Fischer (fisch0920@gmail.com)

Matthew Jacobs (jacobs.mh@gmail.com)

Date:
Fall 2008
Exponential distributions describe the times (waiting time) between events in a Poisson process, i.e., a process in which events occur continuously and independently at a constant average rate. An example would be the average time you have to wait at a red light before the light turns green.

Definition at line 26 of file ExponentialSampler.h.


Constructor & Destructor Documentation

ExponentialSampler::ExponentialSampler ( const real_t  lambda = 1.0  )  [inline, explicit]

Definition at line 32 of file ExponentialSampler.h.

ExponentialSampler::ExponentialSampler ( const ExponentialSampler copy  )  [inline]

Definition at line 39 of file ExponentialSampler.h.

virtual ExponentialSampler::~ExponentialSampler (  )  [inline, virtual]

Definition at line 45 of file ExponentialSampler.h.


Member Function Documentation

void ExponentialSampler::init (  )  [virtual]

Should perform any initialization of this random variable which may be necessary to speed or prepare sampling.

Note:
should be called before calling sample or getPdf

default implementation initialiazes this random variable's sample space

Reimplemented from Sampler.

Definition at line 23 of file ExponentialSampler.cpp.

Event ExponentialSampler::sample (  )  [virtual]

Returns:
a randomly chosen event x, sampled from this random variable's sample space
Note:
consecutive calls to sample are expected to return independent, identically distributed (IID) samples

Implements Sampler.

Definition at line 29 of file ExponentialSampler.cpp.

real_t ExponentialSampler::getPdf ( const Event event  )  [virtual]

Returns:
the probability density with which the given event would be sampled according to the underlying probability density function
Note:
the given event is assumed to lie within this random variable's sample space

Implements Sampler.

Definition at line 33 of file ExponentialSampler.cpp.

real_t ExponentialSampler::getLambda (  )  const [inline]

Returns:
the parameter lambda of this distribution, where lambda is the expected 'rate'

Definition at line 94 of file ExponentialSampler.h.


Member Data Documentation

Definition at line 104 of file ExponentialSampler.h.


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

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6