Sampler.cpp

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @file   Sampler.cpp
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @author Matthew Jacobs (jacobs.mh@gmail.com)
00005    @date   Fall 2008
00006    
00007    @brief
00008       Represents an abstract random variable that can be sampled according 
00009    to some discrete/continuous probability distribution
00010    <!-------------------------------------------------------------------->**/
00011 
00012 #include "Sampler.h"
00013 
00014 Event Sampler::sample(real_t &pdf) {
00015    const Event &x = sample();
00016    //ASSERT(m_sampleSpace && m_sampleSpace->contains(x));
00017    
00018    pdf = getPdf(x);
00019    
00020    // pdf should be strictly positive because x was sampled, so we know it 
00021    // should have a non-zero probability density (and pdfs are always 
00022    // non-negative)
00023    ASSERT(pdf > 0);
00024    
00025    return x;
00026 }
00027 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6