PDFGaussian.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #if __cplusplus >= 201103L
  26. static constexpr double logdetEPS = 0.0;
  27. static constexpr double regEPS = 1e-7;
  28. #else
  29. static const double logdetEPS = 0.0;
  30. static const double regEPS = 1e-7;
  31. #endif
  32. static NICE::Matrix RobustInverse ( const NICE::Matrix & M, double & logdet );
  33. public:
  34. /** simple constructor */
  35. PDFGaussian ( const NICE::Matrix & covariance, const NICE::Vector & mean );
  36. /** simple destructor */
  37. virtual ~PDFGaussian();
  38. double getNLogDensity ( const NICE::Vector & x ) const;
  39. int getDimension () const;
  40. /**
  41. * get Mean of PDF
  42. * @return mean vector
  43. */
  44. NICE::Vector getMean();
  45. /**
  46. * get Covariance of PDF
  47. * @return covariance matrix
  48. */
  49. NICE::Matrix getCovariance();
  50. /**
  51. * get multivariate samples
  52. * @param samples vector of NICE::Vector
  53. * @param count number of samples
  54. */
  55. void sample ( NICE::VVector & samples, int count ) const;
  56. };
  57. } // namespace
  58. #endif