Belos Package Browser (Single Doxygen Collection)
Development
|
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>
Public Types | |
typedef MultiVecTraits < ScalarType, MV > | MVT |
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. More... | |
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 ¶ms) | |
PCPGIter constructor with linear problem, solver utilities, and parameter list of solver options. More... | |
virtual | ~PCPGIter () |
Destructor. More... | |
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. More... | |
void | initialize (PCPGIterState< ScalarType, MV > &newstate) |
Initialize the solver to an iterate, providing a complete state. More... | |
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. More... | |
PCPGIterState< ScalarType, MV > | getState () const |
Get the current state of the linear solver. More... | |
Status methods | |
int | getNumIters () const |
Get the current iteration count. More... | |
void | resetNumIters (int iter=0) |
Reset the iteration count. More... | |
Teuchos::RCP< const MV > | getNativeResiduals (std::vector< MagnitudeType > *) const |
Get the norms of the residuals native to the solver. More... | |
Teuchos::RCP< MV > | getCurrentUpdate () const |
Get the current update to the linear system solution?. More... | |
int | getCurSubspaceDim () const |
Get the current dimension of the whole seed subspace. More... | |
int | getPrevSubspaceDim () const |
Get the dimension of the search subspace used to solve the current solution to the linear problem. More... | |
Accessor methods | |
const LinearProblem < ScalarType, MV, OP > & | getProblem () const |
Get a constant reference to the linear problem. More... | |
int | getBlockSize () const |
Get the maximum number of blocks used by the iterative solver in solving this linear problem. More... | |
int | getNumRecycledBlocks () const |
Get the maximum number of recycled blocks used by the iterative solver in solving this linear problem. More... | |
void | setBlockSize (int blockSize) |
Get the blocksize to be used by the iterative solver in solving this linear problem. More... | |
void | setSize (int savedBlocks) |
Set the maximum number of saved or recycled blocks used by the iterative solver. More... | |
bool | isInitialized () |
States whether the solver has been initialized or not. More... | |
void | resetState () |
tell the Iterator to "reset" itself; delete and rebuild the seed space. More... | |
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.
Definition at line 133 of file BelosPCPGIter.hpp.
typedef MultiVecTraits<ScalarType,MV> Belos::PCPGIter< ScalarType, MV, OP >::MVT |
Definition at line 140 of file BelosPCPGIter.hpp.
typedef OperatorTraits<ScalarType,MV,OP> Belos::PCPGIter< ScalarType, MV, OP >::OPT |
Definition at line 141 of file BelosPCPGIter.hpp.
typedef Teuchos::ScalarTraits<ScalarType> Belos::PCPGIter< ScalarType, MV, OP >::SCT |
Definition at line 142 of file BelosPCPGIter.hpp.
typedef SCT::magnitudeType Belos::PCPGIter< ScalarType, MV, OP >::MagnitudeType |
Definition at line 143 of file BelosPCPGIter.hpp.
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:
bool
specifying whether the timers should be restarted each time iterate() is called. Default: falsebool
specifying whether the upper Hessenberg should be stored separately from the least squares system. Default: false Definition at line 385 of file BelosPCPGIter.hpp.
|
inlinevirtual |
Destructor.
Definition at line 162 of file BelosPCPGIter.hpp.
|
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:
The status test is queried at the beginning of the iteration. Potential CG exceptions include IterationInit, Iterate
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 626 of file BelosPCPGIter.hpp.
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.
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.
newstate
which directly points to the multivectors in the solver, the data is not (supposed to be) copied. Definition at line 538 of file BelosPCPGIter.hpp.
|
inlinevirtual |
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 212 of file BelosPCPGIter.hpp.
|
inline |
Get the current state of the linear solver.
The data is only valid if isInitialized() == true
.
Definition at line 225 of file BelosPCPGIter.hpp.
|
inlinevirtual |
Get the current iteration count.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 246 of file BelosPCPGIter.hpp.
|
inlinevirtual |
Reset the iteration count.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 249 of file BelosPCPGIter.hpp.
|
inline |
Get the norms of the residuals native to the solver.
Definition at line 253 of file BelosPCPGIter.hpp.
|
inlinevirtual |
Get the current update to the linear system solution?.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 259 of file BelosPCPGIter.hpp.
|
inline |
Get the current dimension of the whole seed subspace.
Definition at line 262 of file BelosPCPGIter.hpp.
|
inline |
Get the dimension of the search subspace used to solve the current solution to the linear problem.
Definition at line 268 of file BelosPCPGIter.hpp.
|
inlinevirtual |
Get a constant reference to the linear problem.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 280 of file BelosPCPGIter.hpp.
|
inlinevirtual |
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 283 of file BelosPCPGIter.hpp.
|
inline |
Get the maximum number of recycled blocks used by the iterative solver in solving this linear problem.
Definition at line 286 of file BelosPCPGIter.hpp.
|
inlinevirtual |
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 291 of file BelosPCPGIter.hpp.
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 422 of file BelosPCPGIter.hpp.
|
inlinevirtual |
States whether the solver has been initialized or not.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 300 of file BelosPCPGIter.hpp.
void Belos::PCPGIter< ScalarType, MV, OP >::resetState | ( | ) |
tell the Iterator to "reset" itself; delete and rebuild the seed space.
Definition at line 442 of file BelosPCPGIter.hpp.
|
private |
Method for initalizing the state storage needed by PCPG.
Definition at line 454 of file BelosPCPGIter.hpp.
|
private |
Definition at line 318 of file BelosPCPGIter.hpp.
|
private |
Definition at line 319 of file BelosPCPGIter.hpp.
|
private |
Definition at line 320 of file BelosPCPGIter.hpp.
|
private |
Definition at line 321 of file BelosPCPGIter.hpp.
|
private |
Definition at line 326 of file BelosPCPGIter.hpp.
|
private |
Definition at line 334 of file BelosPCPGIter.hpp.
|
private |
Definition at line 339 of file BelosPCPGIter.hpp.
|
private |
Definition at line 342 of file BelosPCPGIter.hpp.
|
private |
Definition at line 346 of file BelosPCPGIter.hpp.
|
private |
Definition at line 349 of file BelosPCPGIter.hpp.
|
private |
Definition at line 352 of file BelosPCPGIter.hpp.
|
private |
Definition at line 355 of file BelosPCPGIter.hpp.
|
private |
Definition at line 360 of file BelosPCPGIter.hpp.
|
private |
Definition at line 363 of file BelosPCPGIter.hpp.
|
private |
Definition at line 366 of file BelosPCPGIter.hpp.
|
private |
Definition at line 369 of file BelosPCPGIter.hpp.
|
private |
Definition at line 372 of file BelosPCPGIter.hpp.
|
private |
Definition at line 375 of file BelosPCPGIter.hpp.
|
private |
Definition at line 379 of file BelosPCPGIter.hpp.