Anasazi
Version of the Day
|
This class implements the block Krylov-Schur iteration, for solving linear eigenvalue problems. More...
#include <AnasaziBlockKrylovSchur.hpp>
Public Member Functions | |
Constructor/Destructor | |
BlockKrylovSchur (const Teuchos::RCP< Eigenproblem< ScalarType, MV, OP > > &problem, const Teuchos::RCP< SortManager< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > > &sorter, const Teuchos::RCP< OutputManager< ScalarType > > &printer, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &tester, const Teuchos::RCP< OrthoManager< ScalarType, MV > > &ortho, Teuchos::ParameterList ¶ms) | |
BlockKrylovSchur constructor with eigenproblem, solver utilities, and parameter list of solver options. More... | |
virtual | ~BlockKrylovSchur () |
BlockKrylovSchur destructor. More... | |
Solver methods | |
void | iterate () |
This method performs Block Krylov-Schur iterations until the status test indicates the need to stop or an error occurs (in which case, an exception is thrown). More... | |
void | initialize (BlockKrylovSchurState< ScalarType, MV > &state) |
Initialize the solver to an iterate, providing a Krylov basis and Hessenberg matrix. More... | |
void | initialize () |
Initialize the solver with the initial vectors from the eigenproblem or random data. More... | |
bool | isInitialized () const |
Indicates whether the solver has been initialized or not. More... | |
BlockKrylovSchurState < ScalarType, MV > | getState () const |
Get the current state of the eigensolver. More... | |
Status methods | |
int | getNumIters () const |
Get the current iteration count. More... | |
void | resetNumIters () |
Reset the iteration count. More... | |
Teuchos::RCP< const MV > | getRitzVectors () |
Get the Ritz vectors. More... | |
std::vector< Value< ScalarType > > | getRitzValues () |
Get the Ritz values. More... | |
std::vector< int > | getRitzIndex () |
Get the Ritz index vector. More... | |
std::vector< typename Teuchos::ScalarTraits < ScalarType >::magnitudeType > | getResNorms () |
Get the current residual norms. More... | |
std::vector< typename Teuchos::ScalarTraits < ScalarType >::magnitudeType > | getRes2Norms () |
Get the current residual 2-norms. More... | |
std::vector< typename Teuchos::ScalarTraits < ScalarType >::magnitudeType > | getRitzRes2Norms () |
Get the current Ritz residual 2-norms. More... | |
Accessor routines | |
void | setStatusTest (Teuchos::RCP< StatusTest< ScalarType, MV, OP > > test) |
Set a new StatusTest for the solver. More... | |
Teuchos::RCP< StatusTest < ScalarType, MV, OP > > | getStatusTest () const |
Get the current StatusTest used by the solver. More... | |
const Eigenproblem< ScalarType, MV, OP > & | getProblem () const |
Get a constant reference to the eigenvalue problem. More... | |
void | setSize (int blockSize, int numBlocks) |
Set the blocksize and number of blocks to be used by the iterative solver in solving this eigenproblem. More... | |
void | setBlockSize (int blockSize) |
Set the blocksize. More... | |
void | setStepSize (int stepSize) |
Set the step size. More... | |
void | setNumRitzVectors (int numRitzVecs) |
Set the number of Ritz vectors to compute. More... | |
int | getStepSize () const |
Get the step size. More... | |
int | getBlockSize () const |
Get the blocksize to be used by the iterative solver in solving this eigenproblem. More... | |
int | getNumRitzVectors () const |
Get the number of Ritz vectors to compute. More... | |
int | getCurSubspaceDim () const |
Get the dimension of the search subspace used to generate the current eigenvectors and eigenvalues. More... | |
int | getMaxSubspaceDim () const |
Get the maximum dimension allocated for the search subspace. More... | |
void | setAuxVecs (const Teuchos::Array< Teuchos::RCP< const MV > > &auxvecs) |
Set the auxiliary vectors for the solver. More... | |
Teuchos::Array< Teuchos::RCP < const MV > > | getAuxVecs () const |
Get the auxiliary vectors for the solver. More... | |
Output methods | |
void | currentStatus (std::ostream &os) |
This method requests that the solver print out its current status to screen. More... | |
Block-Krylov Schur status routines | |
bool | isRitzVecsCurrent () const |
Get the status of the Ritz vectors currently stored in the eigensolver. More... | |
bool | isRitzValsCurrent () const |
Get the status of the Ritz values currently stored in the eigensolver. More... | |
bool | isSchurCurrent () const |
Get the status of the Schur form currently stored in the eigensolver. More... | |
Block-Krylov Schur compute routines | |
void | computeRitzVectors () |
Compute the Ritz vectors using the current Krylov factorization. More... | |
void | computeRitzValues () |
Compute the Ritz values using the current Krylov factorization. More... | |
void | computeSchurForm (const bool sort=true) |
Compute the Schur form of the projected eigenproblem from the current Krylov factorization. More... | |
Public Member Functions inherited from Anasazi::Eigensolver< ScalarType, MV, OP > | |
Eigensolver () | |
Default Constructor. More... | |
Eigensolver (const Teuchos::RCP< Eigenproblem< ScalarType, MV, OP > > &problem, const Teuchos::RCP< SortManager< ScalarType > > &sorter, const Teuchos::RCP< OutputManager< ScalarType > > &printer, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &tester, const Teuchos::RCP< OrthoManager< ScalarType, MV > > &ortho, Teuchos::ParameterList ¶ms) | |
Basic Constructor. More... | |
virtual | ~Eigensolver () |
Destructor. More... | |
This class implements the block Krylov-Schur iteration, for solving linear eigenvalue problems.
This method is a block version of the iteration presented by G.W. Stewart in "A Krylov-Schur Algorithm for Large Eigenproblems", SIAM J. Matrix Anal. Appl., Vol 23(2001), No. 3, pp. 601-614.
Definition at line 147 of file AnasaziBlockKrylovSchur.hpp.
Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::BlockKrylovSchur | ( | const Teuchos::RCP< Eigenproblem< ScalarType, MV, OP > > & | problem, |
const Teuchos::RCP< SortManager< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > > & | sorter, | ||
const Teuchos::RCP< OutputManager< ScalarType > > & | printer, | ||
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > & | tester, | ||
const Teuchos::RCP< OrthoManager< ScalarType, MV > > & | ortho, | ||
Teuchos::ParameterList & | params | ||
) |
BlockKrylovSchur constructor with eigenproblem, solver utilities, and parameter list of solver options.
This constructor takes pointers required by the eigensolver, in addition to a parameter list of options for the eigensolver. These options include the following:
int
specifying the block size used by the algorithm. This can also be specified using the setBlockSize() method. Default: 1int
specifying the maximum number of blocks allocated for the solver basis. Default: 3*problem->getNEV()int
specifying how many iterations are performed between computations of eigenvalues and eigenvectors.int
specifying how many Ritz vectors are computed on calls to getRitzVectors(). Default: 0int
specifying how many Ritz values are printed on calls to currentStatus(). Default: "Block Size" Definition at line 557 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
BlockKrylovSchur destructor.
Definition at line 172 of file AnasaziBlockKrylovSchur.hpp.
|
virtual |
This method performs Block Krylov-Schur iterations until the status test indicates the need to stop or an error occurs (in which case, an exception is thrown).
iterate() will first determine whether the solver is inintialized; if not, it will call initialize() using default arguments. After initialization, the solver performs Block Krylov-Schur iterations until the status test evaluates as Passed, at which point the method returns to the caller.
The Block Krylov-Schur iteration proceeds as follows:
blockSize
vectors in the Krylov basis.stepSize
iterations since the last update, update the Ritz values and Ritz residuals.The status test is queried at the beginning of the iteration.
Possible exceptions thrown include the BlockKrylovSchurOrthoFailure.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 966 of file AnasaziBlockKrylovSchur.hpp.
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::initialize | ( | BlockKrylovSchurState< ScalarType, MV > & | state | ) |
Initialize the solver to an iterate, providing a Krylov basis and Hessenberg matrix.
The BlockKrylovSchur eigensolver contains a certain amount of state, consisting of the current Krylov basis and the associated Hessenberg matrix.
initialize() gives the user the opportunity to manually set these, although this must be done with caution, abiding by the rules given below. All notions of orthogonality and orthonormality are derived from the inner product specified by the orthogonalization manager.
true
(see post-conditions of isInitialize())The user has the option of specifying any component of the state using initialize(). However, these arguments are assumed to match the post-conditions specified under isInitialized(). Any necessary component of the state not given to initialize() will be generated.
Note, for any pointer in newstate
which directly points to the multivectors in the solver, the data is not copied.
Definition at line 785 of file AnasaziBlockKrylovSchur.hpp.
|
virtual |
Initialize the solver with the initial vectors from the eigenproblem or random data.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 956 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Indicates whether the solver has been initialized or not.
true:
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 238 of file AnasaziBlockKrylovSchur.hpp.
|
inline |
Get the current state of the eigensolver.
The data is only valid if isInitialized() == true
.
Definition at line 247 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Get the current iteration count.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 264 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Reset the iteration count.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 267 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Get the Ritz vectors.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 276 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Get the Ritz values.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 285 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Get the Ritz index vector.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 296 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Get the current residual norms.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 302 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Get the current residual 2-norms.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 311 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Get the current Ritz residual 2-norms.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 320 of file AnasaziBlockKrylovSchur.hpp.
|
virtual |
Set a new StatusTest for the solver.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 1394 of file AnasaziBlockKrylovSchur.hpp.
|
virtual |
Get the current StatusTest used by the solver.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 1403 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Get a constant reference to the eigenvalue problem.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 338 of file AnasaziBlockKrylovSchur.hpp.
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::setSize | ( | int | blockSize, |
int | numBlocks | ||
) |
Set the blocksize and number of blocks to be used by the iterative solver in solving this eigenproblem.
Changing either the block size or the number of blocks will reset the solver to an uninitialized state.
Definition at line 691 of file AnasaziBlockKrylovSchur.hpp.
|
virtual |
Set the blocksize.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 650 of file AnasaziBlockKrylovSchur.hpp.
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::setStepSize | ( | int | stepSize | ) |
Set the step size.
Definition at line 659 of file AnasaziBlockKrylovSchur.hpp.
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::setNumRitzVectors | ( | int | numRitzVecs | ) |
Set the number of Ritz vectors to compute.
Definition at line 668 of file AnasaziBlockKrylovSchur.hpp.
|
inline |
Get the step size.
Definition at line 358 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Get the blocksize to be used by the iterative solver in solving this eigenproblem.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 361 of file AnasaziBlockKrylovSchur.hpp.
|
inline |
Get the number of Ritz vectors to compute.
Definition at line 364 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Get the dimension of the search subspace used to generate the current eigenvectors and eigenvalues.
false
, the return is 0. Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 371 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Get the maximum dimension allocated for the search subspace.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 377 of file AnasaziBlockKrylovSchur.hpp.
|
virtual |
Set the auxiliary vectors for the solver.
Because the current Krylov subspace cannot be assumed orthogonal to the new auxiliary vectors, a call to setAuxVecs() will reset the solver to the uninitialized state. This happens only in the case where the new auxiliary vectors have a combined dimension of greater than zero.
In order to preserve the current state, the user will need to extract it from the solver using getState(), orthogonalize it against the new auxiliary vectors, and reinitialize using initialize().
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 751 of file AnasaziBlockKrylovSchur.hpp.
|
inlinevirtual |
Get the auxiliary vectors for the solver.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 395 of file AnasaziBlockKrylovSchur.hpp.
|
virtual |
This method requests that the solver print out its current status to screen.
Implements Anasazi::Eigensolver< ScalarType, MV, OP >.
Definition at line 1720 of file AnasaziBlockKrylovSchur.hpp.
|
inline |
Get the status of the Ritz vectors currently stored in the eigensolver.
Definition at line 411 of file AnasaziBlockKrylovSchur.hpp.
|
inline |
Get the status of the Ritz values currently stored in the eigensolver.
Definition at line 414 of file AnasaziBlockKrylovSchur.hpp.
|
inline |
Get the status of the Schur form currently stored in the eigensolver.
Definition at line 417 of file AnasaziBlockKrylovSchur.hpp.
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::computeRitzVectors | ( | ) |
Compute the Ritz vectors using the current Krylov factorization.
Definition at line 1246 of file AnasaziBlockKrylovSchur.hpp.
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::computeRitzValues | ( | ) |
Compute the Ritz values using the current Krylov factorization.
Definition at line 1218 of file AnasaziBlockKrylovSchur.hpp.
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::computeSchurForm | ( | const bool | sort = true | ) |
Compute the Schur form of the projected eigenproblem from the current Krylov factorization.
Definition at line 1421 of file AnasaziBlockKrylovSchur.hpp.