10 #ifndef BELOS_GCRODR_SOLMGR_HPP
11 #define BELOS_GCRODR_SOLMGR_HPP
34 #ifdef BELOS_TEUCHOS_TIME_MONITOR
36 #endif // BELOS_TEUCHOS_TIME_MONITOR
38 #if defined(HAVE_TEUCHOSCORE_CXX11)
39 # include <type_traits>
40 # if defined(HAVE_TEUCHOS_COMPLEX)
41 #include "Kokkos_Complex.hpp"
43 #endif // defined(HAVE_TEUCHOSCORE_CXX11)
130 template<
class ScalarType,
class MV,
class OP,
131 const bool lapackSupportsScalarType =
136 static const bool requiresLapack =
155 template<
class ScalarType,
class MV,
class OP>
160 #if defined(HAVE_TEUCHOSCORE_CXX11)
161 # if defined(HAVE_TEUCHOS_COMPLEX)
162 #if defined(HAVE_TEUCHOS_LONG_DOUBLE)
163 static_assert (std::is_same<ScalarType, std::complex<float> >::value ||
164 std::is_same<ScalarType, std::complex<double> >::value ||
165 std::is_same<ScalarType, Kokkos::complex<double> >::value ||
166 std::is_same<ScalarType, float>::value ||
167 std::is_same<ScalarType, double>::value ||
168 std::is_same<ScalarType, long double>::value,
169 "Belos::GCRODRSolMgr: ScalarType must be one of the four "
170 "types (S,D,C,Z) supported by LAPACK or long double (largely not impl'd).");
172 static_assert (std::is_same<ScalarType, std::complex<float> >::value ||
173 std::is_same<ScalarType, std::complex<double> >::value ||
174 std::is_same<ScalarType, Kokkos::complex<double> >::value ||
175 std::is_same<ScalarType, float>::value ||
176 std::is_same<ScalarType, double>::value,
177 "Belos::GCRODRSolMgr: ScalarType must be one of the four "
178 "types (S,D,C,Z) supported by LAPACK.");
181 #if defined(HAVE_TEUCHOS_LONG_DOUBLE)
182 static_assert (std::is_same<ScalarType, float>::value ||
183 std::is_same<ScalarType, double>::value ||
184 std::is_same<ScalarType, long double>::value,
185 "Belos::GCRODRSolMgr: ScalarType must be float, double or long double. "
186 "Complex arithmetic support is currently disabled. To "
187 "enable it, set Teuchos_ENABLE_COMPLEX=ON.");
189 static_assert (std::is_same<ScalarType, float>::value ||
190 std::is_same<ScalarType, double>::value,
191 "Belos::GCRODRSolMgr: ScalarType must be float or double. "
192 "Complex arithmetic support is currently disabled. To "
193 "enable it, set Teuchos_ENABLE_COMPLEX=ON.");
195 # endif // defined(HAVE_TEUCHOS_COMPLEX)
196 #endif // defined(HAVE_TEUCHOSCORE_CXX11)
306 return Teuchos::tuple(timerSolve_);
350 bool set = problem_->setProblem();
352 throw "Could not set problem.";
396 std::string description()
const override;
406 void initializeStateStorage();
415 int getHarmonicVecs1(
int m,
424 int getHarmonicVecs2(
int keff,
int m,
430 void sort(std::vector<MagnitudeType>& dlist,
int n, std::vector<int>& iperm);
458 static constexpr
double orthoKappa_default_ = 0.0;
459 static constexpr
int maxRestarts_default_ = 100;
460 static constexpr
int maxIters_default_ = 1000;
461 static constexpr
int numBlocks_default_ = 50;
462 static constexpr
int blockSize_default_ = 1;
463 static constexpr
int recycledBlocks_default_ = 5;
466 static constexpr
int outputFreq_default_ = -1;
467 static constexpr
const char * impResScale_default_ =
"Norm of Preconditioned Initial Residual";
468 static constexpr
const char * expResScale_default_ =
"Norm of Initial Residual";
469 static constexpr
const char * label_default_ =
"Belos";
470 static constexpr
const char * orthoType_default_ =
"ICGS";
473 MagnitudeType convTol_, orthoKappa_, achievedTol_;
474 int maxRestarts_, maxIters_, numIters_;
475 int verbosity_, outputStyle_, outputFreq_;
476 std::string orthoType_;
477 std::string impResScale_, expResScale_;
484 int numBlocks_, recycledBlocks_;
506 std::vector<ScalarType> tau_;
507 std::vector<ScalarType> work_;
509 std::vector<int> ipiv_;
520 bool builtRecycleSpace_;
525 template<
class ScalarType,
class MV,
class OP>
535 template<
class ScalarType,
class MV,
class OP>
547 problem == Teuchos::null, std::invalid_argument,
548 "Belos::GCRODRSolMgr constructor: The solver manager's "
549 "constructor needs the linear problem argument 'problem' "
564 template<
class ScalarType,
class MV,
class OP>
566 outputStream_ = Teuchos::rcpFromRef(std::cout);
568 orthoKappa_ = orthoKappa_default_;
569 maxRestarts_ = maxRestarts_default_;
570 maxIters_ = maxIters_default_;
571 numBlocks_ = numBlocks_default_;
572 recycledBlocks_ = recycledBlocks_default_;
573 verbosity_ = verbosity_default_;
574 outputStyle_ = outputStyle_default_;
575 outputFreq_ = outputFreq_default_;
576 orthoType_ = orthoType_default_;
577 impResScale_ = impResScale_default_;
578 expResScale_ = expResScale_default_;
579 label_ = label_default_;
581 builtRecycleSpace_ =
false;
597 template<
class ScalarType,
class MV,
class OP>
602 using Teuchos::isParameterType;
603 using Teuchos::getParameter;
606 using Teuchos::parameterList;
609 using Teuchos::rcp_dynamic_cast;
610 using Teuchos::rcpFromRef;
617 RCP<const ParameterList> defaultParams = getValidParameters();
635 if (params_.is_null()) {
636 params_ = parameterList (*defaultParams);
644 if (params_ != params) {
650 params_ = parameterList (*params);
685 params_->validateParametersAndSetDefaults (*defaultParams);
690 maxRestarts_ = params->
get(
"Maximum Restarts", maxRestarts_default_);
693 params_->set (
"Maximum Restarts", maxRestarts_);
698 maxIters_ = params->
get (
"Maximum Iterations", maxIters_default_);
701 params_->set (
"Maximum Iterations", maxIters_);
702 if (! maxIterTest_.is_null())
703 maxIterTest_->setMaxIters (maxIters_);
708 numBlocks_ = params->
get (
"Num Blocks", numBlocks_default_);
710 "Belos::GCRODRSolMgr: The \"Num Blocks\" parameter must "
711 "be strictly positive, but you specified a value of "
712 << numBlocks_ <<
".");
714 params_->set (
"Num Blocks", numBlocks_);
719 recycledBlocks_ = params->
get (
"Num Recycled Blocks",
720 recycledBlocks_default_);
722 "Belos::GCRODRSolMgr: The \"Num Recycled Blocks\" "
723 "parameter must be strictly positive, but you specified "
724 "a value of " << recycledBlocks_ <<
".");
726 "Belos::GCRODRSolMgr: The \"Num Recycled Blocks\" "
727 "parameter must be less than the \"Num Blocks\" "
728 "parameter, but you specified \"Num Recycled Blocks\" "
729 "= " << recycledBlocks_ <<
" and \"Num Blocks\" = "
730 << numBlocks_ <<
".");
732 params_->set(
"Num Recycled Blocks", recycledBlocks_);
739 std::string tempLabel = params->
get (
"Timer Label", label_default_);
742 if (tempLabel != label_) {
744 params_->set (
"Timer Label", label_);
745 std::string solveLabel = label_ +
": GCRODRSolMgr total solve time";
746 #ifdef BELOS_TEUCHOS_TIME_MONITOR
749 if (ortho_ != Teuchos::null) {
750 ortho_->setLabel( label_ );
757 if (isParameterType<int> (*params,
"Verbosity")) {
758 verbosity_ = params->
get (
"Verbosity", verbosity_default_);
760 verbosity_ = (int) getParameter<Belos::MsgType> (*params,
"Verbosity");
763 params_->set (
"Verbosity", verbosity_);
766 if (! printer_.is_null())
767 printer_->setVerbosity (verbosity_);
772 if (isParameterType<int> (*params,
"Output Style")) {
773 outputStyle_ = params->
get (
"Output Style", outputStyle_default_);
775 outputStyle_ = (int) getParameter<OutputType> (*params,
"Output Style");
779 params_->set (
"Output Style", outputStyle_);
799 outputStream_ = getParameter<RCP<std::ostream> > (*params,
"Output Stream");
800 }
catch (InvalidParameter&) {
801 outputStream_ = rcpFromRef (std::cout);
808 if (outputStream_.is_null()) {
812 params_->set (
"Output Stream", outputStream_);
815 if (! printer_.is_null()) {
816 printer_->setOStream (outputStream_);
823 outputFreq_ = params->
get (
"Output Frequency", outputFreq_default_);
827 params_->set(
"Output Frequency", outputFreq_);
828 if (! outputTest_.is_null())
829 outputTest_->setOutputFrequency (outputFreq_);
836 if (printer_.is_null()) {
847 bool changedOrthoType =
false;
849 const std::string& tempOrthoType =
850 params->
get (
"Orthogonalization", orthoType_default_);
853 std::ostringstream os;
854 os <<
"Belos::GCRODRSolMgr: Invalid orthogonalization name \""
855 << tempOrthoType <<
"\". The following are valid options "
856 <<
"for the \"Orthogonalization\" name parameter: ";
858 throw std::invalid_argument (os.str());
860 if (tempOrthoType != orthoType_) {
861 changedOrthoType =
true;
862 orthoType_ = tempOrthoType;
864 params_->set (
"Orthogonalization", orthoType_);
880 RCP<ParameterList> orthoParams;
883 using Teuchos::sublist;
885 const std::string paramName (
"Orthogonalization Parameters");
888 orthoParams = sublist (params_, paramName,
true);
889 }
catch (InvalidParameter&) {
896 orthoParams = sublist (params_, paramName,
true);
900 "Failed to get orthogonalization parameters. "
901 "Please report this bug to the Belos developers.");
906 if (ortho_.is_null() || changedOrthoType) {
912 label_, orthoParams);
921 RCP<PLA> pla = rcp_dynamic_cast<PLA> (ortho_);
927 label_, orthoParams);
929 pla->setParameterList (orthoParams);
941 if (params->
isParameter (
"Orthogonalization Constant")) {
942 MagnitudeType orthoKappa = orthoKappa_default_;
943 if (params->
isType<MagnitudeType> (
"Orthogonalization Constant")) {
944 orthoKappa = params->
get (
"Orthogonalization Constant", orthoKappa);
947 orthoKappa = params->
get (
"Orthogonalization Constant", orthoKappa_default_);
950 if (orthoKappa > 0) {
951 orthoKappa_ = orthoKappa;
953 params_->set(
"Orthogonalization Constant", orthoKappa_);
955 if (orthoType_ ==
"DGKS" && ! ortho_.is_null()) {
962 rcp_dynamic_cast<ortho_man_type>(ortho_)->setDepTol (orthoKappa_);
972 if (params->
isParameter(
"Convergence Tolerance")) {
973 if (params->
isType<MagnitudeType> (
"Convergence Tolerance")) {
974 convTol_ = params->
get (
"Convergence Tolerance",
982 params_->set (
"Convergence Tolerance", convTol_);
983 if (! impConvTest_.is_null())
984 impConvTest_->setTolerance (convTol_);
985 if (! expConvTest_.is_null())
986 expConvTest_->setTolerance (convTol_);
990 if (params->
isParameter (
"Implicit Residual Scaling")) {
991 std::string tempImpResScale =
992 getParameter<std::string> (*params,
"Implicit Residual Scaling");
995 if (impResScale_ != tempImpResScale) {
997 impResScale_ = tempImpResScale;
1000 params_->set(
"Implicit Residual Scaling", impResScale_);
1010 if (! impConvTest_.is_null()) {
1016 impConvTest_ = null;
1023 if (params->
isParameter(
"Explicit Residual Scaling")) {
1024 std::string tempExpResScale =
1025 getParameter<std::string> (*params,
"Explicit Residual Scaling");
1028 if (expResScale_ != tempExpResScale) {
1030 expResScale_ = tempExpResScale;
1033 params_->set(
"Explicit Residual Scaling", expResScale_);
1036 if (! expConvTest_.is_null()) {
1042 expConvTest_ = null;
1053 if (maxIterTest_.is_null())
1058 if (impConvTest_.is_null()) {
1059 impConvTest_ =
rcp (
new StatusTestResNorm_t (convTol_));
1065 if (expConvTest_.is_null()) {
1066 expConvTest_ =
rcp (
new StatusTestResNorm_t (convTol_));
1067 expConvTest_->defineResForm (StatusTestResNorm_t::Explicit,
Belos::TwoNorm);
1073 if (convTest_.is_null()) {
1074 convTest_ =
rcp (
new StatusTestCombo_t (StatusTestCombo_t::SEQ,
1082 sTest_ =
rcp (
new StatusTestCombo_t (StatusTestCombo_t::OR,
1088 outputTest_ = stoFactory.
create (printer_, sTest_, outputFreq_,
1092 std::string solverDesc =
" GCRODR ";
1093 outputTest_->setSolverDesc( solverDesc );
1096 if (timerSolve_.is_null()) {
1097 std::string solveLabel = label_ +
": GCRODRSolMgr total solve time";
1098 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1108 template<
class ScalarType,
class MV,
class OP>
1113 using Teuchos::parameterList;
1116 static RCP<const ParameterList> validPL;
1118 RCP<ParameterList> pl = parameterList ();
1122 "The relative residual tolerance that needs to be achieved by the\n"
1123 "iterative solver in order for the linear system to be declared converged.");
1124 pl->set(
"Maximum Restarts", static_cast<int>(maxRestarts_default_),
1125 "The maximum number of cycles allowed for each\n"
1126 "set of RHS solved.");
1127 pl->set(
"Maximum Iterations", static_cast<int>(maxIters_default_),
1128 "The maximum number of iterations allowed for each\n"
1129 "set of RHS solved.");
1133 pl->set(
"Block Size", static_cast<int>(blockSize_default_),
1134 "Block Size Parameter -- currently must be 1 for GCRODR");
1135 pl->set(
"Num Blocks", static_cast<int>(numBlocks_default_),
1136 "The maximum number of vectors allowed in the Krylov subspace\n"
1137 "for each set of RHS solved.");
1138 pl->set(
"Num Recycled Blocks", static_cast<int>(recycledBlocks_default_),
1139 "The maximum number of vectors in the recycled subspace." );
1140 pl->set(
"Verbosity", static_cast<int>(verbosity_default_),
1141 "What type(s) of solver information should be outputted\n"
1142 "to the output stream.");
1143 pl->set(
"Output Style", static_cast<int>(outputStyle_default_),
1144 "What style is used for the solver information outputted\n"
1145 "to the output stream.");
1146 pl->set(
"Output Frequency", static_cast<int>(outputFreq_default_),
1147 "How often convergence information should be outputted\n"
1148 "to the output stream.");
1149 pl->set(
"Output Stream", Teuchos::rcpFromRef(std::cout),
1150 "A reference-counted pointer to the output stream where all\n"
1151 "solver output is sent.");
1152 pl->set(
"Implicit Residual Scaling", static_cast<const char *>(impResScale_default_),
1153 "The type of scaling used in the implicit residual convergence test.");
1154 pl->set(
"Explicit Residual Scaling", static_cast<const char *>(expResScale_default_),
1155 "The type of scaling used in the explicit residual convergence test.");
1156 pl->set(
"Timer Label", static_cast<const char *>(label_default_),
1157 "The string to use as a prefix for the timer labels.");
1160 pl->set(
"Orthogonalization", static_cast<const char *>(orthoType_default_),
1161 "The type of orthogonalization to use. Valid options: " +
1163 RCP<const ParameterList> orthoParams =
1165 pl->
set (
"Orthogonalization Parameters", *orthoParams,
1166 "Parameters specific to the type of orthogonalization used.");
1168 pl->
set(
"Orthogonalization Constant",static_cast<MagnitudeType>(orthoKappa_default_),
1169 "When using DGKS orthogonalization: the \"depTol\" constant, used "
1170 "to determine whether another step of classical Gram-Schmidt is "
1171 "necessary. Otherwise ignored.");
1178 template<
class ScalarType,
class MV,
class OP>
1185 if (rhsMV == Teuchos::null) {
1193 "Belos::GCRODRSolMgr::initializeStateStorage(): Cannot generate a Krylov basis with dimension larger the operator!");
1196 if (U_ == Teuchos::null) {
1197 U_ = MVT::Clone( *rhsMV, recycledBlocks_+1 );
1201 if (MVT::GetNumberVecs(*U_) < recycledBlocks_+1) {
1203 U_ = MVT::Clone( *tmp, recycledBlocks_+1 );
1208 if (C_ == Teuchos::null) {
1209 C_ = MVT::Clone( *rhsMV, recycledBlocks_+1 );
1213 if (MVT::GetNumberVecs(*C_) < recycledBlocks_+1) {
1215 C_ = MVT::Clone( *tmp, recycledBlocks_+1 );
1220 if (V_ == Teuchos::null) {
1221 V_ = MVT::Clone( *rhsMV, numBlocks_+1 );
1225 if (MVT::GetNumberVecs(*V_) < numBlocks_+1) {
1227 V_ = MVT::Clone( *tmp, numBlocks_+1 );
1232 if (U1_ == Teuchos::null) {
1233 U1_ = MVT::Clone( *rhsMV, recycledBlocks_+1 );
1237 if (MVT::GetNumberVecs(*U1_) < recycledBlocks_+1) {
1239 U1_ = MVT::Clone( *tmp, recycledBlocks_+1 );
1244 if (C1_ == Teuchos::null) {
1245 C1_ = MVT::Clone( *rhsMV, recycledBlocks_+1 );
1249 if (MVT::GetNumberVecs(*C1_) < recycledBlocks_+1) {
1251 C1_ = MVT::Clone( *tmp, recycledBlocks_+1 );
1256 if (r_ == Teuchos::null)
1257 r_ = MVT::Clone( *rhsMV, 1 );
1260 tau_.resize(recycledBlocks_+1);
1263 work_.resize(recycledBlocks_+1);
1266 ipiv_.resize(recycledBlocks_+1);
1269 if (H2_ == Teuchos::null)
1272 if ( (H2_->numRows() != numBlocks_+recycledBlocks_+2) || (H2_->numCols() != numBlocks_+recycledBlocks_+1) )
1273 H2_->reshape( numBlocks_+recycledBlocks_+2, numBlocks_+recycledBlocks_+1 );
1275 H2_->putScalar(zero);
1278 if (R_ == Teuchos::null)
1281 if ( (R_->numRows() != recycledBlocks_+1) || (R_->numCols() != recycledBlocks_+1) )
1282 R_->reshape( recycledBlocks_+1, recycledBlocks_+1 );
1284 R_->putScalar(zero);
1287 if (PP_ == Teuchos::null)
1290 if ( (PP_->numRows() != numBlocks_+recycledBlocks_+2) || (PP_->numCols() != recycledBlocks_+1) )
1291 PP_->reshape( numBlocks_+recycledBlocks_+2, recycledBlocks_+1 );
1295 if (HP_ == Teuchos::null)
1298 if ( (HP_->numRows() != numBlocks_+recycledBlocks_+2) || (HP_->numCols() != numBlocks_+recycledBlocks_+1) )
1299 HP_->reshape( numBlocks_+recycledBlocks_+2, numBlocks_+recycledBlocks_+1 );
1307 template<
class ScalarType,
class MV,
class OP>
1315 if (!isSet_) { setParameters( params_ ); }
1319 std::vector<int> index(numBlocks_+1);
1326 int numRHS2Solve = MVT::GetNumberVecs( *(problem_->getRHS()) );
1327 std::vector<int> currIdx(1);
1331 problem_->setLSIndex( currIdx );
1334 ptrdiff_t dim = MVT::GetGlobalLength( *(problem_->getRHS()) );
1335 if (static_cast<ptrdiff_t>(numBlocks_) > dim) {
1336 numBlocks_ = Teuchos::as<int>(dim);
1338 "Warning! Requested Krylov subspace dimension is larger than operator dimension!" << std::endl <<
1339 " The maximum number of blocks allowed for the Krylov subspace will be adjusted to " << numBlocks_ << std::endl;
1340 params_->set(
"Num Blocks", numBlocks_);
1344 bool isConverged =
true;
1347 initializeStateStorage();
1353 plist.
set(
"Num Blocks",numBlocks_);
1354 plist.
set(
"Recycled Blocks",recycledBlocks_);
1359 RCP<GCRODRIter<ScalarType,MV,OP> > gcrodr_iter;
1362 int prime_iterations = 0;
1366 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1370 while ( numRHS2Solve > 0 ) {
1373 builtRecycleSpace_ =
false;
1376 outputTest_->reset();
1384 "Belos::GCRODRSolMgr::solve(): Requested size of recycled subspace is not consistent with the current recycle subspace.");
1386 printer_->stream(
Debug) <<
" Now solving RHS index " << currIdx[0] <<
" using recycled subspace of dimension " << keff << std::endl << std::endl;
1389 for (
int ii=0; ii<keff; ++ii) { index[ii] = ii; }
1390 RCP<const MV> Utmp = MVT::CloneView( *U_, index );
1391 RCP<MV> Ctmp = MVT::CloneViewNonConst( *C_, index );
1392 problem_->apply( *Utmp, *Ctmp );
1394 RCP<MV> U1tmp = MVT::CloneViewNonConst( *U1_, index );
1399 int rank = ortho_->normalize(*Ctmp,
rcp(&Rtmp,
false));
1412 work_.resize(lwork);
1417 MVT::MvTimesMatAddMv( one, *Utmp, Rtmp, zero, *U1tmp );
1422 for (
int ii=0; ii<keff; ++ii) { index[ii] = ii; }
1423 Ctmp = MVT::CloneViewNonConst( *C_, index );
1424 Utmp = MVT::CloneView( *U_, index );
1428 problem_->computeCurrPrecResVec( &*r_ );
1429 MVT::MvTransMv( one, *Ctmp, *r_, Ctr );
1432 RCP<MV> update = MVT::Clone( *problem_->getCurrLHSVec(), 1 );
1433 MVT::MvInit( *update, 0.0 );
1434 MVT::MvTimesMatAddMv( one, *Utmp, Ctr, one, *update );
1435 problem_->updateSolution( update,
true );
1438 MVT::MvTimesMatAddMv( -one, *Ctmp, Ctr, one, *r_ );
1441 prime_iterations = 0;
1447 printer_->stream(
Debug) <<
" No recycled subspace available for RHS index " << currIdx[0] << std::endl << std::endl;
1452 primeList.
set(
"Num Blocks",numBlocks_);
1453 primeList.
set(
"Recycled Blocks",0);
1456 RCP<GCRODRIter<ScalarType,MV,OP> > gcrodr_prime_iter;
1460 problem_->computeCurrPrecResVec( &*r_ );
1461 index.resize( 1 ); index[0] = 0;
1462 RCP<MV> v0 = MVT::CloneViewNonConst( *V_, index );
1463 MVT::SetBlock(*r_,index,*v0);
1467 index.resize( numBlocks_+1 );
1468 for (
int ii=0; ii<(numBlocks_+1); ++ii) { index[ii] = ii; }
1469 newstate.
V = MVT::CloneViewNonConst( *V_, index );
1470 newstate.
U = Teuchos::null;
1471 newstate.
C = Teuchos::null;
1473 newstate.
B = Teuchos::null;
1475 gcrodr_prime_iter->initialize(newstate);
1478 bool primeConverged =
false;
1480 gcrodr_prime_iter->iterate();
1483 if ( convTest_->getStatus() ==
Passed ) {
1485 primeConverged =
true;
1490 gcrodr_prime_iter->updateLSQR( gcrodr_prime_iter->getCurSubspaceDim() );
1493 sTest_->checkStatus( &*gcrodr_prime_iter );
1494 if (convTest_->getStatus() ==
Passed)
1495 primeConverged =
true;
1499 achievedTol_ = MT::one();
1501 MVT::MvInit( *X, SCT::zero() );
1502 printer_->stream(
Warnings) <<
"Belos::GCRODRSolMgr::solve(): Warning! NaN has been detected!"
1506 catch (
const std::exception &e) {
1507 printer_->stream(
Errors) <<
"Error! Caught exception in GCRODRIter::iterate() at iteration "
1508 << gcrodr_prime_iter->getNumIters() << std::endl
1509 << e.what() << std::endl;
1513 prime_iterations = gcrodr_prime_iter->getNumIters();
1516 RCP<MV> update = gcrodr_prime_iter->getCurrentUpdate();
1517 problem_->updateSolution( update,
true );
1520 newstate = gcrodr_prime_iter->getState();
1528 if (recycledBlocks_ < p+1) {
1532 keff = getHarmonicVecs1( p, *newstate.
H, *PPtmp );
1537 for (
int ii=0; ii<keff; ++ii) { index[ii] = ii; }
1538 RCP<MV> Ctmp = MVT::CloneViewNonConst( *C_, index );
1539 RCP<MV> Utmp = MVT::CloneViewNonConst( *U_, index );
1540 RCP<MV> U1tmp = MVT::CloneViewNonConst( *U1_, index );
1542 for (
int ii=0; ii < p; ++ii) { index[ii] = ii; }
1543 RCP<const MV> Vtmp = MVT::CloneView( *V_, index );
1547 MVT::MvTimesMatAddMv( one, *Vtmp, *PPtmp, zero, *U1tmp );
1564 HPtmp.
stride (), &tau_[0], &work_[0], lwork, &info);
1567 " LAPACK's _GEQRF failed to compute a workspace size.");
1576 work_.resize (lwork);
1578 HPtmp.
stride (), &tau_[0], &work_[0], lwork, &info);
1581 " LAPACK's _GEQRF failed to compute a QR factorization.");
1586 for (
int ii = 0; ii < keff; ++ii) {
1587 for (
int jj = ii; jj < keff; ++jj) {
1588 Rtmp(ii,jj) = HPtmp(ii,jj);
1600 "LAPACK's _UNGQR failed to construct the Q factor.");
1605 index.resize (p + 1);
1606 for (
int ii = 0; ii < (p+1); ++ii) {
1609 Vtmp = MVT::CloneView( *V_, index );
1610 MVT::MvTimesMatAddMv( one, *Vtmp, HPtmp, zero, *Ctmp );
1621 "LAPACK's _GETRF failed to compute an LU factorization.");
1631 work_.resize(lwork);
1635 "LAPACK's _GETRI failed to invert triangular matrix.");
1638 MVT::MvTimesMatAddMv( one, *U1tmp, Rtmp, zero, *Utmp );
1640 printer_->stream(
Debug)
1641 <<
" Generated recycled subspace using RHS index " << currIdx[0]
1642 <<
" of dimension " << keff << std::endl << std::endl;
1647 if (primeConverged) {
1649 problem_->setCurrLS();
1653 if (numRHS2Solve > 0) {
1655 problem_->setLSIndex (currIdx);
1658 currIdx.resize (numRHS2Solve);
1668 gcrodr_iter->setSize( keff, numBlocks_ );
1671 gcrodr_iter->resetNumIters(prime_iterations);
1674 outputTest_->resetNumCalls();
1677 problem_->computeCurrPrecResVec( &*r_ );
1678 index.resize( 1 ); index[0] = 0;
1679 RCP<MV> v0 = MVT::CloneViewNonConst( *V_, index );
1680 MVT::SetBlock(*r_,index,*v0);
1684 index.resize( numBlocks_+1 );
1685 for (
int ii=0; ii<(numBlocks_+1); ++ii) { index[ii] = ii; }
1686 newstate.
V = MVT::CloneViewNonConst( *V_, index );
1687 index.resize( keff );
1688 for (
int ii=0; ii<keff; ++ii) { index[ii] = ii; }
1689 newstate.
C = MVT::CloneViewNonConst( *C_, index );
1690 newstate.
U = MVT::CloneViewNonConst( *U_, index );
1694 gcrodr_iter->initialize(newstate);
1697 int numRestarts = 0;
1702 gcrodr_iter->iterate();
1709 if ( convTest_->getStatus() ==
Passed ) {
1718 else if ( maxIterTest_->getStatus() ==
Passed ) {
1720 isConverged =
false;
1728 else if ( gcrodr_iter->getCurSubspaceDim() == gcrodr_iter->getMaxSubspaceDim() ) {
1733 RCP<MV> update = gcrodr_iter->getCurrentUpdate();
1734 problem_->updateSolution( update,
true );
1736 buildRecycleSpace2(gcrodr_iter);
1738 printer_->stream(
Debug)
1739 <<
" Generated new recycled subspace using RHS index "
1740 << currIdx[0] <<
" of dimension " << keff << std::endl
1744 if (numRestarts >= maxRestarts_) {
1745 isConverged =
false;
1750 printer_->stream(
Debug)
1751 <<
" Performing restart number " << numRestarts <<
" of "
1752 << maxRestarts_ << std::endl << std::endl;
1755 problem_->computeCurrPrecResVec( &*r_ );
1756 index.resize( 1 ); index[0] = 0;
1757 RCP<MV> v00 = MVT::CloneViewNonConst( *V_, index );
1758 MVT::SetBlock(*r_,index,*v00);
1762 index.resize( numBlocks_+1 );
1763 for (
int ii=0; ii<(numBlocks_+1); ++ii) { index[ii] = ii; }
1764 restartState.
V = MVT::CloneViewNonConst( *V_, index );
1765 index.resize( keff );
1766 for (
int ii=0; ii<keff; ++ii) { index[ii] = ii; }
1767 restartState.
U = MVT::CloneViewNonConst( *U_, index );
1768 restartState.
C = MVT::CloneViewNonConst( *C_, index );
1772 gcrodr_iter->initialize(restartState);
1786 true, std::logic_error,
"Belos::GCRODRSolMgr::solve: "
1787 "Invalid return from GCRODRIter::iterate().");
1792 gcrodr_iter->updateLSQR( gcrodr_iter->getCurSubspaceDim() );
1795 sTest_->checkStatus( &*gcrodr_iter );
1796 if (convTest_->getStatus() !=
Passed)
1797 isConverged =
false;
1800 catch (
const std::exception& e) {
1802 <<
"Error! Caught exception in GCRODRIter::iterate() at iteration "
1803 << gcrodr_iter->getNumIters() << std::endl << e.what() << std::endl;
1810 RCP<MV> update = gcrodr_iter->getCurrentUpdate();
1811 problem_->updateSolution( update,
true );
1814 problem_->setCurrLS();
1819 if (!builtRecycleSpace_) {
1820 buildRecycleSpace2(gcrodr_iter);
1821 printer_->stream(
Debug)
1822 <<
" Generated new recycled subspace using RHS index " << currIdx[0]
1823 <<
" of dimension " << keff << std::endl << std::endl;
1828 if (numRHS2Solve > 0) {
1830 problem_->setLSIndex (currIdx);
1833 currIdx.resize (numRHS2Solve);
1841 #ifdef BELOS_TEUCHOS_TIME_MONITOR
1847 #endif // BELOS_TEUCHOS_TIME_MONITOR
1850 numIters_ = maxIterTest_->getNumIters ();
1862 const std::vector<MagnitudeType>* pTestValues = expConvTest_->getTestValue();
1863 if (pTestValues == NULL || pTestValues->size() < 1) {
1864 pTestValues = impConvTest_->getTestValue();
1867 "Belos::GCRODRSolMgr::solve(): The implicit convergence test's getTestValue() "
1868 "method returned NULL. Please report this bug to the Belos developers.");
1870 "Belos::GCRODRSolMgr::solve(): The implicit convergence test's getTestValue() "
1871 "method returned a vector of length zero. Please report this bug to the "
1872 "Belos developers.");
1877 achievedTol_ = *std::max_element (pTestValues->begin(), pTestValues->end());
1884 template<
class ScalarType,
class MV,
class OP>
1890 std::vector<MagnitudeType> d(keff);
1891 std::vector<ScalarType> dscalar(keff);
1892 std::vector<int> index(numBlocks_+1);
1904 for (
int ii=0; ii<keff; ++ii) { index[ii] = ii; }
1907 dscalar.resize(keff);
1908 MVT::MvNorm( *Utmp, d );
1909 for (
int i=0; i<keff; ++i) {
1911 dscalar[i] = (ScalarType)d[i];
1913 MVT::MvScale( *Utmp, dscalar );
1920 for (
int i=0; i<keff; ++i) {
1921 (*H2tmp)(i,i) = d[i];
1929 keff_new = getHarmonicVecs2( keff, p, *H2tmp, oldState.
V, PPtmp );
1938 index.resize( keff );
1939 for (
int ii=0; ii<keff; ++ii) { index[ii] = ii; }
1941 index.resize( keff_new );
1942 for (
int ii=0; ii<keff_new; ++ii) { index[ii] = ii; }
1943 U1tmp = MVT::CloneViewNonConst( *U1_, index );
1945 MVT::MvTimesMatAddMv( one, *Utmp, PPtmp, zero, *U1tmp );
1951 for (
int ii=0; ii < p; ii++) { index[ii] = ii; }
1954 MVT::MvTimesMatAddMv( one, *Vtmp, PPtmp, one, *U1tmp );
1965 int info = 0, lwork = -1;
1966 tau_.resize (keff_new);
1967 lapack.GEQRF (HPtmp.numRows (), HPtmp.numCols (), HPtmp.values (),
1968 HPtmp.stride (), &tau_[0], &work_[0], lwork, &info);
1970 info != 0, GCRODRSolMgrLAPACKFailure,
"Belos::GCRODRSolMgr::solve: "
1971 "LAPACK's _GEQRF failed to compute a workspace size.");
1978 work_.resize (lwork);
1979 lapack.GEQRF (HPtmp.numRows (), HPtmp.numCols (), HPtmp.values (),
1980 HPtmp.stride (), &tau_[0], &work_[0], lwork, &info);
1982 info != 0, GCRODRSolMgrLAPACKFailure,
"Belos::GCRODRSolMgr::solve: "
1983 "LAPACK's _GEQRF failed to compute a QR factorization.");
1988 for(
int i=0;i<keff_new;i++) {
for(
int j=i;j<keff_new;j++) Rtmp(i,j) = HPtmp(i,j); }
1994 lapack.UNGQR (HPtmp.numRows (), HPtmp.numCols (), HPtmp.numCols (),
1995 HPtmp.values (), HPtmp.stride (), &tau_[0], &work_[0],
1998 info != 0, GCRODRSolMgrLAPACKFailure,
"Belos::GCRODRSolMgr::solve: "
1999 "LAPACK's _UNGQR failed to construct the Q factor.");
2009 for (
int i=0; i < keff; i++) { index[i] = i; }
2011 index.resize(keff_new);
2012 for (
int i=0; i < keff_new; i++) { index[i] = i; }
2013 C1tmp = MVT::CloneViewNonConst( *C1_, index );
2015 MVT::MvTimesMatAddMv( one, *Ctmp, PPtmp, zero, *C1tmp );
2019 index.resize( p+1 );
2020 for (
int i=0; i < p+1; ++i) { index[i] = i; }
2023 MVT::MvTimesMatAddMv( one, *Vtmp, PPtmp, one, *C1tmp );
2032 ipiv_.resize(Rtmp.numRows());
2033 lapack.GETRF(Rtmp.numRows(),Rtmp.numCols(),Rtmp.values(),Rtmp.stride(),&ipiv_[0],&info);
2034 TEUCHOS_TEST_FOR_EXCEPTION(info != 0,GCRODRSolMgrLAPACKFailure,
"Belos::GCRODRSolMgr::solve(): LAPACK _GETRF failed to compute an LU factorization.");
2037 lwork = Rtmp.numRows();
2038 work_.resize(lwork);
2039 lapack.GETRI(Rtmp.numRows(),Rtmp.values(),Rtmp.stride(),&ipiv_[0],&work_[0],lwork,&info);
2040 TEUCHOS_TEST_FOR_EXCEPTION(info != 0, GCRODRSolMgrLAPACKFailure,
"Belos::GCRODRSolMgr::solve(): LAPACK _GETRI failed to compute an LU factorization.");
2043 index.resize(keff_new);
2044 for (
int i=0; i < keff_new; i++) { index[i] = i; }
2046 MVT::MvTimesMatAddMv( one, *U1tmp, Rtmp, zero, *Utmp );
2050 if (keff != keff_new) {
2052 gcrodr_iter->setSize( keff, numBlocks_ );
2062 template<
class ScalarType,
class MV,
class OP>
2063 int GCRODRSolMgr<ScalarType,MV,OP,true>::getHarmonicVecs1(
int m,
2067 bool xtraVec =
false;
2071 std::vector<MagnitudeType> wr(m), wi(m);
2077 std::vector<MagnitudeType> w(m);
2080 std::vector<int> iperm(m);
2086 builtRecycleSpace_ =
true;
2092 lapack.GESV(m, 1, HHt.values(), HHt.stride(), &iperm[0], e_m.values(), e_m.stride(), &info);
2093 TEUCHOS_TEST_FOR_EXCEPTION(info != 0, GCRODRSolMgrLAPACKFailure,
"Belos::GCRODRSolMgr::solve(): LAPACK GESV failed to compute a solution.");
2096 ScalarType d = HH(m, m-1) * HH(m, m-1);
2098 for( i=0; i<m; ++i )
2099 harmHH(i, m-1) += d * e_m[i];
2108 std::vector<ScalarType> work(1);
2109 std::vector<MagnitudeType> rwork(2*m);
2112 lapack.GEEV(
'N',
'V', m, harmHH.values(), harmHH.stride(), &wr[0], &wi[0],
2113 vl, ldvl, vr.values(), vr.stride(), &work[0], lwork, &rwork[0], &info);
2116 work.resize( lwork );
2118 lapack.GEEV(
'N',
'V', m, harmHH.values(), harmHH.stride(), &wr[0], &wi[0],
2119 vl, ldvl, vr.values(), vr.stride(), &work[0], lwork, &rwork[0], &info);
2120 TEUCHOS_TEST_FOR_EXCEPTION(info != 0, GCRODRSolMgrLAPACKFailure,
"Belos::GCRODRSolMgr::solve(): LAPACK GEEV failed to compute eigensolutions.");
2123 for( i=0; i<m; ++i )
2127 this->sort(w, m, iperm);
2132 for( i=0; i<recycledBlocks_; ++i ) {
2133 for( j=0; j<m; j++ ) {
2134 PP(j,i) = vr(j,iperm[i]);
2138 if(!scalarTypeIsComplex) {
2141 if (wi[iperm[recycledBlocks_-1]] != 0.0) {
2143 for ( i=0; i<recycledBlocks_; ++i ) {
2144 if (wi[iperm[i]] != 0.0)
2153 if (wi[iperm[recycledBlocks_-1]] > 0.0) {
2154 for( j=0; j<m; ++j ) {
2155 PP(j,recycledBlocks_) = vr(j,iperm[recycledBlocks_-1]+1);
2159 for( j=0; j<m; ++j ) {
2160 PP(j,recycledBlocks_) = vr(j,iperm[recycledBlocks_-1]-1);
2169 return recycledBlocks_+1;
2172 return recycledBlocks_;
2178 template<
class ScalarType,
class MV,
class OP>
2179 int GCRODRSolMgr<ScalarType,MV,OP,true>::getHarmonicVecs2(
int keffloc,
int m,
2185 bool xtraVec =
false;
2188 std::vector<int> index;
2191 std::vector<MagnitudeType> wr(m2), wi(m2);
2194 std::vector<MagnitudeType> w(m2);
2200 std::vector<int> iperm(m2);
2203 builtRecycleSpace_ =
true;
2216 index.resize(keffloc);
2217 for (i=0; i<keffloc; ++i) { index[i] = i; }
2221 MVT::MvTransMv( one, *Ctmp, *Utmp, A11 );
2226 for (i=0; i < m+1; i++) { index[i] = i; }
2228 MVT::MvTransMv( one, *Vp, *Utmp, A21 );
2231 for( i=keffloc; i<keffloc+m; i++ ) {
2245 char balanc=
'P', jobvl=
'N', jobvr=
'V', sense=
'N';
2246 int ld = A.numRows();
2248 int ldvl = ld, ldvr = ld;
2249 int info = 0,ilo = 0,ihi = 0;
2250 MagnitudeType abnrm = 0.0, bbnrm = 0.0;
2252 std::vector<ScalarType> beta(ld);
2253 std::vector<ScalarType> work(lwork);
2254 std::vector<MagnitudeType> rwork(lwork);
2255 std::vector<MagnitudeType> lscale(ld), rscale(ld);
2256 std::vector<MagnitudeType> rconde(ld), rcondv(ld);
2257 std::vector<int> iwork(ld+6);
2262 lapack.GGEVX(balanc, jobvl, jobvr, sense, ld, A.values(), ld, B.values(), ld, &wr[0], &wi[0],
2263 &beta[0], vl, ldvl, vr.values(), ldvr, &ilo, &ihi, &lscale[0], &rscale[0],
2264 &abnrm, &bbnrm, &rconde[0], &rcondv[0], &work[0], lwork, &rwork[0],
2265 &iwork[0], bwork, &info);
2266 TEUCHOS_TEST_FOR_EXCEPTION(info != 0, GCRODRSolMgrLAPACKFailure,
"Belos::GCRODRSolMgr::solve(): LAPACK GGEVX failed to compute eigensolutions.");
2270 for( i=0; i<ld; i++ ) {
2276 this->sort(w,ld,iperm);
2281 for( i=0; i<recycledBlocks_; i++ ) {
2282 for( j=0; j<ld; j++ ) {
2283 PP(j,i) = vr(j,iperm[ld-recycledBlocks_+i]);
2287 if(!scalarTypeIsComplex) {
2290 if (wi[iperm[ld-recycledBlocks_]] != 0.0) {
2292 for ( i=ld-recycledBlocks_; i<ld; i++ ) {
2293 if (wi[iperm[i]] != 0.0)
2302 if (wi[iperm[ld-recycledBlocks_]] > 0.0) {
2303 for( j=0; j<ld; j++ ) {
2304 PP(j,recycledBlocks_) = vr(j,iperm[ld-recycledBlocks_]+1);
2308 for( j=0; j<ld; j++ ) {
2309 PP(j,recycledBlocks_) = vr(j,iperm[ld-recycledBlocks_]-1);
2318 return recycledBlocks_+1;
2321 return recycledBlocks_;
2328 template<
class ScalarType,
class MV,
class OP>
2329 void GCRODRSolMgr<ScalarType,MV,OP,true>::sort(std::vector<MagnitudeType>& dlist,
int n, std::vector<int>& iperm) {
2330 int l, r, j, i, flag;
2332 MagnitudeType dRR, dK;
2359 if (dlist[j] > dlist[j - 1]) j = j + 1;
2361 if (dlist[j - 1] > dK) {
2362 dlist[i - 1] = dlist[j - 1];
2363 iperm[i - 1] = iperm[j - 1];
2377 dlist[r] = dlist[0];
2378 iperm[r] = iperm[0];
2393 template<
class ScalarType,
class MV,
class OP>
2395 std::ostringstream out;
2398 out <<
"Ortho Type: \"" << orthoType_ <<
"\"";
2399 out <<
", Num Blocks: " <<numBlocks_;
2400 out <<
", Num Recycle Blocks: " << recycledBlocks_;
2401 out <<
", Max Restarts: " << maxRestarts_;
ScaleType convertStringToScaleType(const std::string &scaleType)
Convert the given string to its ScaleType enum value.
ScalarType * values() const
Collection of types and exceptions used within the Belos solvers.
Partial specialization for ScalarType types for which Teuchos::LAPACK has a valid implementation...
Belos's basic output manager for sending information of select verbosity levels to the appropriate ou...
GCRODRSolMgrLAPACKFailure(const std::string &what_arg)
Class which manages the output and verbosity of the Belos solvers.
bool is_null(const boost::shared_ptr< T > &p)
ScaleType
The type of scaling to use on the residual norm value.
Exception thrown to signal error in a status test during Belos::StatusTest::checkStatus().
T & get(const std::string &name, T def_value)
GCRODRSolMgrLAPACKFailure is thrown when a nonzero value is retuned from an LAPACK call...
bool is_null(const std::shared_ptr< T > &p)
int multiply(ETransp transa, ETransp transb, ScalarType alpha, const SerialDenseMatrix< OrdinalType, ScalarType > &A, const SerialDenseMatrix< OrdinalType, ScalarType > &B, ScalarType beta)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
A factory class for generating StatusTestOutput objects.
Teuchos::RCP< const Teuchos::ParameterList > getDefaultParameters(const std::string &name) const
Default parameters for the given MatOrthoManager subclass.
An implementation of StatusTestResNorm using a family of residual norms.
GCRODRSolMgrLinearProblemFailure is thrown when the linear problem is not setup (i.e.
GCRODRSolMgrRecyclingFailure(const std::string &what_arg)
This class implements the GCRODR iteration, where a single-std::vector Krylov subspace is constructed...
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
static const double convTol
Default convergence tolerance.
Belos::StatusTest class for specifying a maximum number of iterations.
int curDim
The current dimension of the reduction.
static std::string name()
A factory class for generating StatusTestOutput objects.
std::string validNamesString() const
List (as a string) of recognized MatOrthoManager names.
Traits class which defines basic operations on multivectors.
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.
GCRODRSolMgrOrthoFailure(const std::string &what_arg)
Teuchos::RCP< SolverManager< ScalarType, MV, OP > > clone() const override
clone for Inverted Injection (DII)
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. ...
Teuchos::RCP< MV > V
The current Krylov basis.
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)
bool isValidName(const std::string &name) const
Whether this factory recognizes the MatOrthoManager with the given name.
Teuchos::RCP< MV > U
The recycled subspace and its projection.
std::ostream & printValidNames(std::ostream &out) const
Print all recognized MatOrthoManager names to the given ostream.
A linear system to solve, and its associated information.
GCRODRSolMgrOrthoFailure is thrown when the orthogonalization manager is unable to generate orthonorm...
Class which describes the linear problem to be solved by the iterative solver.
GCRODRIterOrthoFailure is thrown when the GCRODRIter object is unable to compute independent directio...
Implementation of the GCRODR (Recycling GMRES) iterative linear solver.
Type traits class that says whether Teuchos::LAPACK has a valid implementation for the given ScalarTy...
ReturnType
Whether the Belos solve converged for all linear systems.
Belos concrete class for performing the GCRO-DR iteration.
Structure to contain pointers to GCRODRIter state variables.
MagnitudeType achievedTol() const override
Tolerance achieved by the last solve() invocation.
Teuchos::Array< Teuchos::RCP< Teuchos::Time > > getTimers() const
Return the timers for this object.
void reset(const ResetType type) override
Performs a reset of the solver manager specified by the ResetType. This informs the solver manager th...
void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms) override
Set the parameters the solver manager should use to solve the linear problem.
void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem) override
Set the linear problem that needs to be solved.
GCRODRSolMgrRecyclingFailure is thrown when any problem occurs in using/creating the recycling subspa...
static magnitudeType magnitude(T a)
virtual ~GCRODRSolMgr()
Destructor.
OrdinalType numCols() const
GCRODRSolMgrLinearProblemFailure(const std::string &what_arg)
GCRODRSolMgr(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem, const Teuchos::RCP< Teuchos::ParameterList > &pl)
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.
Belos::StatusTestResNorm for specifying general residual norm stopping criteria.
Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const override
Get a parameter list containing the current parameters for this object.
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > B
The projection of the Krylov subspace against the recycled subspace.
bool isType(const std::string &name) const
An implementation of the Belos::MatOrthoManager that performs orthogonalization using (potentially) m...
const LinearProblem< ScalarType, MV, OP > & getProblem() const override
Get current linear problem being solved for in this object.
A class for extending the status testing capabilities of Belos via logical combinations.
int getNumIters() const override
Get the iteration count for the most recent call to solve().
Class which defines basic traits for the operator type.
Teuchos::RCP< Teuchos::SerialDenseMatrix< int, ScalarType > > H
The current Hessenberg matrix.
Parent class to all Belos exceptions.
Base class for Belos::SolverManager subclasses which normally can only compile with ScalarType types ...
Belos header file which uses auto-configuration information to include necessary C++ headers...
bool isLOADetected() const override
Return whether a loss of accuracy was detected by this solver during the most current solve...
OrdinalType stride() const
OrdinalType numRows() const
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.