00001 #ifndef pdf1d_bhat_overlap_h 00002 #define pdf1d_bhat_overlap_h 00003 //: 00004 // \file 00005 // \author Tim Cootes 00006 // \brief Functions to calculate Bhattacharyya overlap. 00007 00008 #include <pdf1d/pdf1d_pdf.h> 00009 // not used? #include <pdf1d/pdf1d_gaussian.h> 00010 00011 //: Estimate Bhattacharyya overlap between two pdfs 00012 // If use_analytic is true and an analytic form exists, it will be used. 00013 // Otherwise n_samples are drawn from pdf1 and used to estimate the overlap 00014 double pdf1d_bhat_overlap(const pdf1d_pdf& pdf1, const pdf1d_pdf& pdf2, 00015 int n_samples=0, bool use_analytic=true); 00016 00017 // Bhat. overlap between a pdf and a sampled distribution. 00018 // Second distribution is known to have pdf of p[i] when evaluated at x[i] 00019 // x[i] must be representative samples from the pdf (i.e. randomly sampled 00020 // from it, or selected so as to be equally spread in cum.prob. space). 00021 double pdf1d_bhat_overlap(const pdf1d_pdf& pdf, 00022 const double* x, 00023 const double* p, int n); 00024 00025 // Bhat. overlap between a Gaussian and a sampled distribution. 00026 // Second distribution is known to have pdf of p[i] when evaluated at x[i] 00027 // x[i] must be representative samples from the pdf (i.e. randomly sampled 00028 // from it, or selected so as to be equally spread in cum.prob. space). 00029 double pdf1d_bhat_overlap_gaussian(double mean, double variance, 00030 const double* x, 00031 const double* p, int n); 00032 00033 //: Bhat. overlap between two 1D Gaussians 00034 double pdf1d_bhat_overlap_gaussians(double mean1, double var1, double mean2, double var2); 00035 00036 //: Bhat. overlap between two 1D Gaussians 00037 double pdf1d_bhat_overlap_gaussians(const pdf1d_pdf& g1, const pdf1d_pdf& g2); 00038 00039 //: Bhat. overlap between Gaussian and arbitrary pdf (estimate by sampling at n points) 00040 double pdf1d_bhat_overlap_gaussian_with_pdf(double mean, double var, const pdf1d_pdf& pdf, int n=100); 00041 00042 //: Bhat. overlap between Gaussian and arbitrary pdf (estimate by sampling at n points) 00043 double pdf1d_bhat_overlap_gaussian_with_pdf(const pdf1d_pdf& gauss, const pdf1d_pdf& pdf, int n=100); 00044 00045 #endif // pdf1d_bhat_overlap_h