contrib/mul/pdf1d/pdf1d_weighted_epanech_kernel_sampler.h
Go to the documentation of this file.
00001 #ifndef pdf1d_weighted_epanech_kernel_sampler_h_
00002 #define pdf1d_weighted_epanech_kernel_sampler_h_
00003 //:
00004 // \file
00005 // \brief Implements sampling for a weighted Epanechnikov kernel PDF
00006 // \author Ian Scott
00007 
00008 #include <vnl/vnl_random.h>
00009 #include <pdf1d/pdf1d_sampler.h>
00010 #include <pdf1d/pdf1d_weighted_epanech_kernel_pdf.h>
00011 class pdf1d_epanech_kernel_pdf;
00012 
00013 //: Generates random samples from an Epanechnikov kernel estimate
00014 class pdf1d_weighted_epanech_kernel_sampler : public pdf1d_sampler
00015 {
00016  protected:
00017   //: The random number generator
00018   vnl_random rng_;
00019  public:
00020 
00021   //: Dflt ctor
00022   pdf1d_weighted_epanech_kernel_sampler();
00023 
00024   //: Destructor
00025   virtual ~pdf1d_weighted_epanech_kernel_sampler();
00026 
00027   const pdf1d_weighted_epanech_kernel_pdf& weighted_epanech_kernel_pdf() const;
00028 
00029   //: Draw random sample from distribution
00030   virtual double sample();
00031 
00032   //: Fill x with samples possibly chosen so as to represent the distribution
00033   //  Samples equal numbers from each kernel.
00034   virtual void regular_samples(vnl_vector<double>& x);
00035 
00036   //: Reseeds the static random number generator (one per derived class)
00037   virtual void reseed(unsigned long);
00038 
00039   //: Version number for I/O
00040   short version_no() const;
00041 
00042   //: Name of the class
00043   virtual vcl_string is_a() const;
00044 
00045   //: Does the name of the class match the argument?
00046   virtual bool is_class(vcl_string const& s) const;
00047 
00048   //: Create a copy on the heap and return base class pointer
00049   virtual pdf1d_sampler* clone() const;
00050 };
00051 
00052 #endif // pdf1d_weighted_epanech_kernel_sampler_h_