Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
eigensolver::DirPowIt< F, G > Class Template Reference

Eigenvalue solver using the direct power iteration method. More...

#include <DirPowIt.hh>

Inheritance diagram for eigensolver::DirPowIt< F, G >:
Inheritance graph
[legend]
Collaboration diagram for eigensolver::DirPowIt< F, G >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual uint converged () const
 Returns the number of converged eigenpairs (not implemented)
 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.
virtual const concepts::Array
< concepts::Vector< G > * > & 
getEF ()
 Returns an array with the eigenfunctions.
virtual const concepts::Array
< G > & 
getEV ()
 Returns an array with the eigenvalues.
virtual uint iterations () const
 Returns the number of iterations.
virtual ~DirPowIt ()
 Destructor.

Protected Member Functions

virtual std::ostream & info (std::ostream &os) const
 Returns information in an output stream.

Private Member Functions

void compute_ ()
 Compute eigenpairs.
void sort_ (concepts::Array< Real > &)
 Sorting an array using bubble sort and returning the permutation:

Private Attributes

concepts::Operator< F > & A_
 Operator A.
bool computed_
 Are the eigenpairs already computed ?
concepts::Array< G > eigenvalues_
 Storage space for eigenvalues.
concepts::Array
< concepts::Vector< G > * > 
eigenvectors_
 Storage space for eigenvectors.
int iter_
 Number of iterations.
int k_
 Number of highest eigenvalues to be cut off:
int m_
 Size of initial matrix V;.
int maxiter_
 Maximum number of iterations allowed.
int nev_
 Number of eigenpairs to be computed.
concepts::Array< uint > permutation_
concepts::Array
< concepts::Vector< G > * > 
temp_eigenvectors_
 Temporary storage space for eigenvectors.
Real tol_
 Convergence tolerance for the eigenpairs.

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 28 of file DirPowIt.hh.


Constructor & Destructor Documentation

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);
template<typename F , typename G >
virtual eigensolver::DirPowIt< F, G >::~DirPowIt ( ) [virtual]

Destructor.


Member Function Documentation

template<typename F , typename G >
void eigensolver::DirPowIt< F, G >::compute_ ( ) [private]

Compute eigenpairs.

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

Returns the number of converged eigenpairs (not implemented)

Implements eigensolver::EigenSolver< G >.

Definition at line 82 of file DirPowIt.hh.

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 >.

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 >.

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

Returns information in an output stream.

Reimplemented from eigensolver::EigenSolver< G >.

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

Returns the number of iterations.

Implements eigensolver::EigenSolver< G >.

Definition at line 80 of file DirPowIt.hh.

template<typename F , typename G >
void eigensolver::DirPowIt< F, G >::sort_ ( concepts::Array< Real > &  ) [private]

Sorting an array using bubble sort and returning the permutation:


Member Data Documentation

template<typename F , typename G >
concepts::Operator<F>& eigensolver::DirPowIt< F, G >::A_ [private]

Operator A.

Definition at line 87 of file DirPowIt.hh.

template<typename F , typename G >
bool eigensolver::DirPowIt< F, G >::computed_ [private]

Are the eigenpairs already computed ?

Definition at line 110 of file DirPowIt.hh.

template<typename F , typename G >
concepts::Array<G> eigensolver::DirPowIt< F, G >::eigenvalues_ [private]

Storage space for eigenvalues.

Definition at line 101 of file DirPowIt.hh.

template<typename F , typename G >
concepts::Array<concepts::Vector<G>*> eigensolver::DirPowIt< F, G >::eigenvectors_ [private]

Storage space for eigenvectors.

Definition at line 103 of file DirPowIt.hh.

template<typename F , typename G >
int eigensolver::DirPowIt< F, G >::iter_ [private]

Number of iterations.

Definition at line 95 of file DirPowIt.hh.

template<typename F , typename G >
int eigensolver::DirPowIt< F, G >::k_ [private]

Number of highest eigenvalues to be cut off:

Definition at line 93 of file DirPowIt.hh.

template<typename F , typename G >
int eigensolver::DirPowIt< F, G >::m_ [private]

Size of initial matrix V;.

Definition at line 91 of file DirPowIt.hh.

template<typename F , typename G >
int eigensolver::DirPowIt< F, G >::maxiter_ [private]

Maximum number of iterations allowed.

Definition at line 97 of file DirPowIt.hh.

template<typename F , typename G >
int eigensolver::DirPowIt< F, G >::nev_ [private]

Number of eigenpairs to be computed.

Definition at line 89 of file DirPowIt.hh.

template<typename F , typename G >
concepts::Array<uint> eigensolver::DirPowIt< F, G >::permutation_ [private]

Definition at line 108 of file DirPowIt.hh.

template<typename F , typename G >
concepts::Array<concepts::Vector<G>*> eigensolver::DirPowIt< F, G >::temp_eigenvectors_ [private]

Temporary storage space for eigenvectors.

Definition at line 105 of file DirPowIt.hh.

template<typename F , typename G >
Real eigensolver::DirPowIt< F, G >::tol_ [private]

Convergence tolerance for the eigenpairs.

Definition at line 99 of file DirPowIt.hh.


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

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)