EigValues.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * @file EigValues.h
  3. * @brief Computing eigenvalues and eigenvectors
  4. * @author Michael Koch,Erik Rodner, Alexander Freytag
  5. * @date 08/19/2008
  6. */
  7. #ifndef EigValuesINCLUDE
  8. #define EigValuesINCLUDE
  9. #include "GenericMatrix.h"
  10. namespace NICE
  11. {
  12. /** Computing eigenvalues and eigenvectors */
  13. class EigValues
  14. {
  15. protected:
  16. public:
  17. /**
  18. * @param data matrix interface that does allow matrix-vector multiplications
  19. * @param k number of eigenvalues/eigenvectors
  20. * @param eigenvectors output Eigenvectors as Matrix
  21. * @param eigenvalues output Eigenvalues as Vector
  22. */
  23. virtual void getEigenvalues ( const GenericMatrix & data,
  24. NICE::Vector & eigenvalues,
  25. NICE::Matrix & eigenvectors, uint k ) = 0;
  26. virtual ~EigValues ()
  27. {
  28. };
  29. };
  30. /** arnoldi iteration */
  31. class EVArnoldi : public EigValues
  32. {
  33. protected:
  34. uint maxiterations;
  35. double mindelta;
  36. bool verbose;
  37. bool b_verifyDecreasingOrder;
  38. public:
  39. EVArnoldi ( bool verbose = false, uint _maxiterations = 100, double _mindelta = 0.01, bool b_verifyDecreasingOrder = true)
  40. : maxiterations ( _maxiterations ), mindelta ( _mindelta )
  41. {
  42. this->verbose = verbose;
  43. this->b_verifyDecreasingOrder = b_verifyDecreasingOrder;
  44. };
  45. /**
  46. * Arnoldi Iteration, to get k first eigenvectors and eigenvalues
  47. * @param data matrix interface that does allow matrix-vector multiplications
  48. * @param k number of eigenvalues/eigenvectors
  49. * @param eigenvectors output Eigenvectors as Matrix
  50. * @param eigenvalues output Eigenvalues as Vector
  51. */
  52. void getEigenvalues ( const GenericMatrix & data, NICE::Vector & eigenvalues,
  53. NICE::Matrix & eigenvectors, uint k );
  54. };
  55. } // namespace
  56. #endif