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>

Public Member Functions | |
Constructors | |
| ExponentialSampler (const real_t lambda=1.0) | |
| ExponentialSampler (const ExponentialSampler ©) | |
| 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).
- Date:
- Fall 2008
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.
- 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 102 of file ExponentialSampler.h.
real_t ExponentialSampler::m_lambda [protected] |
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
1.5.6