PDFGaussian.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * @file PDFGaussian.h
  3. * @brief Normal Distribution / Gaussian PDF
  4. * @author Erik Rodner
  5. * @date 01/29/2008
  6. */
  7. #ifndef PDFGAUSSIANINCLUDE
  8. #define PDFGAUSSIANINCLUDE
  9. #ifdef NOVISUAL
  10. #include <vislearning/nice_nonvis.h>
  11. #else
  12. #include <vislearning/nice.h>
  13. #endif
  14. #include <map>
  15. #include "PDF.h"
  16. namespace OBJREC {
  17. /** Normal Distribution / Gaussian PDF */
  18. class PDFGaussian : public PDF
  19. {
  20. protected:
  21. double constant;
  22. double ldet;
  23. NICE::Matrix covariance;
  24. NICE::Matrix covCholesky;
  25. NICE::Vector mean;
  26. /** empty constructor */
  27. PDFGaussian ( int dimension );
  28. static const double logdetEPS = 0.0;
  29. static const double regEPS = 1e-7;
  30. static NICE::Matrix RobustInverse ( const NICE::Matrix & M, double & logdet );
  31. public:
  32. /** simple constructor */
  33. PDFGaussian ( const NICE::Matrix & covariance, const NICE::Vector & mean );
  34. /** simple destructor */
  35. virtual ~PDFGaussian();
  36. double getNLogDensity ( const NICE::Vector & x ) const;
  37. int getDimension () const;
  38. /**
  39. * get Mean of PDF
  40. * @return mean vector
  41. */
  42. NICE::Vector getMean();
  43. /**
  44. * get Covariance of PDF
  45. * @return covariance matrix
  46. */
  47. NICE::Matrix getCovariance();
  48. /**
  49. * get multivariate samples
  50. * @param samples vector of NICE::Vector
  51. * @param count number of samples
  52. */
  53. void sample ( NICE::VVector & samples, int count ) const;
  54. };
  55. } // namespace
  56. #endif