Belos Package Browser (Single Doxygen Collection) Development
Public Types | Private Member Functions | Private Attributes
Belos::PCPGIter< ScalarType, MV, OP > Class Template Reference

This class implements the PCPG iteration, where a single-std::vector Krylov subspace is constructed. The documentation refers to blocks, but note that at this point, all blocks have unit dimension. More...

#include <BelosPCPGIter.hpp>

Inheritance diagram for Belos::PCPGIter< ScalarType, MV, OP >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef MultiVecTraits
< ScalarType, MV > 
MVT
typedef MultiVecTraitsExt
< ScalarType, MV > 
MVText
typedef OperatorTraits
< ScalarType, MV, OP > 
OPT
typedef Teuchos::ScalarTraits
< ScalarType > 
SCT
typedef SCT::magnitudeType MagnitudeType

Private Member Functions

void setStateSize ()
 Method for initalizing the state storage needed by PCPG.

Private Attributes

const Teuchos::RCP
< LinearProblem< ScalarType,
MV, OP > > 
lp_
const Teuchos::RCP
< OutputManager< ScalarType > > 
om_
const Teuchos::RCP< StatusTest
< ScalarType, MV, OP > > 
stest_
const Teuchos::RCP
< OrthoManager< ScalarType, MV > > 
ortho_
int savedBlocks_
bool initialized_
bool stateStorageInitialized_
bool keepDiagonal_
bool initDiagonal_
int curDim_
int prevUdim_
int iter_
Teuchos::RCP< MV > R_
Teuchos::RCP< MV > Z_
Teuchos::RCP< MV > P_
Teuchos::RCP< MV > AP_
Teuchos::RCP< MV > U_
Teuchos::RCP< MV > C_
Teuchos::RCP
< Teuchos::SerialDenseMatrix
< int, ScalarType > > 
D_

Constructors/Destructor

 PCPGIter (const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem, const Teuchos::RCP< OutputManager< ScalarType > > &printer, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &tester, const Teuchos::RCP< MatOrthoManager< ScalarType, MV, OP > > &ortho, Teuchos::ParameterList &params)
 PCPGIter constructor with linear problem, solver utilities, and parameter list of solver options.
virtual ~PCPGIter ()
 Destructor.

Solver methods

void iterate ()
 PCPGIter iterates CG until the status test either requests a stop or detects an error. In the latter case, std::exception is thrown.
void initialize (PCPGIterState< ScalarType, MV > newstate)
 Initialize the solver to an iterate, providing a complete state.
void initialize ()
 Initialize the solver with the initial vectors from the linear problem. An exception is thrown if initialzed is called and newstate.R is null.
PCPGIterState< ScalarType, MV > getState () const
 Get the current state of the linear solver.

Status methods

int getNumIters () const
 Get the current iteration count.
void resetNumIters (int iter=0)
 Reset the iteration count.
Teuchos::RCP< const MV > getNativeResiduals (std::vector< MagnitudeType > *norms) const
 Get the norms of the residuals native to the solver.
Teuchos::RCP< MV > getCurrentUpdate () const
 Get the current update to the linear system solution?.
int getCurSubspaceDim () const
 Get the current dimension of the whole seed subspace.
int getPrevSubspaceDim () const
 Get the dimension of the search subspace used to solve the current solution to the linear problem.

Accessor methods

const LinearProblem
< ScalarType, MV, OP > & 
getProblem () const
 Get a constant reference to the linear problem.
int getBlockSize () const
 Get the maximum number of blocks used by the iterative solver in solving this linear problem.
int getNumRecycledBlocks () const
 Get the maximum number of recycled blocks used by the iterative solver in solving this linear problem.
void setBlockSize (int blockSize)
 Get the blocksize to be used by the iterative solver in solving this linear problem.
void setSize (int savedBlocks)
 Set the maximum number of saved or recycled blocks used by the iterative solver.
bool isInitialized ()
 States whether the solver has been initialized or not.
void resetState ()
 tell the Iterator to "reset" itself; delete and rebuild the seed space.

Detailed Description

template<class ScalarType, class MV, class OP>
class Belos::PCPGIter< ScalarType, MV, OP >

This class implements the PCPG iteration, where a single-std::vector Krylov subspace is constructed. The documentation refers to blocks, but note that at this point, all blocks have unit dimension.

Author:
David Day

Definition at line 185 of file BelosPCPGIter.hpp.


Member Typedef Documentation

template<class ScalarType , class MV , class OP >
typedef MultiVecTraits<ScalarType,MV> Belos::PCPGIter< ScalarType, MV, OP >::MVT

