EigValuesTRLAN.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef EigenproblemINCLUDE
  2. #define EigenproblemINCLUDE
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <math.h>
  6. #include <vector>
  7. #include <string.h>
  8. #include "vislearning/math/algebra/EigValues.h"
  9. namespace OBJREC {
  10. /** Real Symmetric Eigenproblem - no parallel mode,
  11. the eigenpairs returned by the method solve are ordered increasingly */
  12. class EigValuesTRLAN : public EigValues {
  13. private:
  14. int magnitude;
  15. int restarting_scheme;
  16. double tolerance;
  17. int max_mult;
  18. int mult_flops;
  19. public:
  20. /** Init the TRLAN lanczos routine with the following parameters:
  21. magnitude - Specifies the nature of the EigValuesTRLAN:
  22. find eigenpair with respect to the k largest (magnitude>0)
  23. or smallest (magnitude<0) eigenvalues
  24. restarting_... - restarting scheme of TRLAN
  25. max_mult - maximum number of matrix-vector multiplications to perform
  26. tolerance - stop criterion (abs. resudual |A*x-lambda*x|?)
  27. mult_flops - number of flops per matrix multiplication (used for statistics calculation)
  28. */
  29. EigValuesTRLAN( int magnitude=1,
  30. int restarting_scheme=1,
  31. double tolerance=1e-8,
  32. int max_mult=-1,
  33. int mult_flops=-1 );
  34. ~EigValuesTRLAN(){};
  35. /**
  36. * @param data matrix interface that does allow matrix-vector multiplications
  37. * @param k number of eigenvalues/eigenvectors
  38. * @param eigenvectors output Eigenvectors as Matrix
  39. * @param eigenvalues output Eigenvalues as Vector
  40. */
  41. virtual void getEigenvalues ( const GenericMatrix &data, NICE::Vector & eigenvalues, NICE::Matrix & eigenvectors, uint k );
  42. };
  43. } // namespace
  44. #endif