Anasazi  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
List of all members
Anasazi::BlockKrylovSchur< ScalarType, MV, OP > Class Template Reference

This class implements the block Krylov-Schur iteration, for solving linear eigenvalue problems. More...

#include <AnasaziBlockKrylovSchur.hpp>

Inheritance diagram for Anasazi::BlockKrylovSchur< ScalarType, MV, OP >:
Anasazi::Eigensolver< ScalarType, MV, OP >

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 &params)
 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 &params)
 Basic Constructor. More...
 
virtual ~Eigensolver ()
 Destructor. More...
 

Detailed Description

template<class ScalarType, class MV, class OP>
class Anasazi::BlockKrylovSchur< ScalarType, MV, OP >

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.

Author
Chris Baker, Ulrich Hetmaniuk, Rich Lehoucq, Heidi Thornquist

Definition at line 147 of file AnasaziBlockKrylovSchur.hpp.

Constructor & Destructor Documentation

template<class ScalarType , class MV , class OP >
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:

  • "Block Size" - an int specifying the block size used by the algorithm. This can also be specified using the setBlockSize() method. Default: 1
  • "Num Blocks" - an int specifying the maximum number of blocks allocated for the solver basis. Default: 3*problem->getNEV()
  • "Step Size" - an int specifying how many iterations are performed between computations of eigenvalues and eigenvectors.
    Note: This parameter is mandatory.
  • "Number of Ritz Vectors" - an int specifying how many Ritz vectors are computed on calls to getRitzVectors(). Default: 0
  • "Print Number of Ritz Values" - an int specifying how many Ritz values are printed on calls to currentStatus(). Default: "Block Size"

Definition at line 557 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
virtual Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::~BlockKrylovSchur ( )
inlinevirtual

BlockKrylovSchur destructor.

Definition at line 172 of file AnasaziBlockKrylovSchur.hpp.

Member Function Documentation

template<class ScalarType , class MV , class OP >
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::iterate ( )
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:

  1. The operator problem->getOperator() is applied to the newest blockSize vectors in the Krylov basis.
  2. The resulting vectors are orthogonalized against the auxiliary vectors and the previous basis vectors, and made orthonormal.
  3. The Hessenberg matrix is updated.
  4. If we have performed 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.

template<class ScalarType , class MV , class OP >
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.

Postcondition
isInitialized() == 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.

template<class ScalarType , class MV , class OP >
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::initialize ( )
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.

template<class ScalarType , class MV , class OP >
bool Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::isInitialized ( ) const
inlinevirtual

Indicates whether the solver has been initialized or not.

Returns
bool indicating the state of the solver.
Postcondition
If isInitialized() == true:
  • the first getCurSubspaceDim() vectors of V are orthogonal to auxiliary vectors and have orthonormal columns
  • the principal Hessenberg submatrix of of H contains the Hessenberg matrix associated with V

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 238 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
BlockKrylovSchurState<ScalarType,MV> Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getState ( ) const
inline

Get the current state of the eigensolver.

The data is only valid if isInitialized() == true.

Returns
A BlockKrylovSchurState object containing const pointers to the current solver state.

Definition at line 247 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
int Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getNumIters ( ) const
inlinevirtual

Get the current iteration count.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 264 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::resetNumIters ( )
inlinevirtual

Reset the iteration count.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 267 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP<const MV> Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getRitzVectors ( )
inlinevirtual

Get the Ritz vectors.

Returns
A multivector of columns not exceeding the maximum dimension of the subspace containing the Ritz vectors from the most recent call to computeRitzVectors().
Note
To see if the returned Ritz vectors are current, call isRitzVecsCurrent().

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 276 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
std::vector<Value<ScalarType> > Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getRitzValues ( )
inlinevirtual

Get the Ritz values.

Returns
A vector of length not exceeding the maximum dimension of the subspace containing the Ritz values from the most recent Schur form update.
Note
To see if the returned Ritz values are current, call isRitzValsCurrent().

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 285 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
std::vector<int> Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getRitzIndex ( )
inlinevirtual

Get the Ritz index vector.

Returns
A vector of length not exceeding the maximum dimension of the subspace containing the index vector for the Ritz values and Ritz vectors, if they are computed.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 296 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
std::vector<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getResNorms ( )
inlinevirtual

Get the current residual norms.

Note
Block Krylov-Schur cannot provide this so a zero length vector will be returned.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 302 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
std::vector<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getRes2Norms ( )
inlinevirtual

Get the current residual 2-norms.

Note
Block Krylov-Schur cannot provide this so a zero length vector will be returned.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 311 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
std::vector<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType> Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getRitzRes2Norms ( )
inlinevirtual

Get the current Ritz residual 2-norms.

Returns
A vector of length blockSize containing the 2-norms of the Ritz residuals.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 320 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::setStatusTest ( Teuchos::RCP< StatusTest< ScalarType, MV, OP > >  test)
virtual

Set a new StatusTest for the solver.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 1394 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP< StatusTest< ScalarType, MV, OP > > Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getStatusTest ( ) const
virtual

Get the current StatusTest used by the solver.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 1403 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
const Eigenproblem<ScalarType,MV,OP>& Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getProblem ( ) const
inlinevirtual

Get a constant reference to the eigenvalue problem.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 338 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
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.

template<class ScalarType , class MV , class OP >
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::setBlockSize ( int  blockSize)
virtual

Set the blocksize.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 650 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::setStepSize ( int  stepSize)

Set the step size.

Definition at line 659 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
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.

template<class ScalarType , class MV , class OP >
int Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getStepSize ( ) const
inline

Get the step size.

Definition at line 358 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
int Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getBlockSize ( ) const
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.

template<class ScalarType , class MV , class OP >
int Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getNumRitzVectors ( ) const
inline

Get the number of Ritz vectors to compute.

Definition at line 364 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
int Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getCurSubspaceDim ( ) const
inlinevirtual

Get the dimension of the search subspace used to generate the current eigenvectors and eigenvalues.

Returns
An integer specifying the rank of the Krylov subspace currently in use by the eigensolver. If isInitialized() == false, the return is 0.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 371 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
int Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getMaxSubspaceDim ( ) const
inlinevirtual

Get the maximum dimension allocated for the search subspace.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 377 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::setAuxVecs ( const Teuchos::Array< Teuchos::RCP< const MV > > &  auxvecs)
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.

template<class ScalarType , class MV , class OP >
Teuchos::Array<Teuchos::RCP<const MV> > Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::getAuxVecs ( ) const
inlinevirtual

Get the auxiliary vectors for the solver.

Implements Anasazi::Eigensolver< ScalarType, MV, OP >.

Definition at line 395 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::currentStatus ( std::ostream &  os)
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.

template<class ScalarType , class MV , class OP >
bool Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::isRitzVecsCurrent ( ) const
inline

Get the status of the Ritz vectors currently stored in the eigensolver.

Definition at line 411 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
bool Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::isRitzValsCurrent ( ) const
inline

Get the status of the Ritz values currently stored in the eigensolver.

Definition at line 414 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
bool Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::isSchurCurrent ( ) const
inline

Get the status of the Schur form currently stored in the eigensolver.

Definition at line 417 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::computeRitzVectors ( )

Compute the Ritz vectors using the current Krylov factorization.

Definition at line 1246 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
void Anasazi::BlockKrylovSchur< ScalarType, MV, OP >::computeRitzValues ( )

Compute the Ritz values using the current Krylov factorization.

Definition at line 1218 of file AnasaziBlockKrylovSchur.hpp.

template<class ScalarType , class MV , class OP >
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.


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