Belos Package Browser (Single Doxygen Collection)
Development
|
MINRES implementation. More...
#include <BelosMinresIter.hpp>
Public Types | |
typedef MultiVecTraits < ScalarType, MV > | MVT |
typedef OperatorTraits < ScalarType, MV, OP > | OPT |
typedef Teuchos::ScalarTraits < ScalarType > | SCT |
typedef SCT::magnitudeType | MagnitudeType |
typedef Teuchos::ScalarTraits < MagnitudeType > | SMT |
Private Member Functions | |
void | setStateSize () |
Method for initalizing the state storage needed by MINRES. 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_ |
bool | initialized_ |
Whether the solver has been initialized. More... | |
bool | stateStorageInitialized_ |
Whether the state storage has been initialized. More... | |
int | iter_ |
Current number of iterations performed. More... | |
MagnitudeType | phibar_ |
Teuchos::RCP< MV > | Y_ |
Preconditioned residual. More... | |
Teuchos::RCP< MV > | R1_ |
Previous residual. More... | |
Teuchos::RCP< MV > | R2_ |
Previous residual. More... | |
Teuchos::RCP< MV > | W_ |
Direction vector. More... | |
Teuchos::RCP< MV > | W1_ |
Previous direction vector. More... | |
Teuchos::RCP< MV > | W2_ |
Previous direction vector. More... | |
Teuchos::SerialDenseMatrix < int, ScalarType > | beta1_ |
Coefficient in the MINRES iteration. More... | |
Constructors/Destructor | |
MinresIter (const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem, const Teuchos::RCP< OutputManager< ScalarType > > &printer, const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &tester, const Teuchos::ParameterList ¶ms) | |
Constructor. More... | |
virtual | ~MinresIter () |
Destructor. More... | |
Solver methods | |
void | iterate () |
Perform MINRES iterations until convergence or error. More... | |
void | initializeMinres (const MinresIterationState< ScalarType, MV > &newstate) |
Initialize the solver to an iterate, providing a complete state. More... | |
void | initialize () |
Initialize the solver. More... | |
MinresIterationState < 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 > *norms) 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. More... | |
void | symOrtho (ScalarType a, ScalarType b, ScalarType *c, ScalarType *s, ScalarType *r) |
Accessor methods | |
const LinearProblem < ScalarType, MV, OP > & | getProblem () const |
Get a constant reference to the linear problem. More... | |
int | getBlockSize () const |
Get the blocksize to be used by the iterative solver in solving this linear problem. More... | |
void | setBlockSize (int blockSize) |
Set the blocksize to be used by the iterative solver in solving this linear problem. More... | |
bool | isInitialized () const |
States whether the solver has been initialized or not. More... | |
bool | isInitialized () |
States whether the solver has been initialized or not. More... | |
MINRES implementation.
Implementation of the preconditioned Minimal Residual Method (MINRES) iteration. This a bilinear form implementation, that uses inner products of the form <x,My> to solve the preconditioned linear system. Thus, it is necessary that the left preconditioner M is positive definite.
Definition at line 62 of file BelosMinresIter.hpp.
typedef MultiVecTraits< ScalarType, MV > Belos::MinresIter< ScalarType, MV, OP >::MVT |
Definition at line 69 of file BelosMinresIter.hpp.
typedef OperatorTraits< ScalarType, MV, OP > Belos::MinresIter< ScalarType, MV, OP >::OPT |
Definition at line 70 of file BelosMinresIter.hpp.
typedef Teuchos::ScalarTraits< ScalarType > Belos::MinresIter< ScalarType, MV, OP >::SCT |
Definition at line 71 of file BelosMinresIter.hpp.
typedef SCT::magnitudeType Belos::MinresIter< ScalarType, MV, OP >::MagnitudeType |
Definition at line 72 of file BelosMinresIter.hpp.
typedef Teuchos::ScalarTraits< MagnitudeType > Belos::MinresIter< ScalarType, MV, OP >::SMT |
Definition at line 73 of file BelosMinresIter.hpp.
Belos::MinresIter< ScalarType, MV, OP >::MinresIter | ( | const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > & | problem, |
const Teuchos::RCP< OutputManager< ScalarType > > & | printer, | ||
const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > & | tester, | ||
const Teuchos::ParameterList & | params | ||
) |
Constructor.
problem The linear problem to solve printer Output manager, for intermediate solver output tester Status test for determining when the current approximate solution has converged params Parameter list of solver options
Definition at line 293 of file BelosMinresIter.hpp.
|
inlinevirtual |
Destructor.
Definition at line 92 of file BelosMinresIter.hpp.
|
virtual |
Perform MINRES iterations until convergence or error.
Perform MINRES iterations until the status test indicates the need to stop, or until an error occurs. In the latter case, a (subclass of) std::exception is thrown.
iterate() will first determine whether the solver is initialized; if not, it will call initialize() using default arguments. After initialization, the solver performs MINRES iterations until the status test evaluates as Passed, at which point the method returns to the caller.
The status test is queried at the beginning of the iteration.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 426 of file BelosMinresIter.hpp.
|
virtual |
Initialize the solver to an iterate, providing a complete state.
The MinresIter contains a certain amount of state, consisting of the current residual, preconditioned residual, and decent direction.
initialize() gives the user the opportunity to manually set these, although only the current unpreconditioned residual is required.
true
(see post-conditions of isInitialize())newstate
which directly points to the multivectors in the solver, the data is not copied. Implements Belos::MinresIteration< ScalarType, MV, OP >.
Definition at line 348 of file BelosMinresIter.hpp.
|
inlinevirtual |
Initialize the solver.
Initialize the solver. If a starting guess is provided in the linear problem, use that. Otherwise, choose a random starting guess.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 136 of file BelosMinresIter.hpp.
|
inlinevirtual |
Get the current state of the linear solver.
The returned current state is only valid if isInitialized() == true
.
Implements Belos::MinresIteration< ScalarType, MV, OP >.
Definition at line 148 of file BelosMinresIter.hpp.
|
inlinevirtual |
Get the current iteration count.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 169 of file BelosMinresIter.hpp.
|
inlinevirtual |
Reset the iteration count.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 172 of file BelosMinresIter.hpp.
|
inline |
Get the norms of the residuals native to the solver.
Definition at line 177 of file BelosMinresIter.hpp.
|
inlinevirtual |
Get the current update to the linear system.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 192 of file BelosMinresIter.hpp.
void Belos::MinresIter< ScalarType, MV, OP >::symOrtho | ( | ScalarType | a, |
ScalarType | b, | ||
ScalarType * | c, | ||
ScalarType * | s, | ||
ScalarType * | r | ||
) |
Definition at line 582 of file BelosMinresIter.hpp.
|
inlinevirtual |
Get a constant reference to the linear problem.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 203 of file BelosMinresIter.hpp.
|
inlinevirtual |
Get the blocksize to be used by the iterative solver in solving this linear problem.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 206 of file BelosMinresIter.hpp.
|
inlinevirtual |
Set the blocksize to be used by the iterative solver in solving this linear problem.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 209 of file BelosMinresIter.hpp.
|
inline |
States whether the solver has been initialized or not.
Definition at line 215 of file BelosMinresIter.hpp.
|
inlinevirtual |
States whether the solver has been initialized or not.
Implements Belos::Iteration< ScalarType, MV, OP >.
Definition at line 216 of file BelosMinresIter.hpp.
|
private |
Method for initalizing the state storage needed by MINRES.
Definition at line 310 of file BelosMinresIter.hpp.
|
private |
Definition at line 231 of file BelosMinresIter.hpp.
|
private |
Definition at line 232 of file BelosMinresIter.hpp.
|
private |
Definition at line 233 of file BelosMinresIter.hpp.
|
private |
Whether the solver has been initialized.
If initialized_ == true, then the basis vectors have been initialized and the iterate() routine is capable of running. initialize is set by the initialize() member method. For the implications of the state of initialized, please see documentation for initialize().
Definition at line 243 of file BelosMinresIter.hpp.
|
private |
Whether the state storage has been initialized.
If stateStorageInitialized_ == true, then the state storage has been initialized. This initialization may be postponed if the linear problem was generated without the right-hand side or solution vectors.
Definition at line 251 of file BelosMinresIter.hpp.
|
private |
Current number of iterations performed.
Definition at line 254 of file BelosMinresIter.hpp.
|
private |
Definition at line 260 of file BelosMinresIter.hpp.
|
private |
Preconditioned residual.
Definition at line 267 of file BelosMinresIter.hpp.
|
private |
Previous residual.
Definition at line 269 of file BelosMinresIter.hpp.
|
private |
Previous residual.
Definition at line 271 of file BelosMinresIter.hpp.
|
private |
Direction vector.
Definition at line 273 of file BelosMinresIter.hpp.
|
private |
Previous direction vector.
Definition at line 275 of file BelosMinresIter.hpp.
|
private |
Previous direction vector.
Definition at line 277 of file BelosMinresIter.hpp.
|
private |
Coefficient in the MINRES iteration.
Definition at line 286 of file BelosMinresIter.hpp.