PDFGaussian.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #include "core/vector/VectorT.h"
  10. #include "core/vector/MatrixT.h"
  11. #include <map>
  12. #include "PDF.h"
  13. namespace OBJREC {
  14. /** Normal Distribution / Gaussian PDF */
  15. class PDFGaussian : public PDF
  16. {
  17. protected:
  18. double constant;
  19. double ldet;
  20. NICE::Matrix covariance;
  21. NICE::Matrix covCholesky;
  22. NICE::Vector mean;
  23. /** empty constructor */
  24. PDFGaussian ( int dimension );
  25. static const double logdetEPS = 0.0;
  26. static const double regEPS = 1e-7;
  27. static NICE::Matrix RobustInverse ( const NICE::Matrix & M, double & logdet );
  28. public:
  29. /** simple constructor */
  30. PDFGaussian ( const NICE::Matrix & covariance, const NICE::Vector & mean );
  31. /** simple destructor */
  32. virtual ~PDFGaussian();
  33. double getNLogDensity ( const NICE::Vector & x ) const;
  34. int getDimension () const;
  35. /**
  36. * get Mean of PDF
  37. * @return mean vector
  38. */
  39. NICE::Vector getMean();
  40. /**
  41. * get Covariance of PDF
  42. * @return covariance matrix
  43. */
  44. NICE::Matrix getCovariance();
  45. /**
  46. * get multivariate samples
  47. * @param samples vector of NICE::Vector
  48. * @param count number of samples
  49. */
  50. void sample ( NICE::VVector & samples, int count ) const;
  51. };
  52. } // namespace
  53. #endif