Eigenproblem.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. typedef struct{
  9. uint x;
  10. uint y;
  11. double val;
  12. } element;
  13. namespace OBJREC {
  14. /** depreceated version: Real Symmetric Eigenproblem - no parallel mode
  15. the eigenpairs returned by the method solve are ordered increasingly */
  16. class Eigenproblem{
  17. private:
  18. public:
  19. ///performs matrix-vector multiplication with sparse matrix this->mat
  20. void sparseMult(double* xin, double* yout, int ldy);
  21. std::vector<element> mat;
  22. Eigenproblem(){};
  23. ~Eigenproblem(){};
  24. /** Solves the user defined eigenproblem with the following parameters:
  25. mat - Sparse matrix
  26. mat_size - matrix size, i.e. dim(mat)=mat_size x mat_size
  27. evals - std::vector of eigenvalues
  28. evecs - std::vector of k eigenvectors
  29. k - number of eigenvalues/eigenvectors to compute
  30. magnitude - Specifies the nature of the eigenproblem:
  31. find eigenpair with respect to the k largest (magnitude>0)
  32. or smallest (magnitude<0) eigenvalues
  33. restarting_... - restarting scheme of TRLAN
  34. max_mult - maximum number of matrix-vector multiplications to perform
  35. tolerance - stop criterion (abs. resudual |A*x-lambda*x|?)
  36. mult_flops - number of flops per matrix multiplication (used for statistics calculation)
  37. */
  38. void solve( std::vector<element> mat, int mat_size, std::vector<double> &evals,
  39. std::vector< std::vector<double> > &evecs, int k=1, int magnitude=1,
  40. int restarting_scheme=1,double tolerance=1e-8, int max_mult=-1,
  41. int mult_flops=-1);
  42. };
  43. } // namespace
  44. #endif