Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

vnl_sparse_symmetric_eigensystem.h

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

Generated at Fri May 21 01:15:53 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000