Eigenvalue solver using the direct power iteration method. More...
#include <DirPowIt.hh>


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. | |
Eigenvalue solver using the direct power iteration method.
Definition at line 28 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);
| virtual eigensolver::DirPowIt< F, G >::~DirPowIt | ( | ) | [virtual] |
Destructor.
| void eigensolver::DirPowIt< F, G >::compute_ | ( | ) | [private] |
Compute eigenpairs.
| 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.
| virtual const concepts::Array<concepts::Vector<G>*>& eigensolver::DirPowIt< F, G >::getEF | ( | ) | [virtual] |
Returns an array with the eigenfunctions.
Implements eigensolver::EigenSolver< G >.
| virtual const concepts::Array<G>& eigensolver::DirPowIt< F, G >::getEV | ( | ) | [virtual] |
Returns an array with the eigenvalues.
Implements eigensolver::EigenSolver< 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 >.
| 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.
| void eigensolver::DirPowIt< F, G >::sort_ | ( | concepts::Array< Real > & | ) | [private] |
Sorting an array using bubble sort and returning the permutation:
concepts::Operator<F>& eigensolver::DirPowIt< F, G >::A_ [private] |
Operator A.
Definition at line 87 of file DirPowIt.hh.
bool eigensolver::DirPowIt< F, G >::computed_ [private] |
Are the eigenpairs already computed ?
Definition at line 110 of file DirPowIt.hh.
concepts::Array<G> eigensolver::DirPowIt< F, G >::eigenvalues_ [private] |
Storage space for eigenvalues.
Definition at line 101 of file DirPowIt.hh.
concepts::Array<concepts::Vector<G>*> eigensolver::DirPowIt< F, G >::eigenvectors_ [private] |
Storage space for eigenvectors.
Definition at line 103 of file DirPowIt.hh.
int eigensolver::DirPowIt< F, G >::iter_ [private] |
Number of iterations.
Definition at line 95 of file DirPowIt.hh.
int eigensolver::DirPowIt< F, G >::k_ [private] |
Number of highest eigenvalues to be cut off:
Definition at line 93 of file DirPowIt.hh.
int eigensolver::DirPowIt< F, G >::m_ [private] |
Size of initial matrix V;.
Definition at line 91 of file DirPowIt.hh.
int eigensolver::DirPowIt< F, G >::maxiter_ [private] |
Maximum number of iterations allowed.
Definition at line 97 of file DirPowIt.hh.
int eigensolver::DirPowIt< F, G >::nev_ [private] |
Number of eigenpairs to be computed.
Definition at line 89 of file DirPowIt.hh.
concepts::Array<uint> eigensolver::DirPowIt< F, G >::permutation_ [private] |
Definition at line 108 of file DirPowIt.hh.
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.
Real eigensolver::DirPowIt< F, G >::tol_ [private] |
Convergence tolerance for the eigenpairs.
Definition at line 99 of file DirPowIt.hh.