EigValues.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /**
  2. * @file EigValues.h
  3. * @brief Computing eigenvalues and eigenvectors
  4. * @author Michael Koch,Erik Rodner
  5. * @date 08/19/2008
  6. */
  7. #ifndef EigValuesINCLUDE
  8. #define EigValuesINCLUDE
  9. #include "core/vector/VectorT.h"
  10. #include "core/vector/MatrixT.h"
  11. #include "GenericMatrix.h"
  12. namespace OBJREC {
  13. /** Computing eigenvalues and eigenvectors */
  14. class EigValues
  15. {
  16. protected:
  17. public:
  18. /**
  19. * @param data matrix interface that does allow matrix-vector multiplications
  20. * @param k number of eigenvalues/eigenvectors
  21. * @param eigenvectors output Eigenvectors as Matrix
  22. * @param eigenvalues output Eigenvalues as Vector
  23. */
  24. virtual void getEigenvalues ( const GenericMatrix &data, NICE::Vector & eigenvalues, NICE::Matrix & eigenvectors, uint k ) = 0;
  25. virtual ~EigValues() {};
  26. };
  27. #ifdef USE_BROKEN_LANCZOS
  28. /** BROKEN: lanczos iteration */
  29. class EVLanczos : public EigValues
  30. {
  31. protected:
  32. uint maxiterations;
  33. double mindelta;
  34. public:
  35. EVLanczos ( uint _maxiterations = 100, double _mindelta = 0.01 )
  36. : maxiterations(_maxiterations), mindelta(_mindelta) {};
  37. /**
  38. * Lanczos Iteration, to get k first eigenvectors and eigenvalues
  39. * @param data matrix interface that does allow matrix-vector multiplications
  40. * @param k number of eigenvalues/eigenvectors
  41. * @param eigenvectors output Eigenvectors as Matrix
  42. * @param eigenvalues output Eigenvalues as Vector
  43. */
  44. // refactor-nice.pl: check this substitution
  45. // old: void getEigenvalues ( const GenericMatrix &data, Vector & eigenvalues, Matrix & eigenvectors, uint k );
  46. void getEigenvalues ( const GenericMatrix &data, NICE::Vector & eigenvalues, NICE::Matrix & eigenvectors, uint k );
  47. };
  48. #endif
  49. /** arnoldi iteration */
  50. class EVArnoldi : public EigValues
  51. {
  52. protected:
  53. uint maxiterations;
  54. double mindelta;
  55. public:
  56. EVArnoldi ( uint _maxiterations = 100, double _mindelta = 0.01 )
  57. : maxiterations(_maxiterations), mindelta(_mindelta) {};
  58. /**
  59. * Arnoldi Iteration, to get k first eigenvectors and eigenvalues
  60. * @param data matrix interface that does allow matrix-vector multiplications
  61. * @param k number of eigenvalues/eigenvectors
  62. * @param eigenvectors output Eigenvectors as Matrix
  63. * @param eigenvalues output Eigenvalues as Vector
  64. */
  65. // refactor-nice.pl: check this substitution
  66. // old: void getEigenvalues ( const GenericMatrix &data, Vector & eigenvalues, Matrix & eigenvectors, uint k );
  67. void getEigenvalues ( const GenericMatrix &data, NICE::Vector & eigenvalues, NICE::Matrix & eigenvectors, uint k );
  68. };
  69. } // namespace
  70. #endif