00001 #ifndef vpdfl_mixture_sampler_h_ 00002 #define vpdfl_mixture_sampler_h_ 00003 //======================================================================= 00004 // 00005 // Copyright: (C) 2000 Victoria University of Manchester 00006 // 00007 //======================================================================= 00008 00009 00010 //: 00011 // \file 00012 00013 //======================================================================= 00014 00015 #include <vpdfl/vpdfl_sampler_base.h> 00016 #include <vpdfl/vpdfl_mixture.h> 00017 #include <vnl/vnl_random.h> 00018 00019 //======================================================================= 00020 00021 class vpdfl_mixture; 00022 00023 //: Instance class for vpdfl_mixture 00024 // Implements calculation of prob, gradient, sampling etc 00025 class vpdfl_mixture_sampler : public vpdfl_sampler_base 00026 { 00027 private: 00028 //: workspace 00029 vcl_vector<vpdfl_sampler_base*> inst_; 00030 00031 void init(); 00032 void delete_stuff(); 00033 00034 protected: 00035 //: The random number generator 00036 vnl_random rng_; 00037 public: 00038 00039 //: Dflt ctor 00040 vpdfl_mixture_sampler(); 00041 00042 //: Copy ctor 00043 vpdfl_mixture_sampler(const vpdfl_mixture_sampler&); 00044 00045 //: Copy operator 00046 vpdfl_mixture_sampler& operator=(const vpdfl_mixture_sampler&); 00047 00048 //: Destructor 00049 virtual ~vpdfl_mixture_sampler(); 00050 00051 //: Set model for which this is an instance 00052 virtual void set_model(const vpdfl_pdf_base&); 00053 00054 const vpdfl_mixture& mixture() const; 00055 00056 //: Draw random sample from distribution 00057 virtual void sample(vnl_vector<double>& x); 00058 00059 //: Reseeds the static random number generator (one per derived class) 00060 virtual void reseed(unsigned long); 00061 00062 //: Version number for I/O 00063 short version_no() const; 00064 00065 //: Name of the class 00066 virtual vcl_string is_a() const; 00067 00068 //: Does the name of the class match the argument? 00069 virtual bool is_class(vcl_string const& s) const; 00070 00071 //: Create a copy on the heap and return base class pointer 00072 virtual vpdfl_sampler_base* clone() const; 00073 }; 00074 00075 #endif // vpdfl_mixture_sampler_h_
1.5.1