Definition at line 192 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
typedef MultiVecTraitsExt<ScalarType,MV> Belos::PCPGIter< ScalarType, MV, OP >::MVText

Definition at line 193 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
typedef OperatorTraits<ScalarType,MV,OP> Belos::PCPGIter< ScalarType, MV, OP >::OPT

Definition at line 194 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
typedef Teuchos::ScalarTraits<ScalarType> Belos::PCPGIter< ScalarType, MV, OP >::SCT

Definition at line 195 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
typedef SCT::magnitudeType Belos::PCPGIter< ScalarType, MV, OP >::MagnitudeType

Definition at line 196 of file BelosPCPGIter.hpp.


Constructor & Destructor Documentation

template<class ScalarType , class MV , class OP >
Belos::PCPGIter< ScalarType, MV, OP >::PCPGIter ( const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &  problem,
const Teuchos::RCP< OutputManager< ScalarType > > &  printer,
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &  tester,
const Teuchos::RCP< MatOrthoManager< ScalarType, MV, OP > > &  ortho,
Teuchos::ParameterList params 
)

PCPGIter constructor with linear problem, solver utilities, and parameter list of solver options.

This constructor takes pointers required by the linear solver, in addition to a parameter list of options for the linear solver. These options include the following:

  • "Restart Timers" = a bool specifying whether the timers should be restarted each time iterate() is called. Default: false
  • "Keep Diagonal" = a bool specifying whether the upper Hessenberg should be stored separately from the least squares system. Default: false

Definition at line 438 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
virtual Belos::PCPGIter< ScalarType, MV, OP >::~PCPGIter ( ) [inline, virtual]

Destructor.

Definition at line 215 of file BelosPCPGIter.hpp.


Member Function Documentation

template<class ScalarType , class MV , class OP >
void Belos::PCPGIter< ScalarType, MV, OP >::iterate ( ) [virtual]

PCPGIter iterates CG until the status test either requests a stop or detects an error. In the latter case, std::exception is thrown.

iterate() will first determine whether or not the solver is inintialized; if not, iterate() will call initialize() using default arguments. After initialization, the solver performs CG iterations until the status test evaluates as Passed, at which point the method returns to the caller.

The PCPG iteration proceeds as follows:

  1. the operator problem->applyOp() is applied to the newest vector in the Krylov basis,
  2. the result is (approximately) A-orthogonalized to the previous basis vectors,
  3. the coupled two-term recurrence is iterated,
  4. the search direction P is projected into a complement of the seed space U.

The status test is queried at the beginning of the iteration. Potential CG exceptions include IterationInit, Iterate and IterationLAPACKFailure

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 679 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::PCPGIter< ScalarType, MV, OP >::initialize ( PCPGIterState< ScalarType, MV >  newstate)

Initialize the solver to an iterate, providing a complete state.

The PCPGIter state consists of the CGIter state, the stored search directions and the seed space. The constructor calls setSize() which calls setStateSize().

initialize(IterState) also calls setStateSize(), passing the current seed space to Iterate. initialize(IterState) sets the state to the specified IterState and then initialized_ := true. Fundamental state changes cause initialized_ := false.

Postcondition:
isInitialized() == true

Optionally, the user may specify any component of the state using initialize(). Any 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 (supposed to be) copied.

Definition at line 591 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::PCPGIter< ScalarType, MV, OP >::initialize ( ) [inline, virtual]

Initialize the solver with the initial vectors from the linear problem. An exception is thrown if initialzed is called and newstate.R is null.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 265 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
PCPGIterState<ScalarType,MV> Belos::PCPGIter< ScalarType, MV, OP >::getState ( ) const [inline]

Get the current state of the linear solver.

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

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

Definition at line 278 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
int Belos::PCPGIter< ScalarType, MV, OP >::getNumIters ( ) const [inline, virtual]

Get the current iteration count.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 299 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::PCPGIter< ScalarType, MV, OP >::resetNumIters ( int  iter = 0) [inline, virtual]

Reset the iteration count.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 302 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP<const MV> Belos::PCPGIter< ScalarType, MV, OP >::getNativeResiduals ( std::vector< MagnitudeType > *  norms) const [inline]

Get the norms of the residuals native to the solver.

Returns:
A std::vector of length blockSize containing the native residuals.

Definition at line 306 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP<MV> Belos::PCPGIter< ScalarType, MV, OP >::getCurrentUpdate ( ) const [inline, virtual]

Get the current update to the linear system solution?.

