CholeskyRobustAuto.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /**
  2. * @file CholeskyRobustAuto.h
  3. * @author Erik Rodner
  4. * @date 01/06/2010
  5. */
  6. #ifndef _NICE_NICE_CHOLESKYROBUSTAUTOINCLUDE
  7. #define _NICE_NICE_CHOLESKYROBUSTAUTOINCLUDE
  8. #include <limits>
  9. #include "core/vector/MatrixT.h"
  10. #include "CholeskyRobust.h"
  11. namespace NICE
  12. {
  13. /** @class CholeskyRobustAuto
  14. * robust cholesky decomposition by iteratively adding some noise
  15. *
  16. * @author Erik Rodner
  17. */
  18. class CholeskyRobustAuto : public CholeskyRobust
  19. {
  20. protected:
  21. /** minimal log determinant */
  22. double m_minMatrixLogDeterminant;
  23. public:
  24. /**
  25. * @brief copy constructor
  26. *
  27. * @param src input object
  28. */
  29. CholeskyRobustAuto (const CholeskyRobustAuto & src);
  30. /**
  31. * @brief constructor
  32. *
  33. * @param verbose whether to display a bunch of messages
  34. * @param noise constant added iteratively to the main diagonal
  35. * @param minMatrixLogDeterminant if the log determinant is greater than this threshold, we accept the decomposition
  36. * @param useCuda whether to use cuda with the cholesky-gpu sub-library
  37. */
  38. CholeskyRobustAuto (bool verbose = true,
  39. double noiseStep = 1e-8,
  40. double minMatrixLogDeterminant = -std::numeric_limits < double >::max (),
  41. bool useCuda = true);
  42. virtual ~ CholeskyRobustAuto ();
  43. /**
  44. * @brief Compute the Cholesky decompisition with iterative regularization, i.e.
  45. * we add a constant value to the diagonal of the input matrix until we get a numerical stable
  46. * result determined by checking the log determinant.
  47. *
  48. * @param A input matrix
  49. * @param cholA Cholesky factor
  50. *
  51. * @return
  52. */
  53. virtual double robustChol (const NICE::Matrix & A, NICE::Matrix & cholA);
  54. /** clone the object */
  55. virtual CholeskyRobustAuto *clone (void) const;
  56. };
  57. }
  58. #endif