MathTL
|
00001 // -*- c++ -*- 00002 00003 // +--------------------------------------------------------------------+ 00004 // | This file is part of MathTL - the Mathematical Template Library | 00005 // | | 00006 // | Copyright (c) 2002-2009 | 00007 // | Thorsten Raasch, Manuel Werner | 00008 // +--------------------------------------------------------------------+ 00009 00010 #ifndef _MATHTL_EIGENVALUES_H 00011 #define _MATHTL_EIGENVALUES_H 00012 00013 // A small collection of iterative algorithms to compute 00014 // eigenvalues of a square matrix A 00015 00016 // VECTOR: arbitrary vector class, should implement the operators +, -, * (scalar mult.) 00017 // MATRIX: matrix class, we only require a routine APPLY(const VECTOR&, VECTOR&) 00018 // PREC: preconditioner, we again require APPLY(const VECTOR&, VECTOR&) 00019 00020 namespace MathTL 00021 { 00023 00031 template <class VECTOR, class MATRIX> 00032 double PowerIteration(const MATRIX& A, VECTOR& xk, 00033 const double tol, const unsigned int maxit, unsigned int &iterations); 00034 00036 00045 template <class VECTOR, class MATRIX> 00046 double InversePowerIteration(const MATRIX& A, VECTOR& xk, 00047 const double tol, const unsigned int maxit, unsigned int &iterations); 00048 00050 00060 template <class VECTOR, class MATRIX> 00061 double InversePowerIteration(const MATRIX& A, VECTOR& xk, const double lambda, 00062 const double tol, const unsigned int maxit, unsigned int &iterations); 00063 00068 template <class MATRIX> 00069 void LanczosIteration(const MATRIX& A, const double tol, 00070 double& lambdamin, double& lambdamax, 00071 const unsigned int maxit, unsigned int &iterations); 00072 00074 00080 template <class VECTOR, class MATRIX, class MATRIX2> 00081 void SymmEigenvalues(const MATRIX& A, VECTOR& evals, MATRIX2& evecs); 00082 00084 template <class MATRIX> 00085 double CondSymm(const MATRIX& A, 00086 double tol = 1e-6, unsigned int maxit = 100); 00087 00089 template <class MATRIX> 00090 double CondNonSymm(const MATRIX &A, 00091 double tol = 1e-6, unsigned int maxit = 100); 00092 } 00093 00094 #include "numerics/eigenvalues.cpp" 00095 00096 00097 #endif