ContUniformSampler.h

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @class  ContUniformSampler
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @author Matthew Jacobs (jacobs.mh@gmail.com)
00005    @date   Fall 2008
00006    
00007    @brief
00008       Represents a continuous uniform distribution
00009          X ~ U(min, max)
00010          f(x) = 1 / (max - min)
00011    <!-------------------------------------------------------------------->**/
00012 
00013 #ifndef CONT_UNIFORM_SAMPLER_H_
00014 #define CONT_UNIFORM_SAMPLER_H_
00015 
00016 #include <stats/samplers/UniformSampler.h>
00017 
00018 class ContUniformSampler : public UniformSampler<real_t> {
00019    
00020    public:
00021       ///@name Constructors
00022       //@{-----------------------------------------------------------------
00023       
00024       inline explicit ContUniformSampler(real_t min = 0, real_t max = 1)
00025          : UniformSampler<real_t>(min, max), 
00026            m_sampler(Random::s_generator, 
00027                      Random::ContUniformDist(min, max))
00028       { }
00029       
00030       inline ContUniformSampler(const ContUniformSampler &copy)
00031          : UniformSampler<real_t>(copy), 
00032            m_sampler(copy.m_sampler)
00033       { }
00034       
00035       virtual ~ContUniformSampler()
00036       { }
00037       
00038       
00039       //@}-----------------------------------------------------------------
00040       ///@name Main usage interface
00041       //@{-----------------------------------------------------------------
00042       
00043       /**
00044        * @returns a randomly chosen event x, sampled from this random 
00045        *    variable's sample space
00046        * @note consecutive calls to sample are expected to return 
00047        *    independent, identically distributed (IID) samples
00048        */
00049       virtual Event sample();
00050       
00051       /**
00052        * @returns the probability density with which the given event would be 
00053        *    sampled according to the underlying probability density function
00054        * @note the given event is assumed to lie within this random variable's
00055        *    sample space
00056        */
00057       virtual real_t getPdf(const Event &event) PURE_FUNCTION;
00058       
00059       
00060       //@}-----------------------------------------------------------------
00061       
00062    protected:
00063       Random::BoostContUniformSampler m_sampler;
00064 };
00065 
00066 #endif // CONT_UNIFORM_SAMPLER_H_
00067 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6