10 #ifndef BELOS_BLOCK_GMRES_SOLMGR_HPP
11 #define BELOS_BLOCK_GMRES_SOLMGR_HPP
34 #ifdef BELOS_TEUCHOS_TIME_MONITOR
95 template<
class ScalarType,
class MV,
class OP>
172 return Teuchos::tuple(timerSolve_);
270 bool checkStatusTest();
294 static constexpr
int maxRestarts_default_ = 20;
295 static constexpr
int maxIters_default_ = 1000;
296 static constexpr
bool adaptiveBlockSize_default_ =
true;
297 static constexpr
bool showMaxResNormOnly_default_ =
false;
298 static constexpr
bool flexibleGmres_default_ =
false;
299 static constexpr
bool expResTest_default_ =
false;
300 static constexpr
int blockSize_default_ = 1;
301 static constexpr
int numBlocks_default_ = 300;
304 static constexpr
int outputFreq_default_ = -1;
305 static constexpr
const char * impResScale_default_ =
"Norm of Preconditioned Initial Residual";
306 static constexpr
const char * expResScale_default_ =
"Norm of Initial Residual";
307 static constexpr
const char * label_default_ =
"Belos";
308 static constexpr
const char * orthoType_default_ =
"ICGS";
311 MagnitudeType convtol_, orthoKappa_, achievedTol_;
312 int maxRestarts_, maxIters_, numIters_;
313 int blockSize_, numBlocks_, verbosity_, outputStyle_, outputFreq_;
314 bool adaptiveBlockSize_, showMaxResNormOnly_, isFlexible_, expResTest_;
315 std::string orthoType_;
316 std::string impResScale_, expResScale_;
323 bool isSet_, isSTSet_;
329 template<
class ScalarType,
class MV,
class OP>
331 outputStream_(Teuchos::rcpFromRef(std::cout)),
334 achievedTol_(Teuchos::ScalarTraits<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType>::zero()),
335 maxRestarts_(maxRestarts_default_),
336 maxIters_(maxIters_default_),
338 blockSize_(blockSize_default_),
339 numBlocks_(numBlocks_default_),
340 verbosity_(verbosity_default_),
341 outputStyle_(outputStyle_default_),
342 outputFreq_(outputFreq_default_),
343 adaptiveBlockSize_(adaptiveBlockSize_default_),
344 showMaxResNormOnly_(showMaxResNormOnly_default_),
345 isFlexible_(flexibleGmres_default_),
346 expResTest_(expResTest_default_),
347 orthoType_(orthoType_default_),
348 impResScale_(impResScale_default_),
349 expResScale_(expResScale_default_),
350 label_(label_default_),
358 template<
class ScalarType,
class MV,
class OP>
363 outputStream_(Teuchos::rcpFromRef(std::cout)),
366 achievedTol_(Teuchos::ScalarTraits<typename Teuchos::ScalarTraits<ScalarType>::magnitudeType>::zero()),
367 maxRestarts_(maxRestarts_default_),
368 maxIters_(maxIters_default_),
370 blockSize_(blockSize_default_),
371 numBlocks_(numBlocks_default_),
372 verbosity_(verbosity_default_),
373 outputStyle_(outputStyle_default_),
374 outputFreq_(outputFreq_default_),
375 adaptiveBlockSize_(adaptiveBlockSize_default_),
376 showMaxResNormOnly_(showMaxResNormOnly_default_),
377 isFlexible_(flexibleGmres_default_),
378 expResTest_(expResTest_default_),
379 orthoType_(orthoType_default_),
380 impResScale_(impResScale_default_),
381 expResScale_(expResScale_default_),
382 label_(label_default_),
398 template<
class ScalarType,
class MV,
class OP>
409 "The relative residual tolerance that needs to be achieved by the\n"
410 "iterative solver in order for the linear system to be declared converged." );
411 pl->
set(
"Maximum Restarts", static_cast<int>(maxRestarts_default_),
412 "The maximum number of restarts allowed for each\n"
413 "set of RHS solved.");
414 pl->
set(
"Maximum Iterations", static_cast<int>(maxIters_default_),
415 "The maximum number of block iterations allowed for each\n"
416 "set of RHS solved.");
417 pl->
set(
"Num Blocks", static_cast<int>(numBlocks_default_),
418 "The maximum number of blocks allowed in the Krylov subspace\n"
419 "for each set of RHS solved.");
420 pl->
set(
"Block Size", static_cast<int>(blockSize_default_),
421 "The number of vectors in each block. This number times the\n"
422 "number of blocks is the total Krylov subspace dimension.");
423 pl->
set(
"Adaptive Block Size", static_cast<bool>(adaptiveBlockSize_default_),
424 "Whether the solver manager should adapt the block size\n"
425 "based on the number of RHS to solve.");
426 pl->
set(
"Verbosity", static_cast<int>(verbosity_default_),
427 "What type(s) of solver information should be outputted\n"
428 "to the output stream.");
429 pl->
set(
"Output Style", static_cast<int>(outputStyle_default_),
430 "What style is used for the solver information outputted\n"
431 "to the output stream.");
432 pl->
set(
"Output Frequency", static_cast<int>(outputFreq_default_),
433 "How often convergence information should be outputted\n"
434 "to the output stream.");
435 pl->
set(
"Output Stream", Teuchos::rcpFromRef(std::cout),
436 "A reference-counted pointer to the output stream where all\n"
437 "solver output is sent.");
438 pl->
set(
"Show Maximum Residual Norm Only", static_cast<bool>(showMaxResNormOnly_default_),
439 "When convergence information is printed, only show the maximum\n"
440 "relative residual norm when the block size is greater than one.");
441 pl->
set(
"Flexible Gmres", static_cast<bool>(flexibleGmres_default_),
442 "Whether the solver manager should use the flexible variant\n"
444 pl->
set(
"Explicit Residual Test", static_cast<bool>(expResTest_default_),
445 "Whether the explicitly computed residual should be used in the convergence test.");
446 pl->
set(
"Implicit Residual Scaling", static_cast<const char *>(impResScale_default_),
447 "The type of scaling used in the implicit residual convergence test.");
448 pl->
set(
"Explicit Residual Scaling", static_cast<const char *>(expResScale_default_),
449 "The type of scaling used in the explicit residual convergence test.");
450 pl->
set(
"Timer Label", static_cast<const char *>(label_default_),
451 "The string to use as a prefix for the timer labels.");
452 pl->
set(
"Orthogonalization", static_cast<const char *>(orthoType_default_),
453 "The type of orthogonalization to use: DGKS, ICGS, or IMGS.");
455 "The constant used by DGKS orthogonalization to determine\n"
456 "whether another step of classical Gram-Schmidt is necessary.");
463 template<
class ScalarType,
class MV,
class OP>
468 if (params_ == Teuchos::null) {
477 maxRestarts_ = params->
get(
"Maximum Restarts",maxRestarts_default_);
480 params_->set(
"Maximum Restarts", maxRestarts_);
485 maxIters_ = params->
get(
"Maximum Iterations",maxIters_default_);
488 params_->set(
"Maximum Iterations", maxIters_);
489 if (maxIterTest_!=Teuchos::null)
490 maxIterTest_->setMaxIters( maxIters_ );
495 blockSize_ = params->
get(
"Block Size",blockSize_default_);
497 "Belos::BlockGmresSolMgr: \"Block Size\" must be strictly positive.");
500 params_->set(
"Block Size", blockSize_);
505 adaptiveBlockSize_ = params->
get(
"Adaptive Block Size",adaptiveBlockSize_default_);
508 params_->set(
"Adaptive Block Size", adaptiveBlockSize_);
513 numBlocks_ = params->
get(
"Num Blocks",numBlocks_default_);
515 "Belos::BlockGmresSolMgr: \"Num Blocks\" must be strictly positive.");
518 params_->set(
"Num Blocks", numBlocks_);
523 std::string tempLabel = params->
get(
"Timer Label", label_default_);
526 if (tempLabel != label_) {
528 params_->set(
"Timer Label", label_);
529 std::string solveLabel = label_ +
": BlockGmresSolMgr total solve time";
530 #ifdef BELOS_TEUCHOS_TIME_MONITOR
533 if (ortho_ != Teuchos::null) {
534 ortho_->setLabel( label_ );
541 isFlexible_ = Teuchos::getParameter<bool>(*params,
"Flexible Gmres");
542 params_->set(
"Flexible Gmres", isFlexible_);
543 if (isFlexible_ && expResTest_) {
551 if (Teuchos::isParameterType<int>(*params,
"Verbosity")) {
552 verbosity_ = params->
get(
"Verbosity", verbosity_default_);
554 verbosity_ = (int)Teuchos::getParameter<Belos::MsgType>(*params,
"Verbosity");
558 params_->set(
"Verbosity", verbosity_);
559 if (printer_ != Teuchos::null)
560 printer_->setVerbosity(verbosity_);
565 if (Teuchos::isParameterType<int>(*params,
"Output Style")) {
566 outputStyle_ = params->
get(
"Output Style", outputStyle_default_);
568 outputStyle_ = (int)Teuchos::getParameter<Belos::OutputType>(*params,
"Output Style");
572 params_->set(
"Output Style", outputStyle_);
573 if (outputTest_ != Teuchos::null) {
580 outputStream_ = Teuchos::getParameter<Teuchos::RCP<std::ostream> >(*params,
"Output Stream");
583 params_->set(
"Output Stream", outputStream_);
584 if (printer_ != Teuchos::null)
585 printer_->setOStream( outputStream_ );
591 outputFreq_ = params->
get(
"Output Frequency", outputFreq_default_);
595 params_->set(
"Output Frequency", outputFreq_);
596 if (outputTest_ != Teuchos::null)
597 outputTest_->setOutputFrequency( outputFreq_ );
601 if (printer_ == Teuchos::null) {
606 bool changedOrthoType =
false;
608 std::string tempOrthoType = params->
get(
"Orthogonalization",orthoType_default_);
609 if (tempOrthoType != orthoType_) {
610 orthoType_ = tempOrthoType;
611 changedOrthoType =
true;
614 params_->set(
"Orthogonalization", orthoType_);
617 if (params->
isParameter(
"Orthogonalization Constant")) {
618 if (params->
isType<MagnitudeType> (
"Orthogonalization Constant")) {
619 orthoKappa_ = params->
get (
"Orthogonalization Constant",
623 orthoKappa_ = params->
get (
"Orthogonalization Constant",
628 params_->set(
"Orthogonalization Constant",orthoKappa_);
629 if (orthoType_==
"DGKS") {
630 if (orthoKappa_ > 0 && ortho_ != Teuchos::null && !changedOrthoType) {
637 if (ortho_ == Teuchos::null || changedOrthoType) {
640 if (orthoType_==
"DGKS" && orthoKappa_ > 0) {
642 paramsOrtho->
set (
"depTol", orthoKappa_ );
645 ortho_ = factory.
makeMatOrthoManager (orthoType_, Teuchos::null, printer_, label_, paramsOrtho);
649 if (params->
isParameter(
"Convergence Tolerance")) {
650 if (params->
isType<MagnitudeType> (
"Convergence Tolerance")) {
651 convtol_ = params->
get (
"Convergence Tolerance",
659 params_->set(
"Convergence Tolerance", convtol_);
660 if (impConvTest_ != Teuchos::null)
661 impConvTest_->setTolerance( convtol_ );
662 if (expConvTest_ != Teuchos::null)
663 expConvTest_->setTolerance( convtol_ );
667 if (params->
isParameter(
"Implicit Residual Scaling")) {
668 std::string tempImpResScale = Teuchos::getParameter<std::string>( *params,
"Implicit Residual Scaling" );
671 if (impResScale_ != tempImpResScale) {
673 impResScale_ = tempImpResScale;
676 params_->set(
"Implicit Residual Scaling", impResScale_);
677 if (impConvTest_ != Teuchos::null) {
681 catch (std::exception& e) {
689 if (params->
isParameter(
"Explicit Residual Scaling")) {
690 std::string tempExpResScale = Teuchos::getParameter<std::string>( *params,
"Explicit Residual Scaling" );
693 if (expResScale_ != tempExpResScale) {
695 expResScale_ = tempExpResScale;
698 params_->set(
"Explicit Residual Scaling", expResScale_);
699 if (expConvTest_ != Teuchos::null) {
703 catch (std::exception& e) {
711 if (params->
isParameter(
"Explicit Residual Test")) {
712 expResTest_ = Teuchos::getParameter<bool>( *params,
"Explicit Residual Test" );
715 params_->set(
"Explicit Residual Test", expResTest_);
716 if (expConvTest_ == Teuchos::null) {
721 if (params->
isParameter(
"Show Maximum Residual Norm Only")) {
722 showMaxResNormOnly_ = Teuchos::getParameter<bool>(*params,
"Show Maximum Residual Norm Only");
725 params_->set(
"Show Maximum Residual Norm Only", showMaxResNormOnly_);
726 if (impConvTest_ != Teuchos::null)
727 impConvTest_->setShowMaxResNormOnly( showMaxResNormOnly_ );
728 if (expConvTest_ != Teuchos::null)
729 expConvTest_->setShowMaxResNormOnly( showMaxResNormOnly_ );
734 if (timerSolve_ == Teuchos::null) {
735 std::string solveLabel = label_ +
": BlockGmresSolMgr total solve time";
736 #ifdef BELOS_TEUCHOS_TIME_MONITOR
746 template<
class ScalarType,
class MV,
class OP>
761 params_->set(
"Flexible Gmres", isFlexible_);
765 "Belos::BlockGmresSolMgr::solve(): Linear problem has a left preconditioner, not a right preconditioner, which is required for flexible GMRES.");
780 tmpImpConvTest->setShowMaxResNormOnly( showMaxResNormOnly_ );
781 impConvTest_ = tmpImpConvTest;
786 tmpExpConvTest->defineResForm( StatusTestGenResNorm_t::Explicit,
Belos::TwoNorm );
788 tmpExpConvTest->setShowMaxResNormOnly( showMaxResNormOnly_ );
789 expConvTest_ = tmpExpConvTest;
792 convTest_ =
Teuchos::rcp(
new StatusTestCombo_t( StatusTestCombo_t::SEQ, impConvTest_, expConvTest_ ) );
801 tmpImpConvTest->setShowMaxResNormOnly( showMaxResNormOnly_ );
802 impConvTest_ = tmpImpConvTest;
810 tmpImpConvTest->setShowMaxResNormOnly( showMaxResNormOnly_ );
811 impConvTest_ = tmpImpConvTest;
815 expConvTest_ = impConvTest_;
816 convTest_ = impConvTest_;
820 sTest_ =
Teuchos::rcp(
new StatusTestCombo_t( StatusTestCombo_t::OR, maxIterTest_, convTest_ ) );
823 if (
nonnull(debugStatusTest_) ) {
825 Teuchos::rcp_dynamic_cast<StatusTestCombo_t>(sTest_)->addStatusTest( debugStatusTest_ );
830 StatusTestOutputFactory<ScalarType,MV,OP> stoFactory( outputStyle_ );
834 std::string solverDesc =
" Block Gmres ";
836 solverDesc =
"Flexible" + solverDesc;
837 outputTest_->setSolverDesc( solverDesc );
845 template<
class ScalarType,
class MV,
class OP>
850 debugStatusTest_ = debugStatusTest;
855 template<
class ScalarType,
class MV,
class OP>
862 setParameters(Teuchos::parameterList(*getValidParameters()));
866 "Belos::BlockGmresSolMgr::solve(): Linear problem is not a valid object.");
869 "Belos::BlockGmresSolMgr::solve(): Linear problem is not ready, setProblem() has not been called.");
871 if (!isSTSet_ || (!expResTest_ && !
Teuchos::is_null(problem_->getLeftPrec())) ) {
873 "Belos::BlockGmresSolMgr::solve(): Linear problem and requested status tests are incompatible.");
878 int numRHS2Solve = MVT::GetNumberVecs( *(problem_->getRHS()) );
879 int numCurrRHS = ( numRHS2Solve < blockSize_) ? numRHS2Solve : blockSize_;
881 std::vector<int> currIdx;
884 if ( adaptiveBlockSize_ ) {
885 blockSize_ = numCurrRHS;
886 currIdx.resize( numCurrRHS );
887 for (
int i=0; i<numCurrRHS; ++i)
888 { currIdx[i] = startPtr+i; }
892 currIdx.resize( blockSize_ );
893 for (
int i=0; i<numCurrRHS; ++i)
894 { currIdx[i] = startPtr+i; }
895 for (
int i=numCurrRHS; i<blockSize_; ++i)
900 problem_->setLSIndex( currIdx );
905 plist.
set(
"Block Size",blockSize_);
907 ptrdiff_t dim = MVT::GetGlobalLength( *(problem_->getRHS()) );
908 if (blockSize_*static_cast<ptrdiff_t>(numBlocks_) > dim) {
909 int tmpNumBlocks = 0;
911 tmpNumBlocks = dim / blockSize_;
913 tmpNumBlocks = ( dim - blockSize_) / blockSize_;
915 "Belos::BlockGmresSolMgr::solve(): Warning! Requested Krylov subspace dimension is larger than operator dimension!"
916 << std::endl <<
" The maximum number of blocks allowed for the Krylov subspace will be adjusted to " << tmpNumBlocks << std::endl;
917 plist.
set(
"Num Blocks",tmpNumBlocks);
920 plist.
set(
"Num Blocks",numBlocks_);
923 outputTest_->reset();
924 loaDetected_ =
false;
927 bool isConverged =
true;
941 #ifdef BELOS_TEUCHOS_TIME_MONITOR
945 while ( numRHS2Solve > 0 ) {
948 if (blockSize_*numBlocks_ > dim) {
949 int tmpNumBlocks = 0;
951 tmpNumBlocks = dim / blockSize_;
953 tmpNumBlocks = ( dim - blockSize_) / blockSize_;
954 block_gmres_iter->setSize( blockSize_, tmpNumBlocks );
957 block_gmres_iter->setSize( blockSize_, numBlocks_ );
960 block_gmres_iter->resetNumIters();
963 outputTest_->resetNumCalls();
969 if (currIdx[blockSize_-1] == -1) {
970 V_0 = MVT::Clone( *(problem_->getInitResVec()), blockSize_ );
971 problem_->computeCurrResVec( &*V_0 );
974 V_0 = MVT::CloneCopy( *(problem_->getInitResVec()), currIdx );
979 if (currIdx[blockSize_-1] == -1) {
980 V_0 = MVT::Clone( *(problem_->getInitPrecResVec()), blockSize_ );
981 problem_->computeCurrPrecResVec( &*V_0 );
984 V_0 = MVT::CloneCopy( *(problem_->getInitPrecResVec()), currIdx );
993 int rank = ortho_->normalize( *V_0, z_0 );
995 "Belos::BlockGmresSolMgr::solve(): Failed to compute initial block of orthonormal vectors.");
1002 block_gmres_iter->initializeGmres(newstate);
1003 int numRestarts = 0;
1008 block_gmres_iter->iterate();
1015 if ( convTest_->getStatus() ==
Passed ) {
1016 if ( expConvTest_->getLOADetected() ) {
1018 loaDetected_ =
true;
1020 "Belos::BlockGmresSolMgr::solve(): Warning! Solver has experienced a loss of accuracy!" << std::endl;
1021 isConverged =
false;
1030 else if ( maxIterTest_->getStatus() ==
Passed ) {
1032 isConverged =
false;
1040 else if ( block_gmres_iter->getCurSubspaceDim() == block_gmres_iter->getMaxSubspaceDim() ) {
1042 if ( numRestarts >= maxRestarts_ ) {
1043 isConverged =
false;
1048 printer_->stream(
Debug) <<
" Performing restart number " << numRestarts <<
" of " << maxRestarts_ << std::endl << std::endl;
1055 MVT::MvAddMv( 1.0, *curX, 1.0, *update, *curX );
1058 problem_->updateSolution( update,
true );
1065 V_0 = MVT::Clone( *(oldState.
V), blockSize_ );
1067 problem_->computeCurrResVec( &*V_0 );
1069 problem_->computeCurrPrecResVec( &*V_0 );
1075 rank = ortho_->normalize( *V_0, z_0 );
1077 "Belos::BlockGmresSolMgr::solve(): Failed to compute initial block of orthonormal vectors after restart.");
1083 block_gmres_iter->initializeGmres(newstate);
1096 "Belos::BlockGmresSolMgr::solve(): Invalid return from BlockGmresIter::iterate().");
1101 if (blockSize_ != 1) {
1102 printer_->stream(
Errors) <<
"Error! Caught std::exception in BlockGmresIter::iterate() at iteration "
1103 << block_gmres_iter->getNumIters() << std::endl
1104 << e.what() << std::endl;
1105 if (convTest_->getStatus() !=
Passed)
1106 isConverged =
false;
1111 block_gmres_iter->updateLSQR( block_gmres_iter->getCurSubspaceDim() );
1114 sTest_->checkStatus( &*block_gmres_iter );
1115 if (convTest_->getStatus() !=
Passed)
1116 isConverged =
false;
1122 achievedTol_ = MT::one();
1124 MVT::MvInit( *X, SCT::zero() );
1125 printer_->stream(
Warnings) <<
"Belos::BlockGmresSolMgr::solve(): Warning! NaN has been detected!"
1129 catch (
const std::exception &e) {
1130 printer_->stream(
Errors) <<
"Error! Caught std::exception in BlockGmresIter::iterate() at iteration "
1131 << block_gmres_iter->getNumIters() << std::endl
1132 << e.what() << std::endl;
1144 if (update != Teuchos::null)
1145 MVT::MvAddMv( 1.0, *curX, 1.0, *update, *curX );
1152 MVT::MvAddMv( 0.0, *newX, 1.0, *newX, *curX );
1156 problem_->updateSolution( update,
true );
1161 problem_->setCurrLS();
1164 startPtr += numCurrRHS;
1165 numRHS2Solve -= numCurrRHS;
1166 if ( numRHS2Solve > 0 ) {
1167 numCurrRHS = ( numRHS2Solve < blockSize_) ? numRHS2Solve : blockSize_;
1169 if ( adaptiveBlockSize_ ) {
1170 blockSize_ = numCurrRHS;
1171 currIdx.resize( numCurrRHS );
1172 for (
int i=0; i<numCurrRHS; ++i)
1173 { currIdx[i] = startPtr+i; }
1176 currIdx.resize( blockSize_ );
1177 for (
int i=0; i<numCurrRHS; ++i)
1178 { currIdx[i] = startPtr+i; }
1179 for (
int i=numCurrRHS; i<blockSize_; ++i)
1180 { currIdx[i] = -1; }
1183 problem_->setLSIndex( currIdx );
1186 currIdx.resize( numRHS2Solve );
1197 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1206 numIters_ = maxIterTest_->getNumIters();
1220 const std::vector<MagnitudeType>* pTestValues = NULL;
1222 pTestValues = expConvTest_->getTestValue();
1223 if (pTestValues == NULL || pTestValues->size() < 1) {
1224 pTestValues = impConvTest_->getTestValue();
1229 pTestValues = impConvTest_->getTestValue();
1232 "Belos::BlockGmresSolMgr::solve(): The implicit convergence test's "
1233 "getTestValue() method returned NULL. Please report this bug to the "
1234 "Belos developers.");
1236 "Belos::BlockGmresSolMgr::solve(): The implicit convergence test's "
1237 "getTestValue() method returned a vector of length zero. Please report "
1238 "this bug to the Belos developers.");
1243 achievedTol_ = *std::max_element (pTestValues->begin(), pTestValues->end());
1246 if (!isConverged || loaDetected_) {
1253 template<
class ScalarType,
class MV,
class OP>
1256 std::ostringstream out;
1257 out <<
"\"Belos::BlockGmresSolMgr\": {";
1258 if (this->getObjectLabel () !=
"") {
1259 out <<
"Label: " << this->getObjectLabel () <<
", ";
1261 out <<
"Flexible: " << (isFlexible_ ?
"true" :
"false")
1262 <<
", Num Blocks: " << numBlocks_
1263 <<
", Maximum Iterations: " << maxIters_
1264 <<
", Maximum Restarts: " << maxRestarts_
1265 <<
", Convergence Tolerance: " << convtol_
1271 template<
class ScalarType,
class MV,
class OP>
1293 out <<
"\"Belos::BlockGmresSolMgr\":" << endl;
1295 out <<
"Template parameters:" << endl;
1298 out <<
"ScalarType: " << TypeNameTraits<ScalarType>::name () << endl
1299 <<
"MV: " << TypeNameTraits<MV>::name () << endl
1300 <<
"OP: " << TypeNameTraits<OP>::name () << endl;
1302 if (this->getObjectLabel () !=
"") {
1303 out <<
"Label: " << this->getObjectLabel () << endl;
1305 out <<
"Flexible: " << (isFlexible_ ?
"true" :
"false") << endl
1306 <<
"Num Blocks: " << numBlocks_ << endl
1307 <<
"Maximum Iterations: " << maxIters_ << endl
1308 <<
"Maximum Restarts: " << maxRestarts_ << endl
1309 <<
"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::Array< Teuchos::RCP< Teuchos::Time > > getTimers() const
Return the timers for this object.
Collection of types and exceptions used within the Belos solvers.
Belos's basic output manager for sending information of select verbosity levels to the appropriate ou...
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...
ScaleType
The type of scaling to use on the residual norm value.
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(const std::string &name, T def_value)
Virtual base class for StatusTest that printing status tests.
bool is_null(const std::shared_ptr< T > &p)
MagnitudeType achievedTol() const override
Tolerance achieved by the last solve() invocation.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Get a parameter list containing the valid parameters for this object.
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.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
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.
Interface to Block GMRES and Flexible GMRES.
A pure virtual class for defining the status tests for the Belos iterative solvers.
virtual ~BlockGmresSolMgr()
Destructor.
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.
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 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)
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...
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().
Teuchos::RCP< SolverManager< ScalarType, MV, OP > > clone() const override
clone for Inverted Injection (DII)
ReturnType
Whether the Belos solve converged for all linear systems.
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
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.
bool nonnull(const boost::shared_ptr< T > &p)
bool isLOADetected() const override
Return whether a loss of accuracy was detected by this solver during the most current solve...
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.
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.
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 ...
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.
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.
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.