Class documentation of Concepts

Loading...
Searching...
No Matches
eigensolver::DirPowIt< F, G > Class Template Reference

#include <DirPowIt.hh>

Inheritance diagram for eigensolver::DirPowIt< F, G >:
eigensolver::EigenSolver< G > concepts::OutputOperator

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.
 

Detailed Description

template<typename F, typename G>
class eigensolver::DirPowIt< F, G >

Eigenvalue solver using the direct power iteration method.

Author
Peter Kauf, 2005

Definition at line 31 of file DirPowIt.hh.

Constructor & Destructor Documentation

◆ DirPowIt()

template<typename F , typename G >
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.

Parameters
AOperator A of which we want the eigenpairs
nevNumber of eigenpairs to be computed
mNumber of columns of the iteration matrix V (must be equal to the number of columns of start)
kIt 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.
maxiterMaximum number of iterations allowed
startInitial n x m array (estimate for the eigenvectors) for iteration (n is the dimension of A and m must be bigger than nev)
tolConvergence 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);

Member Function Documentation

◆ converged()

template<typename F , typename G >
virtual uint eigensolver::DirPowIt< F, G >::converged ( ) const
inlinevirtual

Returns the number of converged eigenpairs (not implemented)

Implements eigensolver::EigenSolver< G >.

Definition at line 85 of file DirPowIt.hh.

◆ getEF()

template<typename F , typename G >
virtual const concepts::Array< concepts::Vector< G > * > & eigensolver::DirPowIt< F, G >::getEF ( )
virtual

Returns an array with the eigenfunctions.

Implements eigensolver::EigenSolver< G >.

◆ getEV()

template<typename F , typename G >
virtual const concepts::Array< G > & eigensolver::DirPowIt< F, G >::getEV ( )
virtual

Returns an array with the eigenvalues.

Implements eigensolver::EigenSolver< G >.

◆ info()

template<typename F , typename G >
virtual std::ostream & eigensolver::DirPowIt< F, G >::info ( std::ostream &  os) const
protectedvirtual

Returns information in an output stream.

Reimplemented from eigensolver::EigenSolver< G >.

◆ iterations()

template<typename F , typename G >
virtual uint eigensolver::DirPowIt< F, G >::iterations ( ) const
inlinevirtual

Returns the number of iterations.

Implements eigensolver::EigenSolver< G >.

Definition at line 83 of file DirPowIt.hh.


The documentation for this class was generated from the following file: