core/vnl/algo/vnl_sparse_symmetric_eigensystem.h

Go to the documentation of this file.
00001 // This is core/vnl/algo/vnl_sparse_symmetric_eigensystem.h
00002 #ifndef vnl_sparse_symmetric_eigensystem_h_
00003 #define vnl_sparse_symmetric_eigensystem_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief Find the eigenvalues of a sparse symmetric matrix
00010 // \author Rupert W. Curwen, GE CR&D
00011 // \date   20 Oct 98
00012 //
00013 // \verbatim
00014 // Modifications
00015 //  dac (Manchester) 28/03/2001: tidied up documentation
00016 // \endverbatim
00017 
00018 #include <vnl/vnl_sparse_matrix.h>
00019 #include <vcl_vector.h>
00020 
00021 //: Find the eigenvalues of a sparse symmetric matrix
00022 //  Solve the eigenproblem $A x = \lambda x$, with $A$ symmetric and
00023 //  sparse.  The block Lanczos algorithm is used to allow the
00024 //  recovery of a number of eigenvalue/eigenvector pairs from either
00025 //  end of the spectrum, to a required accuracy.
00026 //
00027 //  Uses the dnlaso routine from the LASO package of netlib.
00028 
00029 class vnl_sparse_symmetric_eigensystem
00030 {
00031  public:
00032   vnl_sparse_symmetric_eigensystem();
00033  ~vnl_sparse_symmetric_eigensystem();
00034 
00035   // Find n eigenvalue/eigenvectors.  If smallest is true, will
00036   // calculate the n smallest eigenpairs, else the n largest.
00037   int CalculateNPairs(vnl_sparse_matrix<double>& M, int n,
00038                       bool smallest = true, long nfigures = 10);
00039 
00040   // Recover specified eigenvector after computation.  The argument
00041   // must be less than the requested number of eigenvectors.
00042   vnl_vector<double> get_eigenvector(int i) const;
00043   double get_eigenvalue(int i) const;
00044 
00045   // Used as a callback in solving.
00046   int CalculateProduct(int n, int m, const double* p, double* q);
00047   int SaveVectors(int n, int m, const double* q, int base);
00048   int RestoreVectors(int n, int m, double* q, int base);
00049 
00050  protected:
00051   int nvalues;  // this is the size of the next two arrays.
00052   vnl_vector<double> * vectors; // eigenvectors
00053   double * values;              // eigenvalues
00054 
00055   vnl_sparse_matrix<double> * mat;
00056 
00057   vcl_vector<double*> temp_store;
00058 };
00059 
00060 #endif // vnl_sparse_symmetric_eigensystem_h_

Generated on Sat Nov 22 05:06:20 2008 for core/vnl by  doxygen 1.5.1