42 #ifndef BELOS_BLOCK_GMRES_SOLMGR_HPP
43 #define BELOS_BLOCK_GMRES_SOLMGR_HPP
66 #ifdef BELOS_TEUCHOS_TIME_MONITOR
121 template<
class ScalarType,
class MV,
class OP>
355 template<
class ScalarType,
class MV,
class OP>
357 outputStream_(Teuchos::rcpFromRef(std::cout)),
360 achievedTol_(Teuchos::ScalarTraits<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType>::zero()),
361 maxRestarts_(maxRestarts_default_),
362 maxIters_(maxIters_default_),
364 blockSize_(blockSize_default_),
365 numBlocks_(numBlocks_default_),
366 verbosity_(verbosity_default_),
367 outputStyle_(outputStyle_default_),
368 outputFreq_(outputFreq_default_),
369 adaptiveBlockSize_(adaptiveBlockSize_default_),
370 showMaxResNormOnly_(showMaxResNormOnly_default_),
371 isFlexible_(flexibleGmres_default_),
372 expResTest_(expResTest_default_),
373 orthoType_(orthoType_default_),
374 impResScale_(impResScale_default_),
375 expResScale_(expResScale_default_),
376 label_(label_default_),
384 template<
class ScalarType,
class MV,
class OP>
389 outputStream_(Teuchos::rcpFromRef(std::cout)),
392 achievedTol_(Teuchos::ScalarTraits<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType>::zero()),
393 maxRestarts_(maxRestarts_default_),
394 maxIters_(maxIters_default_),
396 blockSize_(blockSize_default_),
397 numBlocks_(numBlocks_default_),
398 verbosity_(verbosity_default_),
399 outputStyle_(outputStyle_default_),
400 outputFreq_(outputFreq_default_),
401 adaptiveBlockSize_(adaptiveBlockSize_default_),
402 showMaxResNormOnly_(showMaxResNormOnly_default_),
403 isFlexible_(flexibleGmres_default_),
404 expResTest_(expResTest_default_),
405 orthoType_(orthoType_default_),
406 impResScale_(impResScale_default_),
407 expResScale_(expResScale_default_),
408 label_(label_default_),
424 template<
class ScalarType,
class MV,
class OP>
435 "The relative residual tolerance that needs to be achieved by the\n"
436 "iterative solver in order for the linear system to be declared converged." );
437 pl->
set(
"Maximum Restarts", static_cast<int>(maxRestarts_default_),
438 "The maximum number of restarts allowed for each\n"
439 "set of RHS solved.");
440 pl->
set(
"Maximum Iterations", static_cast<int>(maxIters_default_),
441 "The maximum number of block iterations allowed for each\n"
442 "set of RHS solved.");
443 pl->
set(
"Num Blocks", static_cast<int>(numBlocks_default_),
444 "The maximum number of blocks allowed in the Krylov subspace\n"
445 "for each set of RHS solved.");
446 pl->
set(
"Block Size", static_cast<int>(blockSize_default_),
447 "The number of vectors in each block. This number times the\n"
448 "number of blocks is the total Krylov subspace dimension.");
449 pl->
set(
"Adaptive Block Size", static_cast<bool>(adaptiveBlockSize_default_),
450 "Whether the solver manager should adapt the block size\n"
451 "based on the number of RHS to solve.");
452 pl->
set(
"Verbosity", static_cast<int>(verbosity_default_),
453 "What type(s) of solver information should be outputted\n"
454 "to the output stream.");
455 pl->
set(
"Output Style", static_cast<int>(outputStyle_default_),
456 "What style is used for the solver information outputted\n"
457 "to the output stream.");
458 pl->
set(
"Output Frequency", static_cast<int>(outputFreq_default_),
459 "How often convergence information should be outputted\n"
460 "to the output stream.");
461 pl->
set(
"Output Stream", Teuchos::rcpFromRef(std::cout),
462 "A reference-counted pointer to the output stream where all\n"
463 "solver output is sent.");
464 pl->
set(
"Show Maximum Residual Norm Only", static_cast<bool>(showMaxResNormOnly_default_),
465 "When convergence information is printed, only show the maximum\n"
466 "relative residual norm when the block size is greater than one.");
467 pl->
set(
"Flexible Gmres", static_cast<bool>(flexibleGmres_default_),
468 "Whether the solver manager should use the flexible variant\n"
470 pl->
set(
"Explicit Residual Test", static_cast<bool>(expResTest_default_),
471 "Whether the explicitly computed residual should be used in the convergence test.");
472 pl->
set(
"Implicit Residual Scaling", static_cast<const char *>(impResScale_default_),
473 "The type of scaling used in the implicit residual convergence test.");
474 pl->
set(
"Explicit Residual Scaling", static_cast<const char *>(expResScale_default_),
475 "The type of scaling used in the explicit residual convergence test.");
476 pl->
set(
"Timer Label", static_cast<const char *>(label_default_),
477 "The string to use as a prefix for the timer labels.");
478 pl->
set(
"Orthogonalization", static_cast<const char *>(orthoType_default_),
479 "The type of orthogonalization to use: DGKS, ICGS, or IMGS.");
481 "The constant used by DGKS orthogonalization to determine\n"
482 "whether another step of classical Gram-Schmidt is necessary.");
489 template<
class ScalarType,
class MV,
class OP>
503 maxRestarts_ = params->
get(
"Maximum Restarts",maxRestarts_default_);
506 params_->set(
"Maximum Restarts", maxRestarts_);
511 maxIters_ = params->
get(
"Maximum Iterations",maxIters_default_);
514 params_->set(
"Maximum Iterations", maxIters_);
516 maxIterTest_->setMaxIters( maxIters_ );
521 blockSize_ = params->
get(
"Block Size",blockSize_default_);
523 "Belos::BlockGmresSolMgr: \"Block Size\" must be strictly positive.");
526 params_->set(
"Block Size", blockSize_);
531 adaptiveBlockSize_ = params->
get(
"Adaptive Block Size",adaptiveBlockSize_default_);
534 params_->set(
"Adaptive Block Size", adaptiveBlockSize_);
539 numBlocks_ = params->
get(
"Num Blocks",numBlocks_default_);
541 "Belos::BlockGmresSolMgr: \"Num Blocks\" must be strictly positive.");
544 params_->set(
"Num Blocks", numBlocks_);
549 std::string tempLabel = params->
get(
"Timer Label", label_default_);
552 if (tempLabel != label_) {
554 params_->set(
"Timer Label", label_);
555 std::string solveLabel = label_ +
": BlockGmresSolMgr total solve time";
556 #ifdef BELOS_TEUCHOS_TIME_MONITOR
560 ortho_->setLabel( label_ );
567 isFlexible_ = Teuchos::getParameter<bool>(*params,
"Flexible Gmres");
568 params_->set(
"Flexible Gmres", isFlexible_);
569 if (isFlexible_ && expResTest_) {
577 if (Teuchos::isParameterType<int>(*params,
"Verbosity")) {
578 verbosity_ = params->
get(
"Verbosity", verbosity_default_);
580 verbosity_ = (int)Teuchos::getParameter<Belos::MsgType>(*params,
"Verbosity");
584 params_->set(
"Verbosity", verbosity_);
586 printer_->setVerbosity(verbosity_);
591 if (Teuchos::isParameterType<int>(*params,
"Output Style")) {
592 outputStyle_ = params->
get(
"Output Style", outputStyle_default_);
594 outputStyle_ = (int)Teuchos::getParameter<Belos::OutputType>(*params,
"Output Style");
598 params_->set(
"Output Style", outputStyle_);
606 outputStream_ = Teuchos::getParameter<Teuchos::RCP<std::ostream> >(*params,
"Output Stream");
609 params_->set(
"Output Stream", outputStream_);
611 printer_->setOStream( outputStream_ );
617 outputFreq_ = params->
get(
"Output Frequency", outputFreq_default_);
621 params_->set(
"Output Frequency", outputFreq_);
623 outputTest_->setOutputFrequency( outputFreq_ );
632 bool changedOrthoType =
false;
634 std::string tempOrthoType = params->
get(
"Orthogonalization",orthoType_default_);
635 if (tempOrthoType != orthoType_) {
636 orthoType_ = tempOrthoType;
637 changedOrthoType =
true;
640 params_->set(
"Orthogonalization", orthoType_);
643 if (params->
isParameter(
"Orthogonalization Constant")) {
645 orthoKappa_ = params->
get (
"Orthogonalization Constant",
649 orthoKappa_ = params->
get (
"Orthogonalization Constant",
654 params_->set(
"Orthogonalization Constant",orthoKappa_);
655 if (orthoType_==
"DGKS") {
656 if (orthoKappa_ > 0 && ortho_ !=
Teuchos::null && !changedOrthoType) {
666 if (orthoType_==
"DGKS" && orthoKappa_ > 0) {
667 paramsOrtho->
set (
"depTol", orthoKappa_ );
674 if (params->
isParameter(
"Convergence Tolerance")) {
676 convtol_ = params->
get (
"Convergence Tolerance",
684 params_->set(
"Convergence Tolerance", convtol_);
686 impConvTest_->setTolerance( convtol_ );
688 expConvTest_->setTolerance( convtol_ );
692 if (params->
isParameter(
"Implicit Residual Scaling")) {
693 std::string tempImpResScale = Teuchos::getParameter<std::string>( *params,
"Implicit Residual Scaling" );
696 if (impResScale_ != tempImpResScale) {
698 impResScale_ = tempImpResScale;
701 params_->set(
"Implicit Residual Scaling", impResScale_);
706 catch (std::exception& e) {
714 if (params->
isParameter(
"Explicit Residual Scaling")) {
715 std::string tempExpResScale = Teuchos::getParameter<std::string>( *params,
"Explicit Residual Scaling" );
718 if (expResScale_ != tempExpResScale) {
720 expResScale_ = tempExpResScale;
723 params_->set(
"Explicit Residual Scaling", expResScale_);
728 catch (std::exception& e) {
736 if (params->
isParameter(
"Explicit Residual Test")) {
737 expResTest_ = Teuchos::getParameter<bool>( *params,
"Explicit Residual Test" );
740 params_->set(
"Explicit Residual Test", expResTest_);
746 if (params->
isParameter(
"Show Maximum Residual Norm Only")) {
747 showMaxResNormOnly_ = Teuchos::getParameter<bool>(*params,
"Show Maximum Residual Norm Only");
750 params_->set(
"Show Maximum Residual Norm Only", showMaxResNormOnly_);
752 impConvTest_->setShowMaxResNormOnly( showMaxResNormOnly_ );
754 expConvTest_->setShowMaxResNormOnly( showMaxResNormOnly_ );
760 std::string solveLabel = label_ +
": BlockGmresSolMgr total solve time";
761 #ifdef BELOS_TEUCHOS_TIME_MONITOR
771 template<
class ScalarType,
class MV,
class OP>
786 params_->set(
"Flexible Gmres", isFlexible_);
790 "Belos::BlockGmresSolMgr::solve(): Linear problem has a left preconditioner, not a right preconditioner, which is required for flexible GMRES.");
805 tmpImpConvTest->setShowMaxResNormOnly( showMaxResNormOnly_ );
806 impConvTest_ = tmpImpConvTest;
811 tmpExpConvTest->defineResForm( StatusTestGenResNorm_t::Explicit,
Belos::TwoNorm );
813 tmpExpConvTest->setShowMaxResNormOnly( showMaxResNormOnly_ );
814 expConvTest_ = tmpExpConvTest;
817 convTest_ =
Teuchos::rcp(
new StatusTestCombo_t( StatusTestCombo_t::SEQ, impConvTest_, expConvTest_ ) );
826 tmpImpConvTest->setShowMaxResNormOnly( showMaxResNormOnly_ );
827 impConvTest_ = tmpImpConvTest;
835 tmpImpConvTest->setShowMaxResNormOnly( showMaxResNormOnly_ );
836 impConvTest_ = tmpImpConvTest;
840 expConvTest_ = impConvTest_;
841 convTest_ = impConvTest_;
845 sTest_ =
Teuchos::rcp(
new StatusTestCombo_t( StatusTestCombo_t::OR, maxIterTest_, convTest_ ) );
848 if (
nonnull(debugStatusTest_) ) {
850 Teuchos::rcp_dynamic_cast<StatusTestCombo_t>(sTest_)->addStatusTest( debugStatusTest_ );
859 std::string solverDesc =
" Block Gmres ";
861 solverDesc =
"Flexible" + solverDesc;
862 outputTest_->setSolverDesc( solverDesc );
870 template<
class ScalarType,
class MV,
class OP>
875 debugStatusTest_ = debugStatusTest;
880 template<
class ScalarType,
class MV,
class OP>
887 setParameters(Teuchos::parameterList(*getValidParameters()));
891 "Belos::BlockGmresSolMgr::solve(): Linear problem is not a valid object.");
894 "Belos::BlockGmresSolMgr::solve(): Linear problem is not ready, setProblem() has not been called.");
896 if (!isSTSet_ || (!expResTest_ && !
Teuchos::is_null(problem_->getLeftPrec())) ) {
898 "Belos::BlockGmresSolMgr::solve(): Linear problem and requested status tests are incompatible.");
903 int numRHS2Solve = MVT::GetNumberVecs( *(problem_->getRHS()) );
904 int numCurrRHS = ( numRHS2Solve < blockSize_) ? numRHS2Solve : blockSize_;
906 std::vector<int> currIdx;
909 if ( adaptiveBlockSize_ ) {
910 blockSize_ = numCurrRHS;
911 currIdx.resize( numCurrRHS );
912 for (
int i=0; i<numCurrRHS; ++i)
913 { currIdx[i] = startPtr+i; }
917 currIdx.resize( blockSize_ );
918 for (
int i=0; i<numCurrRHS; ++i)
919 { currIdx[i] = startPtr+i; }
920 for (
int i=numCurrRHS; i<blockSize_; ++i)
925 problem_->setLSIndex( currIdx );
930 plist.
set(
"Block Size",blockSize_);
932 ptrdiff_t dim = MVT::GetGlobalLength( *(problem_->getRHS()) );
933 if (blockSize_*static_cast<ptrdiff_t>(numBlocks_) > dim) {
934 int tmpNumBlocks = 0;
936 tmpNumBlocks = dim / blockSize_;
938 tmpNumBlocks = ( dim - blockSize_) / blockSize_;
940 "Belos::BlockGmresSolMgr::solve(): Warning! Requested Krylov subspace dimension is larger than operator dimension!"
941 << std::endl <<
" The maximum number of blocks allowed for the Krylov subspace will be adjusted to " << tmpNumBlocks << std::endl;
942 plist.
set(
"Num Blocks",tmpNumBlocks);
945 plist.
set(
"Num Blocks",numBlocks_);
948 outputTest_->reset();
949 loaDetected_ =
false;
952 bool isConverged =
true;
966 #ifdef BELOS_TEUCHOS_TIME_MONITOR
970 while ( numRHS2Solve > 0 ) {
973 if (blockSize_*numBlocks_ > dim) {
974 int tmpNumBlocks = 0;
976 tmpNumBlocks = dim / blockSize_;
978 tmpNumBlocks = ( dim - blockSize_) / blockSize_;
979 block_gmres_iter->setSize( blockSize_, tmpNumBlocks );
982 block_gmres_iter->setSize( blockSize_, numBlocks_ );
985 block_gmres_iter->resetNumIters();
988 outputTest_->resetNumCalls();
994 if (currIdx[blockSize_-1] == -1) {
995 V_0 = MVT::Clone( *(problem_->getInitResVec()), blockSize_ );
996 problem_->computeCurrResVec( &*V_0 );
999 V_0 = MVT::CloneCopy( *(problem_->getInitResVec()), currIdx );
1004 if (currIdx[blockSize_-1] == -1) {
1005 V_0 = MVT::Clone( *(problem_->getInitPrecResVec()), blockSize_ );
1006 problem_->computeCurrPrecResVec( &*V_0 );
1009 V_0 = MVT::CloneCopy( *(problem_->getInitPrecResVec()), currIdx );
1018 int rank = ortho_->normalize( *V_0, z_0 );
1020 "Belos::BlockGmresSolMgr::solve(): Failed to compute initial block of orthonormal vectors.");
1027 block_gmres_iter->initializeGmres(newstate);
1028 int numRestarts = 0;
1033 block_gmres_iter->iterate();
1040 if ( convTest_->getStatus() ==
Passed ) {
1041 if ( expConvTest_->getLOADetected() ) {
1043 loaDetected_ =
true;
1045 "Belos::BlockGmresSolMgr::solve(): Warning! Solver has experienced a loss of accuracy!" << std::endl;
1046 isConverged =
false;
1055 else if ( maxIterTest_->getStatus() ==
Passed ) {
1057 isConverged =
false;
1065 else if ( block_gmres_iter->getCurSubspaceDim() == block_gmres_iter->getMaxSubspaceDim() ) {
1067 if ( numRestarts >= maxRestarts_ ) {
1068 isConverged =
false;
1073 printer_->stream(
Debug) <<
" Performing restart number " << numRestarts <<
" of " << maxRestarts_ << std::endl << std::endl;
1080 MVT::MvAddMv( 1.0, *curX, 1.0, *update, *curX );
1083 problem_->updateSolution( update,
true );
1090 V_0 = MVT::Clone( *(oldState.
V), blockSize_ );
1092 problem_->computeCurrResVec( &*V_0 );
1094 problem_->computeCurrPrecResVec( &*V_0 );
1100 rank = ortho_->normalize( *V_0, z_0 );
1102 "Belos::BlockGmresSolMgr::solve(): Failed to compute initial block of orthonormal vectors after restart.");
1108 block_gmres_iter->initializeGmres(newstate);
1121 "Belos::BlockGmresSolMgr::solve(): Invalid return from BlockGmresIter::iterate().");
1126 if (blockSize_ != 1) {
1127 printer_->stream(
Errors) <<
"Error! Caught std::exception in BlockGmresIter::iterate() at iteration "
1128 << block_gmres_iter->getNumIters() << std::endl
1129 << e.what() << std::endl;
1130 if (convTest_->getStatus() !=
Passed)
1131 isConverged =
false;
1136 block_gmres_iter->updateLSQR( block_gmres_iter->getCurSubspaceDim() );
1139 sTest_->checkStatus( &*block_gmres_iter );
1140 if (convTest_->getStatus() !=
Passed)
1141 isConverged =
false;
1147 achievedTol_ = MT::one();
1149 MVT::MvInit( *X, SCT::zero() );
1150 printer_->stream(
Warnings) <<
"Belos::BlockGmresSolMgr::solve(): Warning! NaN has been detected!"
1154 catch (
const std::exception &e) {
1155 printer_->stream(
Errors) <<
"Error! Caught std::exception in BlockGmresIter::iterate() at iteration "
1156 << block_gmres_iter->getNumIters() << std::endl
1157 << e.what() << std::endl;
1170 MVT::MvAddMv( 1.0, *curX, 1.0, *update, *curX );
1177 MVT::MvAddMv( 0.0, *newX, 1.0, *newX, *curX );
1181 problem_->updateSolution( update,
true );
1186 problem_->setCurrLS();
1189 startPtr += numCurrRHS;
1190 numRHS2Solve -= numCurrRHS;
1191 if ( numRHS2Solve > 0 ) {
1192 numCurrRHS = ( numRHS2Solve < blockSize_) ? numRHS2Solve : blockSize_;
1194 if ( adaptiveBlockSize_ ) {
1195 blockSize_ = numCurrRHS;
1196 currIdx.resize( numCurrRHS );
1197 for (
int i=0; i<numCurrRHS; ++i)
1198 { currIdx[i] = startPtr+i; }
1201 currIdx.resize( blockSize_ );
1202 for (
int i=0; i<numCurrRHS; ++i)
1203 { currIdx[i] = startPtr+i; }
1204 for (
int i=numCurrRHS; i<blockSize_; ++i)
1205 { currIdx[i] = -1; }
1208 problem_->setLSIndex( currIdx );
1211 currIdx.resize( numRHS2Solve );
1222 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1231 numIters_ = maxIterTest_->getNumIters();
1245 const std::vector<MagnitudeType>* pTestValues = NULL;
1247 pTestValues = expConvTest_->getTestValue();
1248 if (pTestValues == NULL || pTestValues->size() < 1) {
1249 pTestValues = impConvTest_->getTestValue();
1254 pTestValues = impConvTest_->getTestValue();
1257 "Belos::BlockGmresSolMgr::solve(): The implicit convergence test's "
1258 "getTestValue() method returned NULL. Please report this bug to the "
1259 "Belos developers.");
1261 "Belos::BlockGmresSolMgr::solve(): The implicit convergence test's "
1262 "getTestValue() method returned a vector of length zero. Please report "
1263 "this bug to the Belos developers.");
1268 achievedTol_ = *std::max_element (pTestValues->begin(), pTestValues->end());
1271 if (!isConverged || loaDetected_) {
1278 template<
class ScalarType,
class MV,
class OP>
1281 std::ostringstream out;
1282 out <<
"\"Belos::BlockGmresSolMgr\": {";
1283 if (this->getObjectLabel () !=
"") {
1284 out <<
"Label: " << this->getObjectLabel () <<
", ";
1286 out <<
"Flexible: " << (isFlexible_ ?
"true" :
"false")
1287 <<
", Num Blocks: " << numBlocks_
1288 <<
", Maximum Iterations: " << maxIters_
1289 <<
", Maximum Restarts: " << maxRestarts_
1290 <<
", Convergence Tolerance: " << convtol_
1296 template<
class ScalarType,
class MV,
class OP>
1318 out <<
"\"Belos::BlockGmresSolMgr\":" << endl;
1320 out <<
"Template parameters:" << endl;
1323 out <<
"ScalarType: " << TypeNameTraits<ScalarType>::name () << endl
1324 <<
"MV: " << TypeNameTraits<MV>::name () << endl
1325 <<
"OP: " << TypeNameTraits<OP>::name () << endl;
1327 if (this->getObjectLabel () !=
"") {
1328 out <<
"Label: " << this->getObjectLabel () << endl;
1330 out <<
"Flexible: " << (isFlexible_ ?
"true" :
"false") << endl
1331 <<
"Num Blocks: " << numBlocks_ << endl
1332 <<
"Maximum Iterations: " << maxIters_ << endl
1333 <<
"Maximum Restarts: " << maxRestarts_ << endl
1334 <<
"Convergence Tolerance: " << convtol_ << endl;
static const double orthoKappa
DGKS orthogonalization constant.
ScaleType convertStringToScaleType(const std::string &scaleType)
Convert the given string to its ScaleType enum value.
Teuchos::RCP< OutputManager< ScalarType > > printer_
Teuchos::Array< Teuchos::RCP< Teuchos::Time > > getTimers() const
Return the timers for this object.
Collection of types and exceptions used within the Belos solvers.
Teuchos::ScalarTraits< MagnitudeType > MT
Teuchos::ScalarTraits< ScalarType >::magnitudeType MagnitudeType
Belos's basic output manager for sending information of select verbosity levels to the appropriate ou...
static constexpr int maxIters_default_
Class which manages the output and verbosity of the Belos solvers.
bool is_null(const boost::shared_ptr< T > &p)
void setDebugStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP > > &debugStatusTest) override
Set a debug status test that will be checked at the same time as the top-level status test...
Teuchos::RCP< StatusTest< ScalarType, MV, OP > > convTest_
static constexpr int blockSize_default_
Teuchos::RCP< StatusTestOutput< ScalarType, MV, OP > > outputTest_
ScaleType
The type of scaling to use on the residual norm value.
Teuchos::RCP< Teuchos::Time > timerSolve_
This class implements the block GMRES iteration, where a block Krylov subspace is constructed...
Convergence test using the implicit residual norm(s), with an explicit residual norm(s) check for los...
Teuchos::RCP< const MV > V
The current Krylov basis.
T & get(ParameterList &l, const std::string &name)
Virtual base class for StatusTest that printing status tests.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
bool is_null(const std::shared_ptr< T > &p)
MagnitudeType achievedTol() const override
Tolerance achieved by the last solve() invocation.
Teuchos::RCP< MatOrthoManager< ScalarType, MV, OP > > ortho_
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
A factory class for generating StatusTestOutput objects.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Get a parameter list containing the valid parameters for this object.
static constexpr int numBlocks_default_
static constexpr bool expResTest_default_
Teuchos::RCP< const Teuchos::SerialDenseMatrix< int, ScalarType > > z
The current right-hand side of the least squares system RY = Z.
An implementation of StatusTestResNorm using a family of residual norms.
BlockGmresSolMgrLinearProblemFailure is thrown when the linear problem is not setup (i...
Structure to contain pointers to GmresIteration state variables.
static const double convTol
Default convergence tolerance.
Belos::StatusTest class for specifying a maximum number of iterations.
Teuchos::ScalarTraits< ScalarType > SCT
Interface to Block GMRES and Flexible GMRES.
A pure virtual class for defining the status tests for the Belos iterative solvers.
virtual ~BlockGmresSolMgr()
Destructor.
Teuchos::RCP< StatusTest< ScalarType, MV, OP > > debugStatusTest_
void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem) override
Set the linear problem that needs to be solved.
A factory class for generating StatusTestOutput objects.
ReturnType solve() override
This method performs possibly repeated calls to the underlying linear solver's iterate() routine unti...
Traits class which defines basic operations on multivectors.
void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms) override
Set the parameters the solver manager should use to solve the linear problem.
Belos::StatusTest for logically combining several status tests.
bool isParameter(const std::string &name) const
A Belos::StatusTest class for specifying a maximum number of iterations.
Teuchos::RCP< StatusTestMaxIters< ScalarType, MV, OP > > maxIterTest_
ResetType
How to reset the solver.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Pure virtual base class which describes the basic interface for a solver manager. ...
int curDim
The current dimension of the reduction.
static constexpr const char * impResScale_default_
static void summarize(Ptr< const Comm< int > > comm, std::ostream &out=std::cout, const bool alwaysWriteLocal=false, const bool writeGlobalStats=true, const bool writeZeroTimers=true, const ECounterSetOp setOp=Intersection, const std::string &filter="", const bool ignoreZeroTimers=false)
Teuchos::RCP< StatusTest< ScalarType, MV, OP > > sTest_
BlockGmresSolMgrLinearProblemFailure(const std::string &what_arg)
void reset(const ResetType type) override
Performs a reset of the solver manager specified by the ResetType. This informs the solver manager th...
static constexpr bool flexibleGmres_default_
static constexpr int outputFreq_default_
Teuchos::RCP< std::ostream > outputStream_
A linear system to solve, and its associated information.
Class which describes the linear problem to be solved by the iterative solver.
This class implements the block flexible GMRES iteration, where a block Krylov subspace is constructe...
int getNumIters() const override
Get the iteration count for the most recent call to solve().
static constexpr const char * label_default_
Teuchos::RCP< SolverManager< ScalarType, MV, OP > > clone() const override
clone for Inverted Injection (DII)
ReturnType
Whether the Belos solve converged for all linear systems.
static constexpr int maxRestarts_default_
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
static constexpr int verbosity_default_
Belos concrete class for performing the block GMRES iteration.
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const
static const EVerbosityLevel verbLevel_default
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.
static constexpr bool adaptiveBlockSize_default_
static constexpr const char * expResScale_default_
static constexpr const char * orthoType_default_
static constexpr int outputStyle_default_
bool nonnull(const boost::shared_ptr< T > &p)
Teuchos::RCP< StatusTestOutput< ScalarType, MV, OP > > create(const Teuchos::RCP< OutputManager< ScalarType > > &printer, Teuchos::RCP< StatusTest< ScalarType, MV, OP > > test, int mod, int printStates)
Create the StatusTestOutput object specified by the outputStyle.
bool isLOADetected() const override
Return whether a loss of accuracy was detected by this solver during the most current solve...
static constexpr bool showMaxResNormOnly_default_
Belos::StatusTestResNorm for specifying general residual norm stopping criteria.
Belos::StatusTest for specifying an implicit residual norm stopping criteria that checks for loss of ...
BlockGmresSolMgr()
Empty constructor for BlockGmresSolMgr. This constructor takes no arguments and sets the default valu...
bool isType(const std::string &name) const
An implementation of the Belos::MatOrthoManager that performs orthogonalization using (potentially) m...
BlockGmresSolMgrOrthoFailure(const std::string &what_arg)
A class for extending the status testing capabilities of Belos via logical combinations.
Teuchos::RCP< StatusTestResNorm< ScalarType, MV, OP > > expConvTest_
std::string description() const override
Return a one-line description of this object.
Class which defines basic traits for the operator type.
Parent class to all Belos exceptions.
BlockGmresSolMgrOrthoFailure is thrown when the orthogonalization manager is unable to generate ortho...
Default parameters common to most Belos solvers.
Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > problem_
MagnitudeType achievedTol_
Pure virtual base class which augments the basic interface for a Gmres linear solver iteration...
GmresIterationOrthoFailure is thrown when the GmresIteration object is unable to compute independent ...
OperatorTraits< ScalarType, MV, OP > OPT
Belos header file which uses auto-configuration information to include necessary C++ headers...
Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const override
Get a parameter list containing the current parameters for this object.
Teuchos::RCP< Teuchos::ParameterList > params_
Teuchos::RCP< StatusTestResNorm< ScalarType, MV, OP > > impConvTest_
MagnitudeType orthoKappa_
const LinearProblem< ScalarType, MV, OP > & getProblem() const override
Get current linear problem being solved for in this object.
Belos concrete class for performing the block, flexible GMRES iteration.
MultiVecTraits< ScalarType, MV > MVT
Teuchos::RCP< Belos::MatOrthoManager< Scalar, MV, OP > > makeMatOrthoManager(const std::string &ortho, const Teuchos::RCP< const OP > &M, const Teuchos::RCP< OutputManager< Scalar > > &, const std::string &label, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Return an instance of the specified MatOrthoManager subclass.