contrib/mul/pdf1d/pdf1d_gaussian_kernel_pdf.h
Go to the documentation of this file.
00001 // This is mul/pdf1d/pdf1d_gaussian_kernel_pdf.h
00002 #ifndef pdf1d_gaussian_kernel_pdf_h
00003 #define pdf1d_gaussian_kernel_pdf_h
00004 
00005 //:
00006 // \file
00007 // \brief Univariate gaussian kernel PDF
00008 // \author Tim Cootes
00009 
00010 #include <pdf1d/pdf1d_pdf.h>
00011 #include <pdf1d/pdf1d_kernel_pdf.h>
00012 #include <vcl_iosfwd.h>
00013 
00014 //: Class for univariate gaussian kernel based PDF
00015 class pdf1d_gaussian_kernel_pdf : public pdf1d_kernel_pdf
00016 {
00017  public:
00018   //: Dflt ctor
00019   pdf1d_gaussian_kernel_pdf();
00020 
00021   //: Define n kernels centred at i*sep (i=0..n-1)
00022   pdf1d_gaussian_kernel_pdf(int n, double sep, double width);
00023 
00024   //: Destructor
00025   virtual ~pdf1d_gaussian_kernel_pdf();
00026 
00027   //: Create a sampler object on the heap
00028   // Caller is responsible for deletion.
00029   virtual pdf1d_sampler* new_sampler() const;
00030 
00031   //: Probability density at x
00032   virtual double operator()(double x) const;
00033 
00034   //: Log of probability density at x
00035   virtual double log_p(double x) const;
00036 
00037   //: Cumulative Probability (P(x'<x) for x' drawn from the distribution)
00038   virtual double cdf(double x) const;
00039 
00040   //: Return true if cdf() uses an analytic implementation
00041   virtual bool cdf_is_analytic() const;
00042 
00043   //: Gradient of PDF at x
00044   virtual double gradient(double x, double& p) const;
00045 
00046   //: Compute nearest point to x which has a density above a threshold
00047   //  If log_p(x)>log_p_min then x returned unchanged.  Otherwise x is moved
00048   //  (typically up the gradient) until log_p(x)>=log_p_min.
00049   // \param x This may be modified to the nearest plausible position.
00050   // \param log_p_min lower threshold for log_p(x)
00051   virtual double nearest_plausible(double x, double log_p_min) const;
00052 
00053   //: Version number for I/O
00054   short version_no() 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 pdf1d_pdf* clone() const;
00064 
00065   //: Print class to os
00066   virtual void print_summary(vcl_ostream& os) const;
00067 
00068   //: Save class to binary file stream
00069   virtual void b_write(vsl_b_ostream& bfs) const;
00070 
00071   //: Load class from binary file stream
00072   virtual void b_read(vsl_b_istream& bfs);
00073 };
00074 
00075 #endif // pdf1d_gaussian_kernel_pdf_h