#include <DirPowIt.hh>
Public Member Functions | |
DirPowIt (concepts::Operator< F > &A, const int nev=3, const int m=3, const int k=0, const int maxiter=300, concepts::Array< concepts::Vector< G > * > *start=0, const Real tol=0) | |
virtual | ~DirPowIt () |
Destructor. | |
virtual const concepts::Array< G > & | getEV () |
Returns an array with the eigenvalues. | |
virtual const concepts::Array< concepts::Vector< G > * > & | getEF () |
Returns an array with the eigenfunctions. | |
virtual uint | iterations () const |
Returns the number of iterations. | |
virtual uint | converged () const |
Returns the number of converged eigenpairs (not implemented) | |
Protected Member Functions | |
virtual std::ostream & | info (std::ostream &os) const |
Returns information in an output stream. | |
Eigenvalue solver using the direct power iteration method.
Definition at line 31 of file DirPowIt.hh.
eigensolver::DirPowIt< F, G >::DirPowIt | ( | concepts::Operator< F > & | A, |
const int | nev = 3 , |
||
const int | m = 3 , |
||
const int | k = 0 , |
||
const int | maxiter = 300 , |
||
concepts::Array< concepts::Vector< G > * > * | start = 0 , |
||
const Real | tol = 0 |
||
) |
Constructor.
A | Operator A of which we want the eigenpairs |
nev | Number of eigenpairs to be computed |
m | Number of columns of the iteration matrix V (must be equal to the number of columns of start) |
k | It is recommended to set k = 0; k was intended to cut out the largest k from the nev eigenvalues; but to really implement such a feature one would have to do it in a more sophisticated way. Presently if k != 0 sometimes the smallest and sometimes the largest k from the nev eigenvalues are cut out. Nevertehless it seems to work for k >= 0.5*nev. |
maxiter | Maximum number of iterations allowed |
start | Initial n x m array (estimate for the eigenvectors) for iteration (n is the dimension of A and m must be bigger than nev) |
tol | Convergence tolerance for the eigenpairs. The default value is the machine precision for double numbers. |
The routine implements the following algorithm:
n = size(A,1); V = zeros(n,m); / start d = zeros(k,1); for i = 1 : maxiter V = A*V; [Q,R] = qr(V,0); T = Q'*A*Q; [S,D] = eig(T); [l,perm] = sort(-abs(diag(D))); V_new = Q*S(:,perm); if (norm(d+l(1:k)) < tol), break; end; V = V_new; d = -l(1:k); iter = iter + 1; end; V = V_new(:,1:k); l = -l(1:k);
|
inlinevirtual |
Returns the number of converged eigenpairs (not implemented)
Implements eigensolver::EigenSolver< G >.
Definition at line 85 of file DirPowIt.hh.
|
virtual |
Returns an array with the eigenfunctions.
Implements eigensolver::EigenSolver< G >.
|
virtual |
Returns an array with the eigenvalues.
Implements eigensolver::EigenSolver< G >.
|
protectedvirtual |
Returns information in an output stream.
Reimplemented from eigensolver::EigenSolver< G >.
|
inlinevirtual |
Returns the number of iterations.
Implements eigensolver::EigenSolver< G >.
Definition at line 83 of file DirPowIt.hh.