LogDetApproxBaiAndGolub.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /**
  2. * @file LogDetApproxBaiAndGolub.h
  3. * @brief LogDet Approximation as stated by Bai and Golub ("Bounds for the Trace of the Inverse and the Determinant of Symmetric Positive Definite Matrices" in Annals of Numerical Mathematics") (Interface)
  4. * @author Alexander Freytag
  5. * @date 05-01-2012 (dd-mm-yyyy)
  6. */
  7. #ifndef LOGDETAPPROXBAIANDGOLUBINCLUDE
  8. #define LOGDETAPPROXBAIANDGOLUBINCLUDE
  9. #include "gp-hik-core/algebra/LogDetApprox.h"
  10. namespace NICE {
  11. /**
  12. * @class LogDetApproxBaiAndGolub
  13. * @brief LogDet Approximation as stated by Bai and Golub ("Bounds for the Trace of the Inverse and the Determinant of Symmetric Positive Definite Matrices" in Annals of Numerical Mathematics")
  14. * @author Alexander Freytag
  15. */
  16. class LogDetApproxBaiAndGolub : public LogDetApprox
  17. {
  18. protected:
  19. bool verbose;
  20. public:
  21. //------------------------------------------------------
  22. // several constructors and destructors
  23. //------------------------------------------------------
  24. /**
  25. * @brief Default constructor
  26. * @author Alexander Freytag
  27. * @date 05-01-2012 (dd-mm-yyyy)
  28. */
  29. LogDetApproxBaiAndGolub();
  30. /**
  31. * @brief Default destructor
  32. * @author Alexander Freytag
  33. * @date 05-01-2012 (dd-mm-yyyy)
  34. */
  35. ~LogDetApproxBaiAndGolub();
  36. //------------------------------------------------------
  37. // get and set methods
  38. //------------------------------------------------------
  39. void setVerbose(const bool & _verbose);
  40. //------------------------------------------------------
  41. // high level methods
  42. //------------------------------------------------------
  43. /**
  44. * @brief Compute an approximation for the logDet using Bai and Golubs paper
  45. * @author Alexander Freytag
  46. * @date 05-01-2012 (dd-mm-yyyy)
  47. * @pre A has to be symmetric and positive definite
  48. * @param A symmetric positive definite matrix
  49. * @return approximated logDet of A, computed by taking (LogDetUpperBound+LogDetLowerBound)/2
  50. */
  51. virtual double getLogDetApproximation(const NICE::Matrix & A);
  52. /**
  53. * @brief Compute an approximation for the logDet using Bai and Golubs paper
  54. * @author Alexander Freytag
  55. * @date 05-01-2012 (dd-mm-yyyy)
  56. * @pre A has to be symmetric and positive definite
  57. * @param A symmetric positive definite matrix
  58. * @param lambdaUpperBound guaranteed upper bound on the eigenvalues of A
  59. * @param lambdaLowerBound guaranteed lower bound on the eignvalues of A
  60. * @return approximated logDet of A, computed by taking (LogDetUpperBound+LogDetLowerBound)/2
  61. */
  62. double getLogDetApproximation(const NICE::Matrix A, const double & lambdaUpperBound, const double & lambdaLowerBound);
  63. /**
  64. * @brief Compute an approximation for the logDet using Bai and Golubs paper
  65. * @author Alexander Freytag
  66. * @date 05-01-2012 (dd-mm-yyyy)
  67. * @param mu1 ideally the trace of matrix A
  68. * @param mu2 ideally the frobenius norm of matrix A
  69. * @param lambdaUpperBound guaranteed upper bound on the eigenvalues of A
  70. * @param lambdaLowerBound guaranteed lower bound on the eignvalues of A
  71. * @param n number of rows in A (equals number of training examples used to compute the matrix, if A is a kernel matrix)
  72. * @return approximated logDet of A, computed by taking (LogDetUpperBound+LogDetLowerBound)/2
  73. */
  74. double getLogDetApproximation(const double & mu1, const double & mu2, const double & lambdaUpperBound, const double & lambdaLowerBound, const int & n );
  75. /**
  76. * @brief Compute an upper bound on the logDet using Bai and Golubs paper
  77. * @author Alexander Freytag
  78. * @date 05-01-2012 (dd-mm-yyyy)
  79. * @param mu1 ideally the trace of matrix A
  80. * @param mu2 ideally the frobenius norm of matrix A
  81. * @param lambdaUpperBound the guaranteed upper bound on the eigenvalues of A
  82. * @param n number of rows in A (equals number of training examples used to compute the matrix, if A is a kernel matrix)
  83. * @return guaranteed upper bound on the log det of A, if the inputs are correctly computed
  84. */
  85. double getLogDetApproximationUpperBound(const double & mu1, const double & mu2, const double & lambdaUpperBound, const int & n );
  86. /**
  87. * @brief Compute a lower bound on the logDet using Bai and Golubs paper
  88. * @author Alexander Freytag
  89. * @date 05-01-2012 (dd-mm-yyyy)
  90. * @param mu1 ideally the trace of matrix A
  91. * @param mu2 ideally the frobenius norm of matrix A
  92. * @param lambdaLowerBound the guaranteed lower bound on the eigenvalues of A
  93. * @param n number of rows in A (equals number of training examples used to compute the matrix, if A is a kernel matrix)
  94. * @return guaranteed lower bound on the log det of A, if the inputs are correctly computed
  95. */
  96. double getLogDetApproximationLowerBound(const double & mu1, const double & mu2, const double & lambdaLowerBound, const int & n );
  97. };
  98. } //namespace
  99. #endif