contrib/mul/vpdfl/vpdfl_axis_gaussian_sampler.h
Go to the documentation of this file.
00001 // This is mul/vpdfl/vpdfl_axis_gaussian_sampler.h
00002 #ifndef vpdfl_axis_gaussian_sampler_h
00003 #define vpdfl_axis_gaussian_sampler_h
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \author Ian Scott
00010 // \date 19-Apr-2001
00011 // \brief Sampler class for Multi-Variate axis aligned Gaussian.
00012 
00013 #include <vcl_string.h>
00014 #include <vnl/vnl_fwd.h>
00015 #include <vnl/vnl_random.h>
00016 #include <vpdfl/vpdfl_sampler_base.h>
00017 class vpdfl_axis_gaussian;
00018 
00019 //=======================================================================
00020 
00021 //: Samples from an axis aligned Gaussian PDF
00022 class vpdfl_axis_gaussian_sampler :public vpdfl_sampler_base
00023 {
00024  protected:
00025   //: The random number generator
00026   vnl_random rng_;
00027  public:
00028 
00029   //: Dflt ctor
00030   vpdfl_axis_gaussian_sampler();
00031 
00032   //: Destructor
00033   virtual ~vpdfl_axis_gaussian_sampler();
00034 
00035   //: Set model for which this is an instance
00036   // Error check that it is an axis gaussian.
00037   virtual void set_model(const vpdfl_pdf_base&);
00038 
00039   //: Draw random sample from Gaussian distribution
00040   virtual void sample(vnl_vector<double>& x);
00041 
00042   //: Reseeds the internal random number generator
00043   // To achieve quasi-random initialisation use;
00044   // \code
00045   // #include <vcl_ctime.h>
00046   // ..
00047   // sampler.reseed(vcl_time(0));
00048   // \endcode
00049   virtual void reseed(unsigned long);
00050 
00051 
00052   //: Return a reference to the pdf model
00053   // This is properly cast.
00054   const vpdfl_axis_gaussian& axis_gaussian() const;
00055 
00056   //: Name of the class
00057   virtual vcl_string is_a() const;
00058 
00059   //: Does the name of the class match the argument?
00060   virtual bool is_class(vcl_string const& s) const;
00061 
00062   //: Create a copy on the heap and return base class pointer
00063   virtual vpdfl_sampler_base* clone() const;
00064 };
00065 
00066 #endif // vpdfl_axis_gaussian_sampler_h