PowerEigenSolver.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2004-2006 Rational Discovery LLC
00003 //
00004 //   @@ All Rights Reserved  @@
00005 //
00006 
00007 #ifndef _RD_POWER_EIGENSOLVER_H
00008 #define _RD_POWER_EIGENSOLVER_H
00009 
00010 #include <Numerics/Vector.h>
00011 #include <Numerics/Matrix.h>
00012 #include <Numerics/SymmMatrix.h>
00013 
00014 namespace RDNumeric {
00015   namespace EigenSolvers {
00016     //! Compute the \c numEig largest eigenvalues and the corresponding eigenvectors. 
00017     /*!
00018       
00019     \param numEig       the number of eigenvalues we are interested in
00020     \param mat          symmetric input matrix of dimension N*N
00021     \param eigenVectors Matrix used to return the eigenvectors (size = N*numEig)
00022     \param eigenValues  Vector used to return the eigenvalues (size = numEig)
00023     \param seed         Optional values to seed the random value generator used to initialize 
00024                         the eigen vectors
00025     \return a boolean indicating whether or not the calculation converged.
00026     
00027     <b>Notes:</b>
00028     - The matrix, \c mat, is changed in this function
00029     
00030     <b>Algorithm:</b>
00031     
00032     We use the iterative power method, which works like this:
00033 
00034     \verbatim
00035      u = arbitrary unit vector
00036      tol = 0.001
00037      currEigVal = 0.0;
00038      prevEigVal = -1.0e100
00039      while (abs(currEigVal - prevEigVal) > tol) :
00040          v = Au
00041          prevEigVal = currEigVal
00042          currEigVal = v[i] // where i is the id os the largest absolute component
00043          u = c*v
00044     \endverbatim
00045 
00046       
00047     */
00048     bool powerEigenSolver(unsigned int numEig, DoubleSymmMatrix &mat,
00049                           DoubleMatrix &eigenVectors, DoubleVector &eigenValues,
00050                           int seed=-1);
00051   };
00052 };
00053 
00054 #endif
00055                            
00056 
00057 

Generated on Sat May 24 08:36:32 2008 for RDCode by  doxygen 1.5.3