Note:
getCurrentUpdate returns a null pointer indicating that the linear problem contains the current solution.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 312 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
int Belos::PCPGIter< ScalarType, MV, OP >::getCurSubspaceDim ( ) const [inline]

Get the current dimension of the whole seed subspace.

Definition at line 315 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
int Belos::PCPGIter< ScalarType, MV, OP >::getPrevSubspaceDim ( ) const [inline]

Get the dimension of the search subspace used to solve the current solution to the linear problem.

Definition at line 321 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
const LinearProblem<ScalarType,MV,OP>& Belos::PCPGIter< ScalarType, MV, OP >::getProblem ( ) const [inline, virtual]

Get a constant reference to the linear problem.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 333 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
int Belos::PCPGIter< ScalarType, MV, OP >::getBlockSize ( ) const [inline, virtual]

Get the maximum number of blocks used by the iterative solver in solving this linear problem.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 336 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
int Belos::PCPGIter< ScalarType, MV, OP >::getNumRecycledBlocks ( ) const [inline]

Get the maximum number of recycled blocks used by the iterative solver in solving this linear problem.

Definition at line 339 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::PCPGIter< ScalarType, MV, OP >::setBlockSize ( int  blockSize) [inline, virtual]

Get the blocksize to be used by the iterative solver in solving this linear problem.

Set the blocksize.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 344 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::PCPGIter< ScalarType, MV, OP >::setSize ( int  savedBlocks)

Set the maximum number of saved or recycled blocks used by the iterative solver.

Definition at line 475 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
bool Belos::PCPGIter< ScalarType, MV, OP >::isInitialized ( ) [inline, virtual]

States whether the solver has been initialized or not.

Implements Belos::Iteration< ScalarType, MV, OP >.

Definition at line 353 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::PCPGIter< ScalarType, MV, OP >::resetState ( )

tell the Iterator to "reset" itself; delete and rebuild the seed space.

Definition at line 495 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
void Belos::PCPGIter< ScalarType, MV, OP >::setStateSize ( ) [private]

Method for initalizing the state storage needed by PCPG.

Definition at line 507 of file BelosPCPGIter.hpp.


Member Data Documentation

template<class ScalarType , class MV , class OP >
const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > Belos::PCPGIter< ScalarType, MV, OP >::lp_ [private]

Definition at line 371 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
const Teuchos::RCP<OutputManager<ScalarType> > Belos::PCPGIter< ScalarType, MV, OP >::om_ [private]

Definition at line 372 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
const Teuchos::RCP<StatusTest<ScalarType,MV,OP> > Belos::PCPGIter< ScalarType, MV, OP >::stest_ [private]

Definition at line 373 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
const Teuchos::RCP<OrthoManager<ScalarType,MV> > Belos::PCPGIter< ScalarType, MV, OP >::ortho_ [private]

Definition at line 374 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
int Belos::PCPGIter< ScalarType, MV, OP >::savedBlocks_ [private]

Definition at line 379 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
bool Belos::PCPGIter< ScalarType, MV, OP >::initialized_ [private]

Definition at line 387 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
bool Belos::PCPGIter< ScalarType, MV, OP >::stateStorageInitialized_ [private]

Definition at line 392 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
bool Belos::PCPGIter< ScalarType, MV, OP >::keepDiagonal_ [private]

Definition at line 395 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
bool Belos::PCPGIter< ScalarType, MV, OP >::initDiagonal_ [private]

Definition at line 399 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
int Belos::PCPGIter< ScalarType, MV, OP >::curDim_ [private]

Definition at line 402 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
int Belos::PCPGIter< ScalarType, MV, OP >::prevUdim_ [private]

Definition at line 405 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
int Belos::PCPGIter< ScalarType, MV, OP >::iter_ [private]

Definition at line 408 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP<MV> Belos::PCPGIter< ScalarType, MV, OP >::R_ [private]

Definition at line 413 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP<MV> Belos::PCPGIter< ScalarType, MV, OP >::Z_ [private]

Definition at line 416 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP<MV> Belos::PCPGIter< ScalarType, MV, OP >::P_ [private]

Definition at line 419 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP<MV> Belos::PCPGIter< ScalarType, MV, OP >::AP_ [private]

Definition at line 422 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP<MV> Belos::PCPGIter< ScalarType, MV, OP >::U_ [private]

Definition at line 425 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP<MV> Belos::PCPGIter< ScalarType, MV, OP >::C_ [private]

Definition at line 428 of file BelosPCPGIter.hpp.

template<class ScalarType , class MV , class OP >
Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > Belos::PCPGIter< ScalarType, MV, OP >::D_ [private]

Definition at line 432 of file BelosPCPGIter.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines