10#ifndef BELOS_PSEUDO_BLOCK_GMRES_SOLMGR_HPP
11#define BELOS_PSEUDO_BLOCK_GMRES_SOLMGR_HPP
29#ifdef BELOS_TEUCHOS_TIME_MONITOR
30#include "Teuchos_TimeMonitor.hpp"
91 template<
class ScalarType,
class MV,
class OP,
class DM = DefaultDenseMatrix<
int,ScalarType>>
98 typedef Teuchos::ScalarTraits<ScalarType> SCT;
99 typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType MagnitudeType;
100 typedef Teuchos::ScalarTraits<MagnitudeType> MT;
227 const Teuchos::RCP<Teuchos::ParameterList> &
pl );
233 Teuchos::RCP<SolverManager<ScalarType, MV, OP, DM> >
clone ()
const override {
256 Teuchos::Array<Teuchos::RCP<Teuchos::Time> >
getTimers()
const {
257 return Teuchos::tuple(timerSolve_);
413 const Teuchos::EVerbosityLevel
verbLevel =
414 Teuchos::Describable::verbLevel_default)
const override;
437 bool checkStatusTest();
440 Teuchos::RCP<LinearProblem<ScalarType,MV,OP,DM> > problem_;
443 Teuchos::RCP<OutputManager<ScalarType> > printer_;
444 Teuchos::RCP<std::ostream> outputStream_;
447 Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > userConvStatusTest_;
448 Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > debugStatusTest_;
449 Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > sTest_;
450 Teuchos::RCP<StatusTestMaxIters<ScalarType,MV,OP,DM> > maxIterTest_;
451 Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > convTest_;
452 Teuchos::RCP<StatusTestResNorm<ScalarType,MV,OP,DM> > impConvTest_, expConvTest_;
453 Teuchos::RCP<StatusTestOutput<ScalarType,MV,OP,DM> > outputTest_;
455 Teuchos::RCP<std::map<std::string, Teuchos::RCP<StatusTest<ScalarType, MV, OP, DM> > > > taggedTests_;
458 Teuchos::RCP<MatOrthoManager<ScalarType,MV,OP,DM> > ortho_;
461 Teuchos::RCP<Teuchos::ParameterList> params_;
464 static constexpr int maxRestarts_default_ = 20;
465 static constexpr int maxIters_default_ = 1000;
466 static constexpr bool showMaxResNormOnly_default_ =
false;
467 static constexpr int blockSize_default_ = 1;
468 static constexpr int numBlocks_default_ = 300;
471 static constexpr int outputFreq_default_ = -1;
472 static constexpr int defQuorum_default_ = 1;
473 static constexpr const char * impResScale_default_ =
"Norm of Preconditioned Initial Residual";
474 static constexpr const char * expResScale_default_ =
"Norm of Initial Residual";
475 static constexpr const char * label_default_ =
"Belos";
476 static constexpr const char * orthoType_default_ =
"ICGS";
479 MagnitudeType convtol_, orthoKappa_, achievedTol_;
480 int maxRestarts_, maxIters_, numIters_;
481 int blockSize_, numBlocks_, verbosity_, outputStyle_, outputFreq_, defQuorum_;
482 bool showMaxResNormOnly_;
483 std::string orthoType_;
484 std::string impResScale_, expResScale_;
485 MagnitudeType resScaleFactor_;
489 Teuchos::RCP<Teuchos::Time> timerSolve_;
492 bool isSet_, isSTSet_, expResTest_;
498template<
class ScalarType,
class MV,
class OP,
class DM>
501 taggedTests_(Teuchos::
null),
505 maxRestarts_(maxRestarts_default_),
506 maxIters_(maxIters_default_),
508 blockSize_(blockSize_default_),
509 numBlocks_(numBlocks_default_),
510 verbosity_(verbosity_default_),
511 outputStyle_(outputStyle_default_),
512 outputFreq_(outputFreq_default_),
513 defQuorum_(defQuorum_default_),
514 showMaxResNormOnly_(showMaxResNormOnly_default_),
515 orthoType_(orthoType_default_),
516 impResScale_(impResScale_default_),
517 expResScale_(expResScale_default_),
519 label_(label_default_),
527template<
class ScalarType,
class MV,
class OP,
class DM>
530 const Teuchos::RCP<Teuchos::ParameterList> &
pl) :
533 taggedTests_(Teuchos::
null),
537 maxRestarts_(maxRestarts_default_),
538 maxIters_(maxIters_default_),
540 blockSize_(blockSize_default_),
541 numBlocks_(numBlocks_default_),
542 verbosity_(verbosity_default_),
543 outputStyle_(outputStyle_default_),
544 outputFreq_(outputFreq_default_),
545 defQuorum_(defQuorum_default_),
546 showMaxResNormOnly_(showMaxResNormOnly_default_),
547 orthoType_(orthoType_default_),
548 impResScale_(impResScale_default_),
549 expResScale_(expResScale_default_),
551 label_(label_default_),
566template<
class ScalarType,
class MV,
class OP,
class DM>
571 using Teuchos::ParameterList;
572 using Teuchos::parameterList;
574 using Teuchos::rcp_dynamic_cast;
577 if (params_ == Teuchos::null) {
585 params->validateParameters (*getValidParameters (), 0);
589 if (
params->isParameter (
"Maximum Restarts")) {
590 maxRestarts_ =
params->get (
"Maximum Restarts", maxRestarts_default_);
593 params_->set (
"Maximum Restarts", maxRestarts_);
597 if (
params->isParameter (
"Maximum Iterations")) {
598 maxIters_ =
params->get (
"Maximum Iterations", maxIters_default_);
601 params_->set (
"Maximum Iterations", maxIters_);
602 if (! maxIterTest_.is_null ()) {
603 maxIterTest_->setMaxIters (maxIters_);
608 if (
params->isParameter (
"Block Size")) {
609 blockSize_ =
params->get (
"Block Size", blockSize_default_);
611 blockSize_ <= 0, std::invalid_argument,
612 "Belos::PseudoBlockGmresSolMgr::setParameters: "
613 "The \"Block Size\" parameter must be strictly positive, "
614 "but you specified a value of " << blockSize_ <<
".");
617 params_->set (
"Block Size", blockSize_);
621 if (
params->isParameter (
"Num Blocks")) {
622 numBlocks_ =
params->get (
"Num Blocks", numBlocks_default_);
624 numBlocks_ <= 0, std::invalid_argument,
625 "Belos::PseudoBlockGmresSolMgr::setParameters: "
626 "The \"Num Blocks\" parameter must be strictly positive, "
627 "but you specified a value of " << numBlocks_ <<
".");
630 params_->set (
"Num Blocks", numBlocks_);
634 if (
params->isParameter (
"Timer Label")) {
635 const std::string
tempLabel =
params->get (
"Timer Label", label_default_);
640 params_->set (
"Timer Label", label_);
642 label_ +
": PseudoBlockGmresSolMgr total solve time";
643#ifdef BELOS_TEUCHOS_TIME_MONITOR
644 timerSolve_ = Teuchos::TimeMonitor::getNewCounter (
solveLabel);
646 if (ortho_ != Teuchos::null) {
647 ortho_->setLabel( label_ );
654 if (
params->isParameter (
"Verbosity")) {
655 if (Teuchos::isParameterType<int> (*
params,
"Verbosity")) {
656 verbosity_ =
params->get (
"Verbosity", verbosity_default_);
658 verbosity_ = (
int) Teuchos::getParameter<Belos::MsgType> (*
params,
"Verbosity");
662 params_->set (
"Verbosity", verbosity_);
663 if (! printer_.is_null ()) {
664 printer_->setVerbosity (verbosity_);
669 if (
params->isParameter (
"Output Style")) {
670 if (Teuchos::isParameterType<int> (*
params,
"Output Style")) {
671 outputStyle_ =
params->get (
"Output Style", outputStyle_default_);
673 outputStyle_ = (
int) Teuchos::getParameter<Belos::OutputType> (*
params,
"Output Style");
677 params_->set (
"Output Style", outputStyle_);
678 if (! outputTest_.is_null ()) {
685 if (
params->isSublist (
"User Status Tests")) {
697 if (
params->isParameter (
"Output Stream")) {
698 outputStream_ = Teuchos::getParameter<Teuchos::RCP<std::ostream> > (*
params,
"Output Stream");
701 params_->set(
"Output Stream", outputStream_);
702 if (! printer_.is_null ()) {
703 printer_->setOStream (outputStream_);
709 if (
params->isParameter (
"Output Frequency")) {
710 outputFreq_ =
params->get (
"Output Frequency", outputFreq_default_);
714 params_->set (
"Output Frequency", outputFreq_);
715 if (! outputTest_.is_null ()) {
716 outputTest_->setOutputFrequency (outputFreq_);
721 if (printer_.is_null ()) {
727 if (
params->isParameter (
"Orthogonalization")) {
734 params_->set(
"Orthogonalization", orthoType_);
737 if (
params->isParameter (
"Orthogonalization Constant")) {
738 if (
params->isType<MagnitudeType> (
"Orthogonalization Constant")) {
739 orthoKappa_ =
params->get (
"Orthogonalization Constant",
743 orthoKappa_ =
params->get (
"Orthogonalization Constant",
748 params_->set (
"Orthogonalization Constant", orthoKappa_);
749 if (orthoType_ ==
"DGKS") {
761 if (orthoType_==
"DGKS" && orthoKappa_ > 0) {
762 paramsOrtho = Teuchos::rcp(
new Teuchos::ParameterList());
766 ortho_ =
factory.makeMatOrthoManager (orthoType_, Teuchos::null, printer_, label_,
paramsOrtho);
772 if (
params->isParameter (
"Convergence Tolerance")) {
773 if (
params->isType<MagnitudeType> (
"Convergence Tolerance")) {
774 convtol_ =
params->get (
"Convergence Tolerance",
782 params_->set (
"Convergence Tolerance", convtol_);
783 if (! impConvTest_.is_null ()) {
784 impConvTest_->setTolerance (convtol_);
786 if (! expConvTest_.is_null ()) {
787 expConvTest_->setTolerance (convtol_);
793 if (
params->isParameter (
"User Defined Residual Scaling")) {
795 if (
params->isType<MagnitudeType> (
"User Defined Residual Scaling")) {
812 if (!
params->isParameter (
"Implicit Residual Scaling") && ! impConvTest_.is_null ()) {
814 if(impResScale_ ==
"User Provided")
817 catch (std::exception&
e) {
822 if (!
params->isParameter (
"Explicit Residual Scaling") && ! expConvTest_.is_null ()) {
824 if(expResScale_ ==
"User Provided")
827 catch (std::exception&
e) {
836 if (
params->isParameter (
"Implicit Residual Scaling")) {
838 Teuchos::getParameter<std::string> (*
params,
"Implicit Residual Scaling");
846 params_->set (
"Implicit Residual Scaling", impResScale_);
847 if (! impConvTest_.is_null ()) {
849 if(impResScale_ ==
"User Provided")
854 catch (std::exception&
e) {
863 if (! impConvTest_.is_null ()) {
865 if(impResScale_ ==
"User Provided")
868 catch (std::exception&
e) {
876 if (
params->isParameter (
"Explicit Residual Scaling")) {
878 Teuchos::getParameter<std::string> (*
params,
"Explicit Residual Scaling");
886 params_->set (
"Explicit Residual Scaling", expResScale_);
887 if (! expConvTest_.is_null ()) {
889 if(expResScale_ ==
"User Provided")
894 catch (std::exception&
e) {
903 if (! expConvTest_.is_null ()) {
905 if(expResScale_ ==
"User Provided")
908 catch (std::exception&
e) {
917 if (
params->isParameter (
"Show Maximum Residual Norm Only")) {
918 showMaxResNormOnly_ =
919 Teuchos::getParameter<bool> (*
params,
"Show Maximum Residual Norm Only");
922 params_->set (
"Show Maximum Residual Norm Only", showMaxResNormOnly_);
923 if (! impConvTest_.is_null ()) {
924 impConvTest_->setShowMaxResNormOnly (showMaxResNormOnly_);
926 if (! expConvTest_.is_null ()) {
927 expConvTest_->setShowMaxResNormOnly (showMaxResNormOnly_);
934 if (
params->isParameter(
"Deflation Quorum")) {
935 defQuorum_ =
params->get(
"Deflation Quorum", defQuorum_);
937 defQuorum_ > blockSize_, std::invalid_argument,
938 "Belos::PseudoBlockGmresSolMgr::setParameters: "
939 "The \"Deflation Quorum\" parameter (= " << defQuorum_ <<
") must not be "
940 "larger than \"Block Size\" (= " << blockSize_ <<
").");
941 params_->set (
"Deflation Quorum", defQuorum_);
942 if (! impConvTest_.is_null ()) {
943 impConvTest_->setQuorum (defQuorum_);
945 if (! expConvTest_.is_null ()) {
946 expConvTest_->setQuorum (defQuorum_);
951 if (timerSolve_ == Teuchos::null) {
952 std::string
solveLabel = label_ +
": PseudoBlockGmresSolMgr total solve time";
953#ifdef BELOS_TEUCHOS_TIME_MONITOR
954 timerSolve_ = Teuchos::TimeMonitor::getNewCounter (
solveLabel);
963template<
class ScalarType,
class MV,
class OP,
class DM>
973template<
class ScalarType,
class MV,
class OP,
class DM>
983template<
class ScalarType,
class MV,
class OP,
class DM>
984Teuchos::RCP<const Teuchos::ParameterList>
987 static Teuchos::RCP<const Teuchos::ParameterList>
validPL;
989 Teuchos::RCP<Teuchos::ParameterList>
pl = Teuchos::parameterList();
994 pl= Teuchos::rcp(
new Teuchos::ParameterList() );
996 "The relative residual tolerance that needs to be achieved by the\n"
997 "iterative solver in order for the linear system to be declared converged.");
998 pl->set(
"Maximum Restarts",
static_cast<int>(maxRestarts_default_),
999 "The maximum number of restarts allowed for each\n"
1000 "set of RHS solved.");
1001 pl->set(
"Maximum Iterations",
static_cast<int>(maxIters_default_),
1002 "The maximum number of block iterations allowed for each\n"
1003 "set of RHS solved.");
1004 pl->set(
"Num Blocks",
static_cast<int>(numBlocks_default_),
1005 "The maximum number of vectors allowed in the Krylov subspace\n"
1006 "for each set of RHS solved.");
1007 pl->set(
"Block Size",
static_cast<int>(blockSize_default_),
1008 "The number of RHS solved simultaneously.");
1009 pl->set(
"Verbosity",
static_cast<int>(verbosity_default_),
1010 "What type(s) of solver information should be outputted\n"
1011 "to the output stream.");
1012 pl->set(
"Output Style",
static_cast<int>(outputStyle_default_),
1013 "What style is used for the solver information outputted\n"
1014 "to the output stream.");
1015 pl->set(
"Output Frequency",
static_cast<int>(outputFreq_default_),
1016 "How often convergence information should be outputted\n"
1017 "to the output stream.");
1018 pl->set(
"Deflation Quorum",
static_cast<int>(defQuorum_default_),
1019 "The number of linear systems that need to converge before\n"
1020 "they are deflated. This number should be <= block size.");
1021 pl->set(
"Output Stream", Teuchos::rcpFromRef(std::cout),
1022 "A reference-counted pointer to the output stream where all\n"
1023 "solver output is sent.");
1024 pl->set(
"Show Maximum Residual Norm Only",
static_cast<bool>(showMaxResNormOnly_default_),
1025 "When convergence information is printed, only show the maximum\n"
1026 "relative residual norm when the block size is greater than one.");
1027 pl->set(
"Implicit Residual Scaling",
static_cast<const char *
>(impResScale_default_),
1028 "The type of scaling used in the implicit residual convergence test.");
1029 pl->set(
"Explicit Residual Scaling",
static_cast<const char *
>(expResScale_default_),
1030 "The type of scaling used in the explicit residual convergence test.");
1031 pl->set(
"Timer Label",
static_cast<const char *
>(label_default_),
1032 "The string to use as a prefix for the timer labels.");
1033 pl->set(
"Orthogonalization",
static_cast<const char *
>(orthoType_default_),
1034 "The type of orthogonalization to use.");
1036 "The constant used by DGKS orthogonalization to determine\n"
1037 "whether another step of classical Gram-Schmidt is necessary.");
1038 pl->sublist(
"User Status Tests");
1039 pl->set(
"User Status Tests Combo Type",
"SEQ",
1040 "Type of logical combination operation of user-defined\n"
1041 "and/or solver-specific status tests.");
1048template<
class ScalarType,
class MV,
class OP,
class DM>
1060 if ( !Teuchos::is_null(problem_->getLeftPrec()) ) {
1069 if(impResScale_ ==
"User Provided")
1081 if(expResScale_ ==
"User Provided")
1089 convTest_ = Teuchos::rcp(
new StatusTestCombo_t( StatusTestCombo_t::SEQ, impConvTest_, expConvTest_ ) );
1097 if(impResScale_ ==
"User Provided")
1105 expConvTest_ = impConvTest_;
1106 convTest_ = impConvTest_;
1109 if (
nonnull(userConvStatusTest_) ) {
1111 Teuchos::RCP<StatusTestCombo_t>
tmpComboTest = Teuchos::rcp_dynamic_cast<StatusTestCombo_t>(userConvStatusTest_);
1113 std::vector<Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > >
tmpVec =
tmpComboTest->getStatusTests();
1116 auto newConvTest = Teuchos::rcp(
new StatusTestCombo_t(comboType_));
1125 convTest_ = Teuchos::rcp(
1126 new StatusTestCombo_t( comboType_, convTest_, userConvStatusTest_ ) );
1134 sTest_ = Teuchos::rcp(
new StatusTestCombo_t( StatusTestCombo_t::OR, maxIterTest_, convTest_ ) );
1137 if (
nonnull(debugStatusTest_) ) {
1139 Teuchos::rcp_dynamic_cast<StatusTestCombo_t>(sTest_)->addStatusTest( debugStatusTest_ );
1148 std::string
solverDesc =
" Pseudo Block Gmres ";
1160template<
class ScalarType,
class MV,
class OP,
class DM>
1166 if (!isSet_) { setParameters( params_ ); }
1169 "Belos::PseudoBlockGmresSolMgr::solve(): Linear problem is not ready, setProblem() has not been called.");
1172 if (!isSTSet_ || (!expResTest_ && !Teuchos::is_null(problem_->getLeftPrec())) ) {
1174 "Belos::BlockGmresSolMgr::solve(): Linear problem and requested status tests are incompatible.");
1179 int numRHS2Solve = MVT::GetNumberVecs( *(problem_->getRHS()) );
1188 problem_->setLSIndex(
currIdx );
1192 Teuchos::ParameterList
plist;
1193 plist.set(
"Num Blocks",numBlocks_);
1196 outputTest_->reset();
1197 loaDetected_ =
false;
1210#ifdef BELOS_TEUCHOS_TIME_MONITOR
1211 Teuchos::TimeMonitor
slvtimer(*timerSolve_);
1228 outputTest_->resetNumCalls();
1234 std::vector<int> index(1);
1235 Teuchos::RCP<MV>
tmpV,
R_0 = MVT::CloneCopy( *(problem_->getInitPrecResVec()),
currIdx );
1238 for (
int i=0;
i<blockSize_; ++
i) {
1240 tmpV = MVT::CloneViewNonConst( *
R_0, index );
1243 Teuchos::RCP<DM>
tmpZ = DMT::Create( 1, 1 );
1248 "Belos::PseudoBlockGmresSolMgr::solve(): Failed to compute initial block of orthonormal vectors.");
1269 if ( convTest_->getStatus() ==
Passed ) {
1271 if ( expConvTest_->getLOADetected() ) {
1282 loaDetected_ =
true;
1284 "Belos::PseudoBlockGmresSolMgr::solve(): Warning! Solver has experienced a loss of accuracy!" << std::endl;
1289 std::vector<int>
convIdx = expConvTest_->convIndices();
1300 problem_->setCurrLS();
1313 for (
unsigned int j=0;
j<
convIdx.size(); ++
j) {
1326 defState.sn.push_back( Teuchos::rcp_const_cast<std::vector<ScalarType> >(
oldState.sn[
i] ) );
1327 defState.cs.push_back( Teuchos::rcp_const_cast<std::vector<MagnitudeType> >(
oldState.cs[
i] ) );
1341 problem_->setLSIndex(
convIdx );
1344 problem_->updateSolution(
defUpdate,
true );
1361 else if ( maxIterTest_->getStatus() ==
Passed ) {
1381 printer_->stream(
Debug) <<
" Performing restart number " <<
numRestarts <<
" of " << maxRestarts_ << std::endl << std::endl;
1385 problem_->updateSolution(
update,
true );
1397 R_0 = MVT::Clone( *(problem_->getInitPrecResVec()),
currRHSIdx.size() );
1398 problem_->computeCurrPrecResVec( &*
R_0 );
1402 tmpV = MVT::CloneViewNonConst( *
R_0, index );
1405 Teuchos::RCP<DM>
tmpZ = DMT::Create( 1, 1 );
1410 "Belos::PseudoBlockGmresSolMgr::solve(): Failed to compute initial block of orthonormal vectors after the restart.");
1432 "Belos::PseudoBlockGmresSolMgr::solve(): Invalid return from PseudoBlockGmresIter::iterate().");
1442 if (convTest_->getStatus() !=
Passed) {
1451 achievedTol_ = MT::one();
1452 Teuchos::RCP<MV>
X = problem_->getLHS();
1453 MVT::MvInit( *
X, SCT::zero() );
1454 printer_->stream(
Warnings) <<
"Belos::PseudoBlockGmresSolMgr::solve(): Warning! NaN has been detected!"
1458 catch (
const std::exception &
e) {
1460 printer_->stream(
Errors) <<
"Error! Caught std::exception in PseudoBlockGmresIter::iterate() at iteration "
1462 <<
e.what() << std::endl;
1469 if (
nonnull(userConvStatusTest_)) {
1472 problem_->updateSolution(
update,
true );
1474 else if (
nonnull(expConvTest_->getSolution())) {
1476 Teuchos::RCP<MV>
newX = expConvTest_->getSolution();
1477 Teuchos::RCP<MV>
curX = problem_->getCurrLHSVec();
1483 problem_->updateSolution(
update,
true );
1487 problem_->setCurrLS();
1501 if (defQuorum_ > blockSize_) {
1502 if (impConvTest_ != Teuchos::null)
1503 impConvTest_->setQuorum( blockSize_ );
1504 if (expConvTest_ != Teuchos::null)
1505 expConvTest_->setQuorum( blockSize_ );
1509 problem_->setLSIndex(
currIdx );
1523#ifdef BELOS_TEUCHOS_TIME_MONITOR
1528 Teuchos::TimeMonitor::summarize( printer_->stream(
TimingDetails) );
1532 numIters_ = maxIterTest_->getNumIters();
1557 "Belos::PseudoBlockGmresSolMgr::solve(): The implicit convergence test's "
1558 "getTestValue() method returned NULL. Please report this bug to the "
1559 "Belos developers.");
1561 "Belos::PseudoBlockGmresSolMgr::solve(): The implicit convergence test's "
1562 "getTestValue() method returned a vector of length zero. Please report "
1563 "this bug to the Belos developers.");
1578template<
class ScalarType,
class MV,
class OP,
class DM>
1581 std::ostringstream
out;
1583 out <<
"\"Belos::PseudoBlockGmresSolMgr\": {";
1587 out <<
"Num Blocks: " << numBlocks_
1588 <<
", Maximum Iterations: " << maxIters_
1589 <<
", Maximum Restarts: " << maxRestarts_
1590 <<
", Convergence Tolerance: " << convtol_
1596template<
class ScalarType,
class MV,
class OP,
class DM>
1599 const Teuchos::EVerbosityLevel
verbLevel)
const
1601 using Teuchos::TypeNameTraits;
1602 using Teuchos::VERB_DEFAULT;
1603 using Teuchos::VERB_NONE;
1604 using Teuchos::VERB_LOW;
1611 const Teuchos::EVerbosityLevel
vl =
1617 out <<
"\"Belos::PseudoBlockGmresSolMgr\":" << endl;
1619 out <<
"Template parameters:" << endl;
1629 out <<
"Num Blocks: " << numBlocks_ << endl
1630 <<
"Maximum Iterations: " << maxIters_ << endl
1631 <<
"Maximum Restarts: " << maxRestarts_ << endl
1632 <<
"Convergence Tolerance: " << convtol_ << endl;
Belos header file which uses auto-configuration information to include necessary C++ headers.
Class which describes the linear problem to be solved by the iterative solver.
Class which manages the output and verbosity of the Belos solvers.
Belos concrete class for performing the pseudo-block GMRES iteration.
Pure virtual base class which describes the basic interface for a solver manager.
A factory class for generating StatusTestOutput objects.
Collection of types and exceptions used within the Belos solvers.
Parent class to all Belos exceptions.
Alternative run-time polymorphic interface for operators.
Operator()
Default constructor (does nothing).
PseudoBlockGmresIterOrthoFailure is thrown when the orthogonalization manager is unable to generate o...
Interface to standard and "pseudoblock" GMRES.
const LinearProblem< ScalarType, MV, OP, DM > & getProblem() const override
Return a reference to the linear problem being solved by this solver manager.
Teuchos::Array< Teuchos::RCP< Teuchos::Time > > getTimers() const
Return the timers for this object.
Teuchos::RCP< SolverManager< ScalarType, MV, OP, DM > > clone() const override
clone for Inverted Injection (DII)
void reset(const ResetType type) override
Performs a reset of the solver manager specified by the ResetType. This informs the solver manager th...
Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const override
The current parameters for this solver.
PseudoBlockGmresSolMgr()
Empty constructor.
MagnitudeType achievedTol() const override
Tolerance achieved by the last solve() invocation.
virtual void setUserConvStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP, DM > > &userConvStatusTest, const typename StatusTestCombo< ScalarType, MV, OP, DM >::ComboType &comboType=StatusTestCombo< ScalarType, MV, OP, DM >::SEQ) override
Set a custom status test.
void setDebugStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP, DM > > &debugStatusTest) override
Set a debug status test that will be checked at the same time as the top-level status test.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
A list of valid default parameters for this solver.
const StatusTestResNorm< ScalarType, MV, OP, DM > * getResidualStatusTest() const
Return the residual status test.
virtual ~PseudoBlockGmresSolMgr()
Destructor.
bool isLOADetected() const override
Whether a "loss of accuracy" was detected during the last solve().
void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP, DM > > &problem) override
Set the linear problem to solve.
void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms) override
Set the parameters the solver manager should use to solve the linear problem.
std::string description() const override
Return a one-line description of this object.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const override
Print the object with the given verbosity level to a FancyOStream.
ReturnType solve() override
This method performs possibly repeated calls to the underlying linear solver's iterate() routine unti...
int getNumIters() const override
Iteration count for the most recent call to solve().
PseudoBlockGmresSolMgrLinearProblemFailure is thrown when the linear problem is not setup (i....
PseudoBlockGmresSolMgrLinearProblemFailure(const std::string &what_arg)
PseudoBlockGmresSolMgrOrthoFailure is thrown when the orthogonalization manager is unable to generate...
PseudoBlockGmresSolMgrOrthoFailure(const std::string &what_arg)
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
A class for extending the status testing capabilities of Belos via logical combinations.
ComboType
The test can be either the AND of all the component tests, or the OR of all the component tests,...
ScaleType convertStringToScaleType(const std::string &scaleType)
Convert the given string to its ScaleType enum value.
ReturnType
Whether the Belos solve converged for all linear systems.
ScaleType
The type of scaling to use on the residual norm value.
ResetType
How to reset the solver.
Default parameters common to most Belos solvers.
static const double resScaleFactor
User-defined residual scaling factor.
static const double convTol
Default convergence tolerance.
static const double orthoKappa
DGKS orthogonalization constant.