42 #ifndef BELOS_PCPG_SOLMGR_HPP 43 #define BELOS_PCPG_SOLMGR_HPP 65 #include "Teuchos_BLAS.hpp" 66 #include "Teuchos_LAPACK.hpp" 67 #ifdef BELOS_TEUCHOS_TIME_MONITOR 68 #include "Teuchos_TimeMonitor.hpp" 138 template<
class ScalarType,
class MV,
class OP>
144 typedef Teuchos::ScalarTraits<ScalarType> SCT;
145 typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType MagnitudeType;
146 typedef Teuchos::ScalarTraits<MagnitudeType> MT;
197 const Teuchos::RCP<Teuchos::ParameterList> &pl );
214 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters()
const;
225 Teuchos::Array<Teuchos::RCP<Teuchos::Time> >
getTimers()
const {
226 return Teuchos::tuple(timerSolve_);
256 void setParameters(
const Teuchos::RCP<Teuchos::ParameterList> ¶ms );
297 std::string description()
const;
305 int ARRQR(
int numVecs,
int numOrthVecs,
const Teuchos::SerialDenseMatrix<int,ScalarType>& D);
308 Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > problem_;
311 Teuchos::RCP<OutputManager<ScalarType> > printer_;
312 Teuchos::RCP<std::ostream> outputStream_;
315 Teuchos::RCP<StatusTest<ScalarType,MV,OP> > sTest_;
316 Teuchos::RCP<StatusTestMaxIters<ScalarType,MV,OP> > maxIterTest_;
317 Teuchos::RCP<StatusTestGenResNorm<ScalarType,MV,OP> > convTest_;
318 Teuchos::RCP<StatusTestOutput<ScalarType,MV,OP> > outputTest_;
321 Teuchos::RCP<MatOrthoManager<ScalarType,MV,OP> > ortho_;
324 Teuchos::RCP<Teuchos::ParameterList> params_;
327 static const MagnitudeType convtol_default_;
328 static const MagnitudeType orthoKappa_default_;
329 static const int maxIters_default_;
330 static const int deflatedBlocks_default_;
331 static const int savedBlocks_default_;
332 static const int verbosity_default_;
333 static const int outputStyle_default_;
334 static const int outputFreq_default_;
335 static const std::string label_default_;
336 static const std::string orthoType_default_;
337 static const Teuchos::RCP<std::ostream> outputStream_default_;
344 MagnitudeType convtol_;
347 MagnitudeType orthoKappa_;
350 MagnitudeType achievedTol_;
358 int deflatedBlocks_, savedBlocks_, verbosity_, outputStyle_, outputFreq_;
359 std::string orthoType_;
362 Teuchos::RCP<MV> U_, C_, R_;
369 Teuchos::RCP<Teuchos::Time> timerSolve_;
377 template<
class ScalarType,
class MV,
class OP>
380 template<
class ScalarType,
class MV,
class OP>
383 template<
class ScalarType,
class MV,
class OP>
386 template<
class ScalarType,
class MV,
class OP>
389 template<
class ScalarType,
class MV,
class OP>
392 template<
class ScalarType,
class MV,
class OP>
395 template<
class ScalarType,
class MV,
class OP>
398 template<
class ScalarType,
class MV,
class OP>
401 template<
class ScalarType,
class MV,
class OP>
404 template<
class ScalarType,
class MV,
class OP>
407 template<
class ScalarType,
class MV,
class OP>
412 template<
class ScalarType,
class MV,
class OP>
414 outputStream_(outputStream_default_),
415 convtol_(convtol_default_),
416 orthoKappa_(orthoKappa_default_),
417 achievedTol_(Teuchos::ScalarTraits<MagnitudeType>::zero()),
419 maxIters_(maxIters_default_),
420 deflatedBlocks_(deflatedBlocks_default_),
421 savedBlocks_(savedBlocks_default_),
422 verbosity_(verbosity_default_),
423 outputStyle_(outputStyle_default_),
424 outputFreq_(outputFreq_default_),
425 orthoType_(orthoType_default_),
426 label_(label_default_),
432 template<
class ScalarType,
class MV,
class OP>
435 const Teuchos::RCP<Teuchos::ParameterList> &pl ) :
437 outputStream_(outputStream_default_),
438 convtol_(convtol_default_),
439 orthoKappa_(orthoKappa_default_),
440 achievedTol_(Teuchos::ScalarTraits<MagnitudeType>::zero()),
442 maxIters_(maxIters_default_),
443 deflatedBlocks_(deflatedBlocks_default_),
444 savedBlocks_(savedBlocks_default_),
445 verbosity_(verbosity_default_),
446 outputStyle_(outputStyle_default_),
447 outputFreq_(outputFreq_default_),
448 orthoType_(orthoType_default_),
449 label_(label_default_),
452 TEUCHOS_TEST_FOR_EXCEPTION(problem_ == Teuchos::null, std::invalid_argument,
"Problem not given to solver manager.");
461 template<
class ScalarType,
class MV,
class OP>
465 if (params_ == Teuchos::null) {
473 if (params->isParameter(
"Maximum Iterations")) {
474 maxIters_ = params->get(
"Maximum Iterations",maxIters_default_);
477 params_->set(
"Maximum Iterations", maxIters_);
478 if (maxIterTest_!=Teuchos::null)
479 maxIterTest_->setMaxIters( maxIters_ );
483 if (params->isParameter(
"Num Saved Blocks")) {
484 savedBlocks_ = params->get(
"Num Saved Blocks",savedBlocks_default_);
485 TEUCHOS_TEST_FOR_EXCEPTION(savedBlocks_ <= 0, std::invalid_argument,
486 "Belos::PCPGSolMgr: \"Num Saved Blocks\" must be strictly positive.");
493 params_->set(
"Num Saved Blocks", savedBlocks_);
495 if (params->isParameter(
"Num Deflated Blocks")) {
496 deflatedBlocks_ = params->get(
"Num Deflated Blocks",deflatedBlocks_default_);
497 TEUCHOS_TEST_FOR_EXCEPTION(deflatedBlocks_ < 0, std::invalid_argument,
498 "Belos::PCPGSolMgr: \"Num Deflated Blocks\" must be positive.");
500 TEUCHOS_TEST_FOR_EXCEPTION(deflatedBlocks_ > savedBlocks_, std::invalid_argument,
501 "Belos::PCPGSolMgr: \"Num Deflated Blocks\" must be <= \"Num Saved Blocks\".");
504 params_->set(
"Num Deflated Blocks", deflatedBlocks_);
508 if (params->isParameter(
"Timer Label")) {
509 std::string tempLabel = params->get(
"Timer Label", label_default_);
512 if (tempLabel != label_) {
514 params_->set(
"Timer Label", label_);
515 std::string solveLabel = label_ +
": PCPGSolMgr total solve time";
516 #ifdef BELOS_TEUCHOS_TIME_MONITOR 517 timerSolve_ = Teuchos::TimeMonitor::getNewCounter(solveLabel);
519 if (ortho_ != Teuchos::null) {
520 ortho_->setLabel( label_ );
526 if (params->isParameter(
"Orthogonalization")) {
527 std::string tempOrthoType = params->get(
"Orthogonalization",orthoType_default_);
528 TEUCHOS_TEST_FOR_EXCEPTION( tempOrthoType !=
"DGKS" && tempOrthoType !=
"ICGS" && tempOrthoType !=
"IMGS",
529 std::invalid_argument,
530 "Belos::PCPGSolMgr: \"Orthogonalization\" must be either \"DGKS\", \"ICGS\", or \"IMGS\".");
531 if (tempOrthoType != orthoType_) {
532 orthoType_ = tempOrthoType;
534 if (orthoType_==
"DGKS") {
535 if (orthoKappa_ <= 0) {
543 else if (orthoType_==
"ICGS") {
546 else if (orthoType_==
"IMGS") {
553 if (params->isParameter(
"Orthogonalization Constant")) {
554 orthoKappa_ = params->get(
"Orthogonalization Constant",orthoKappa_default_);
557 params_->set(
"Orthogonalization Constant",orthoKappa_);
558 if (orthoType_==
"DGKS") {
559 if (orthoKappa_ > 0 && ortho_ != Teuchos::null) {
566 if (params->isParameter(
"Verbosity")) {
567 if (Teuchos::isParameterType<int>(*params,
"Verbosity")) {
568 verbosity_ = params->get(
"Verbosity", verbosity_default_);
570 verbosity_ = (int)Teuchos::getParameter<Belos::MsgType>(*params,
"Verbosity");
574 params_->set(
"Verbosity", verbosity_);
575 if (printer_ != Teuchos::null)
576 printer_->setVerbosity(verbosity_);
580 if (params->isParameter(
"Output Style")) {
581 if (Teuchos::isParameterType<int>(*params,
"Output Style")) {
582 outputStyle_ = params->get(
"Output Style", outputStyle_default_);
584 outputStyle_ = (int)Teuchos::getParameter<Belos::OutputType>(*params,
"Output Style");
588 params_->set(
"Output Style", outputStyle_);
589 outputTest_ = Teuchos::null;
593 if (params->isParameter(
"Output Stream")) {
594 outputStream_ = Teuchos::getParameter<Teuchos::RCP<std::ostream> >(*params,
"Output Stream");
597 params_->set(
"Output Stream", outputStream_);
598 if (printer_ != Teuchos::null)
599 printer_->setOStream( outputStream_ );
604 if (params->isParameter(
"Output Frequency")) {
605 outputFreq_ = params->get(
"Output Frequency", outputFreq_default_);
609 params_->set(
"Output Frequency", outputFreq_);
610 if (outputTest_ != Teuchos::null)
611 outputTest_->setOutputFrequency( outputFreq_ );
615 if (printer_ == Teuchos::null) {
624 if (params->isParameter(
"Convergence Tolerance")) {
625 convtol_ = params->get(
"Convergence Tolerance",convtol_default_);
628 params_->set(
"Convergence Tolerance", convtol_);
629 if (convTest_ != Teuchos::null)
630 convTest_->setTolerance( convtol_ );
636 if (maxIterTest_ == Teuchos::null)
639 if (convTest_ == Teuchos::null)
640 convTest_ = Teuchos::rcp(
new StatusTestResNorm_t( convtol_, 1 ) );
642 sTest_ = Teuchos::rcp(
new StatusTestCombo_t( StatusTestCombo_t::OR, maxIterTest_, convTest_ ) );
650 std::string solverDesc =
" PCPG ";
651 outputTest_->setSolverDesc( solverDesc );
655 if (ortho_ == Teuchos::null) {
656 if (orthoType_==
"DGKS") {
657 if (orthoKappa_ <= 0) {
665 else if (orthoType_==
"ICGS") {
668 else if (orthoType_==
"IMGS") {
672 TEUCHOS_TEST_FOR_EXCEPTION(orthoType_!=
"ICGS"&&orthoType_!=
"DGKS"&&orthoType_!=
"IMGS",std::logic_error,
673 "Belos::PCPGSolMgr(): Invalid orthogonalization type.");
678 if (timerSolve_ == Teuchos::null) {
679 std::string solveLabel = label_ +
": PCPGSolMgr total solve time";
680 #ifdef BELOS_TEUCHOS_TIME_MONITOR 681 timerSolve_ = Teuchos::TimeMonitor::getNewCounter(solveLabel);
690 template<
class ScalarType,
class MV,
class OP>
691 Teuchos::RCP<const Teuchos::ParameterList>
694 static Teuchos::RCP<const Teuchos::ParameterList> validPL;
695 if (is_null(validPL)) {
696 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
698 pl->set(
"Convergence Tolerance", convtol_default_,
699 "The relative residual tolerance that needs to be achieved by the\n" 700 "iterative solver in order for the linear system to be declared converged.");
701 pl->set(
"Maximum Iterations", maxIters_default_,
702 "The maximum number of iterations allowed for each\n" 703 "set of RHS solved.");
704 pl->set(
"Num Deflated Blocks", deflatedBlocks_default_,
705 "The maximum number of vectors in the seed subspace." );
706 pl->set(
"Num Saved Blocks", savedBlocks_default_,
707 "The maximum number of vectors saved from old Krylov subspaces." );
708 pl->set(
"Verbosity", verbosity_default_,
709 "What type(s) of solver information should be outputted\n" 710 "to the output stream.");
711 pl->set(
"Output Style", outputStyle_default_,
712 "What style is used for the solver information outputted\n" 713 "to the output stream.");
714 pl->set(
"Output Frequency", outputFreq_default_,
715 "How often convergence information should be outputted\n" 716 "to the output stream.");
717 pl->set(
"Output Stream", outputStream_default_,
718 "A reference-counted pointer to the output stream where all\n" 719 "solver output is sent.");
720 pl->set(
"Timer Label", label_default_,
721 "The string to use as a prefix for the timer labels.");
723 pl->set(
"Orthogonalization", orthoType_default_,
724 "The type of orthogonalization to use: DGKS, ICGS, IMGS");
725 pl->set(
"Orthogonalization Constant",orthoKappa_default_,
726 "The constant used by DGKS orthogonalization to determine\n" 727 "whether another step of classical Gram-Schmidt is necessary.");
735 template<
class ScalarType,
class MV,
class OP>
741 Teuchos::BLAS<int,ScalarType> blas;
742 Teuchos::LAPACK<int,ScalarType> lapack;
743 ScalarType one = Teuchos::ScalarTraits<ScalarType>::one();
744 ScalarType zero = Teuchos::ScalarTraits<ScalarType>::zero();
747 "Belos::PCPGSolMgr::solve(): Linear problem is not a valid object.");
750 "Belos::PCPGSolMgr::solve(): Linear problem is not ready, setProblem() has not been called.");
754 std::vector<int> currIdx(1);
760 problem_->setLSIndex( currIdx );
763 bool isConverged =
true;
767 Teuchos::ParameterList plist;
768 plist.set(
"Saved Blocks", savedBlocks_);
769 plist.set(
"Block Size", 1);
770 plist.set(
"Keep Diagonal",
true);
771 plist.set(
"Initialize Diagonal",
true);
776 Teuchos::RCP<PCPGIter<ScalarType,MV,OP> > pcpg_iter;
782 #ifdef BELOS_TEUCHOS_TIME_MONITOR 783 Teuchos::TimeMonitor slvtimer(*timerSolve_);
785 while ( numRHS2Solve > 0 ) {
788 outputTest_->reset();
791 if (R_ == Teuchos::null)
794 problem_->computeCurrResVec( &*R_ );
800 if( U_ != Teuchos::null ){
805 Teuchos::RCP<MV> cur_soln_vec = problem_->getCurrLHSVec();
806 std::vector<MagnitudeType> rnorm0(1);
810 std::cout <<
"Solver Manager: dimU_ = " << dimU_ << std::endl;
811 Teuchos::SerialDenseMatrix<int,ScalarType> Z( dimU_, 1 );
813 Teuchos::RCP<const MV> Uactive, Cactive;
814 std::vector<int> active_columns( dimU_ );
815 for (
int i=0; i < dimU_; ++i) active_columns[i] = i;
820 std::cout <<
" Solver Manager : check duality of seed basis " << std::endl;
821 Teuchos::SerialDenseMatrix<int,ScalarType> H( dimU_, dimU_ );
823 H.print( std::cout );
827 Teuchos::RCP<MV> tempU =
MVT::Clone( *R_, 1 );
829 MVT::MvAddMv( one, *tempU, one, *cur_soln_vec, *cur_soln_vec );
832 std::vector<MagnitudeType> rnorm(1);
834 if( rnorm[0] < rnorm0[0] * .001 ){
837 MVT::MvAddMv( one, *tempU, one, *cur_soln_vec, *cur_soln_vec );
841 Uactive = Teuchos::null;
842 Cactive = Teuchos::null;
843 tempU = Teuchos::null;
854 if( U_ != Teuchos::null ) pcpgState.
U = U_;
855 if( C_ != Teuchos::null ) pcpgState.
C = C_;
856 if( dimU_ > 0 ) pcpgState.
curDim = dimU_;
857 pcpg_iter->initialize(pcpgState);
863 if( !dimU_ ) printer_->stream(
Debug) <<
" No recycled subspace available for RHS index " << currIdx[0] << std::endl << std::endl;
864 pcpg_iter->resetNumIters();
866 if( dimU_ > savedBlocks_ )
867 std::cout <<
"Error: dimU_ = " << dimU_ <<
" > savedBlocks_ = " << savedBlocks_ << std::endl;
873 if( debug ) printf(
"********** Calling iterate...\n");
874 pcpg_iter->iterate();
881 if ( convTest_->getStatus() ==
Passed ) {
890 else if ( maxIterTest_->getStatus() ==
Passed ) {
904 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::logic_error,
905 "Belos::PCPGSolMgr::solve(): Invalid return from PCPGIter::iterate().");
911 sTest_->checkStatus( &*pcpg_iter );
912 if (convTest_->getStatus() !=
Passed)
916 catch (
const std::exception &e) {
917 printer_->stream(
Errors) <<
"Error! Caught exception in PCPGIter::iterate() at iteration " 918 << pcpg_iter->getNumIters() << std::endl
919 << e.what() << std::endl;
925 Teuchos::RCP<MV> update = pcpg_iter->getCurrentUpdate();
926 problem_->updateSolution( update,
true );
929 problem_->setCurrLS();
937 std::cout <<
"SolverManager: dimU_ " << dimU_ <<
" prevUdim= " << q << std::endl;
939 if( q > deflatedBlocks_ )
940 std::cout <<
"SolverManager: Error deflatedBlocks = " << deflatedBlocks_ << std::endl;
951 rank = ARRQR(dimU_,q, *oldState.
D );
953 std::cout <<
" rank decreased in ARRQR, something to do? " << std::endl;
959 if( dimU_ > deflatedBlocks_ ){
961 if( !deflatedBlocks_ ){
964 dimU_ = deflatedBlocks_;
968 bool Harmonic =
false;
970 Teuchos::RCP<MV> Uorth;
972 std::vector<int> active_cols( dimU_ );
973 for (
int i=0; i < dimU_; ++i) active_cols[i] = i;
983 Teuchos::SerialDenseMatrix<int,ScalarType> R(dimU_,dimU_);
984 rank = ortho_->normalize(*Uorth, Teuchos::rcp(&R,
false));
985 Uorth = Teuchos::null;
991 "Belos::PCPGSolMgr::solve(): Failed to compute orthonormal basis for initial recycled subspace.");
995 Teuchos::SerialDenseMatrix<int,ScalarType> VT;
996 Teuchos::SerialDenseMatrix<int,ScalarType> Ur;
1000 if( problem_->isHermitian() ) lrwork = dimU_;
1001 std::vector<ScalarType> work(lwork);
1002 std::vector<ScalarType> Svec(dimU_);
1003 std::vector<ScalarType> rwork(lrwork);
1004 lapack.GESVD(
'N',
'O',
1005 R.numRows(),R.numCols(),R.values(), R.numRows(),
1013 "Belos::PCPGSolMgr::solve(): LAPACK _GESVD failed to compute singular values.");
1015 if( work[0] != 67. * dimU_ )
1016 std::cout <<
" SVD " << dimU_ <<
" lwork " << work[0] << std::endl;
1017 for(
int i=0; i< dimU_; i++)
1018 std::cout << i <<
" " << Svec[i] << std::endl;
1020 Teuchos::SerialDenseMatrix<int,ScalarType> wholeV( R,
Teuchos::TRANS);
1022 int startRow = 0, startCol = 0;
1024 startCol = dimU_ - deflatedBlocks_;
1026 Teuchos::SerialDenseMatrix<int,ScalarType> V(Teuchos::Copy,
1032 std::vector<int> active_columns( dimU_ );
1033 std::vector<int> def_cols( deflatedBlocks_ );
1034 for (
int i=0; i < dimU_; ++i) active_columns[i] = i;
1035 for (
int i=0; i < deflatedBlocks_; ++i) def_cols[i] = i;
1040 Ucopy = Teuchos::null;
1041 Uactive = Teuchos::null;
1045 Ccopy = Teuchos::null;
1046 Cactive = Teuchos::null;
1047 dimU_ = deflatedBlocks_;
1049 printer_->stream(
Debug) <<
" Generated recycled subspace using RHS index " << currIdx[0] <<
" of dimension " << dimU_ << std::endl << std::endl;
1052 problem_->setCurrLS();
1056 if ( numRHS2Solve > 0 ) {
1060 problem_->setLSIndex( currIdx );
1063 currIdx.resize( numRHS2Solve );
1072 #ifdef BELOS_TEUCHOS_TIME_MONITOR 1077 Teuchos::TimeMonitor::summarize( printer_->stream(TimingDetails) );
1082 using Teuchos::rcp_dynamic_cast;
1085 const std::vector<MagnitudeType>* pTestValues =
1086 rcp_dynamic_cast<conv_test_type>(convTest_)->getTestValue();
1088 TEUCHOS_TEST_FOR_EXCEPTION(pTestValues == NULL, std::logic_error,
1089 "Belos::PCPGSolMgr::solve(): The convergence test's getTestValue() " 1090 "method returned NULL. Please report this bug to the Belos developers.");
1092 TEUCHOS_TEST_FOR_EXCEPTION(pTestValues->size() < 1, std::logic_error,
1093 "Belos::PCPGSolMgr::solve(): The convergence test's getTestValue() " 1094 "method returned a vector of length zero. Please report this bug to the " 1095 "Belos developers.");
1100 achievedTol_ = *std::max_element (pTestValues->begin(), pTestValues->end());
1104 numIters_ = maxIterTest_->getNumIters();
1115 template<
class ScalarType,
class MV,
class OP>
1119 ScalarType one = Teuchos::ScalarTraits<ScalarType>::one();
1120 ScalarType zero = Teuchos::ScalarTraits<ScalarType>::zero();
1123 Teuchos::SerialDenseMatrix<int,ScalarType> alpha( 1, 1 );
1124 Teuchos::SerialDenseMatrix<int,ScalarType> gamma( 1, 1 );
1125 Teuchos::SerialDenseMatrix<int,ScalarType> anorm( 1, 1 );
1126 std::vector<int> curind(1);
1127 std::vector<int> ipiv(p - q);
1128 std::vector<ScalarType> Pivots(p);
1129 int i, imax, j, k, l;
1130 ScalarType rteps = 1.5e-8;
1133 for(
int i = q ; i < p ; i++ ){
1138 anorm(0,0) = one / Teuchos::ScalarTraits<ScalarType>::squareroot( D(i-q,i-q) ) ;
1144 for( i = q ; i < p ; i++ ){
1145 if( q < i && i < p-1 ){
1148 for( j = i+1 ; j < p ; j++ ){
1150 if( Pivots[k] > Pivots[l] ){
1157 ipiv[imax-q] = ipiv[i-q];
1163 if( Pivots[k] > 1.5625e-2 ){
1164 anorm(0,0) = Pivots[k];
1171 anorm(0,0) = Teuchos::ScalarTraits<ScalarType>::squareroot( anorm(0,0) ) ;
1173 if( rteps <= anorm(0,0) && anorm(0,0) < 9.765625e-4){
1181 std::cout <<
"ARRQR: Bad case not implemented" << std::endl;
1183 if( anorm(0,0) < rteps ){
1184 std::cout <<
"ARRQR : deficient case not implemented " << std::endl;
1201 for( j = i+1 ; j < p ; j++ ){
1211 gamma(0,0) = ( Pivots[l] - alpha(0,0))*( Pivots[l] + alpha(0,0));
1212 if( gamma(0,0) > 0){
1213 Pivots[l] = Teuchos::ScalarTraits<ScalarType>::squareroot( gamma(0,0) );
1224 template<
class ScalarType,
class MV,
class OP>
1227 std::ostringstream oss;
1228 oss <<
"Belos::PCPGSolMgr<...,"<<Teuchos::ScalarTraits<ScalarType>::name()<<
">";
1230 oss <<
"Ortho Type='"<<orthoType_;
Collection of types and exceptions used within the Belos solvers.
Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const
Get a parameter list containing the current parameters for this object.
int prevUdim
Number of block columns in matrices C and U before current iteration.
virtual ~PCPGSolMgr()
Destructor.
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.
ReturnType solve()
The method either solves the problem or decides to quit. On each call, a (possibly null) seed space i...
Belos concrete class to iterate Preconditioned Conjugate Projected Gradients.
PCPGSolMgrOrthoFailure is thrown when the orthogonalization manager is unable to generate orthonormal...
Teuchos::RCP< MV > R
The current residual.
Teuchos::RCP< MV > C
C = AU, U spans recycled subspace.
PCPGSolMgrRecyclingFailure is thrown when any problem occurs in using/creating the recycling subspace...
A factory class for generating StatusTestOutput objects.
static Teuchos::RCP< const MV > CloneView(const MV &mv, const std::vector< int > &index)
Creates a new const MV that shares the selected contents of mv (shallow copy).
int curDim
The current dimension of the reduction.
An implementation of StatusTestResNorm using a family of residual norms.
PCPGSolMgrOrthoFailure(const std::string &what_arg)
Structure to contain pointers to PCPGIter state variables.
PCPGSolMgrLinearProblemFailure is thrown when the linear problem is not setup (i.e.
const LinearProblem< ScalarType, MV, OP > & getProblem() const
Get current linear problem being solved for in this object.
Belos::StatusTest class for specifying a maximum number of iterations.
static void MvTransMv(const ScalarType alpha, const MV &A, const MV &mv, Teuchos::SerialDenseMatrix< int, ScalarType > &B)
Compute a dense matrix B through the matrix-matrix multiply .
static int GetNumberVecs(const MV &mv)
Obtain the number of vectors in mv.
A factory class for generating StatusTestOutput objects.
Iterated Modified Gram-Schmidt (IMGS) implementation of the Belos::OrthoManager class.
static void MvAddMv(const ScalarType alpha, const MV &A, const ScalarType beta, const MV &B, MV &mv)
Replace mv with .
std::string description() const
Method to return description of the PCPG solver manager.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Get a parameter list containing the valid parameters for this object.
Traits class which defines basic operations on multivectors.
Belos::StatusTest for logically combining several status tests.
Teuchos::RCP< const Teuchos::SerialDenseMatrix< int, ScalarType > > D
The current Hessenberg matrix.
void reset(const ResetType type)
Performs a reset of the solver manager specified by the ResetType. This informs the solver manager th...
Classical Gram-Schmidt (with DGKS correction) implementation of the Belos::OrthoManager class...
int getNumIters() const
Get the iteration count for the most recent call to solve().
void setParameters(const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Set the parameters the solver manager should use to solve the linear problem.
A Belos::StatusTest class for specifying a maximum number of iterations.
static Teuchos::RCP< MV > CloneViewNonConst(MV &mv, const std::vector< int > &index)
Creates a new MV that shares the selected contents of mv (shallow copy).
static Teuchos::RCP< MV > Clone(const MV &mv, const int numvecs)
Creates a new empty MV containing numvecs columns.
ResetType
How to reset the solver.
Pure virtual base class which describes the basic interface for a solver manager. ...
MagnitudeType achievedTol() const
Tolerance achieved by the last solve() invocation.
A linear system to solve, and its associated information.
Class which describes the linear problem to be solved by the iterative solver.
PCPGSolMgrLAPACKFailure is thrown when a nonzero value is retuned from an LAPACK call.
PCPGSolMgrLAPACKFailure(const std::string &what_arg)
PCPGSolMgr()
Empty constructor for PCPGSolMgr. This constructor takes no arguments and sets the default values for...
static Teuchos::RCP< MV > CloneCopy(const MV &mv)
Creates a new MV and copies contents of mv into the new vector (deep copy).
ReturnType
Whether the Belos solve converged for all linear systems.
static void MvTimesMatAddMv(const ScalarType alpha, const MV &A, const Teuchos::SerialDenseMatrix< int, ScalarType > &B, const ScalarType beta, MV &mv)
Update mv with .
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
Iterated Classical Gram-Schmidt (ICGS) implementation of the Belos::OrthoManager class.
An implementation of the Belos::MatOrthoManager that performs orthogonalization using multiple steps ...
Teuchos::RCP< MV > U
The recycled subspace.
An implementation of the Belos::MatOrthoManager that performs orthogonalization using multiple steps ...
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.
PCPGIterOrthoFailure is thrown when the PCPGIter object is unable to compute independent direction ve...
Belos::StatusTestResNorm for specifying general residual norm stopping criteria.
void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem)
Set the linear problem that needs to be solved.
The Belos::PCPGSolMgr manages the PCPG linear solver. Three Hypotheses: First users must ensure that ...
An implementation of the Belos::MatOrthoManager that performs orthogonalization using (potentially) m...
A class for extending the status testing capabilities of Belos via logical combinations.
static void MvNorm(const MV &mv, std::vector< typename Teuchos::ScalarTraits< ScalarType >::magnitudeType > &normvec, NormType type=TwoNorm)
Compute the 2-norm of each individual vector of mv. Upon return, normvec[i] holds the value of ...
Class which defines basic traits for the operator type.
Teuchos::Array< Teuchos::RCP< Teuchos::Time > > getTimers() const
Return the timers for this object.
Parent class to all Belos exceptions.
bool isLOADetected() const
Return whether a loss of accuracy was detected by this solver during the most current solve...
PCPGSolMgrRecyclingFailure(const std::string &what_arg)
This class implements the PCPG iteration, where a single-std::vector Krylov subspace is constructed...
Belos header file which uses auto-configuration information to include necessary C++ headers...
PCPGSolMgrLinearProblemFailure(const std::string &what_arg)