Belos Package Browser (Single Doxygen Collection) Development
Loading...
Searching...
No Matches
BelosGmresPolySolMgr.hpp
Go to the documentation of this file.
1//@HEADER
2// ************************************************************************
3//
4// Belos: Block Linear Solvers Package
5// Copyright 2004 Sandia Corporation
6//
7// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8// the U.S. Government retains certain rights in this software.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38//
39// ************************************************************************
40//@HEADER
41//
42
43#ifndef BELOS_GMRES_POLY_SOLMGR_HPP
44#define BELOS_GMRES_POLY_SOLMGR_HPP
45
49
50#include "BelosConfigDefs.hpp"
51#include "BelosTypes.hpp"
52
55#include "BelosGmresPolyOp.hpp"
58#include "Teuchos_as.hpp"
59#ifdef BELOS_TEUCHOS_TIME_MONITOR
60#include "Teuchos_TimeMonitor.hpp"
61#endif
62
63
64namespace Belos {
65
67
68
76 GmresPolySolMgrLinearProblemFailure(const std::string& what_arg) : BelosError(what_arg)
77 {}};
78
86 GmresPolySolMgrPolynomialFailure(const std::string& what_arg) : BelosError(what_arg)
87 {}};
88
103//
138//
150
151template<class ScalarType, class MV, class OP>
152class GmresPolySolMgr : public SolverManager<ScalarType,MV,OP> {
153private:
154
155 typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType MagnitudeType;
156
157 typedef Teuchos::ScalarTraits<MagnitudeType> MTS;
160
161public:
162
164
165
172
191 GmresPolySolMgr( const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem,
192 const Teuchos::RCP<Teuchos::ParameterList> &pl );
193
195 virtual ~GmresPolySolMgr() {};
196
198 Teuchos::RCP<SolverManager<ScalarType, MV, OP> > clone () const override {
199 return Teuchos::rcp(new GmresPolySolMgr<ScalarType,MV,OP>);
200 }
202
204
205
209 return *problem_;
210 }
211
214 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const override;
215
218 Teuchos::RCP<const Teuchos::ParameterList> getCurrentParameters() const override { return params_; }
219
236 MagnitudeType achievedTol() const override {
237 return achievedTol_;
238 }
239
245 Teuchos::Array<Teuchos::RCP<Teuchos::Time> > getTimers() const {
246 return Teuchos::tuple(timerPoly_);
247 }
248
250 int getNumIters() const override {
251 return numIters_;
252 }
253
257 bool isLOADetected() const override { return loaDetected_; }
258
260
262
263
265 void setProblem( const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem ) override { problem_ = problem; }
266
268 void setParameters( const Teuchos::RCP<Teuchos::ParameterList> &params ) override;
269
271
273
282 void reset( const ResetType type ) override {
283 if ((type & Belos::Problem) && ! problem_.is_null ()) {
284 problem_->setProblem ();
285 poly_Op_ = Teuchos::null;
286 poly_dim_ = 0; // Rebuild the GMRES polynomial
287 }
288 }
289
291
293
311 ReturnType solve() override;
312
314
317
319 std::string description() const override;
320
322
323private:
324
325 // Linear problem.
326 Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > problem_;
327
328 // Output manager.
329 Teuchos::RCP<std::ostream> outputStream_;
330
331 // Current parameter list.
332 Teuchos::RCP<Teuchos::ParameterList> params_;
333 Teuchos::RCP<Teuchos::ParameterList> outerParams_;
334
335 // Default solver values.
336 static constexpr int maxDegree_default_ = 25;
337 static constexpr int verbosity_default_ = Belos::Errors;
338 static constexpr const char * label_default_ = "Belos";
339 static constexpr const char * outerSolverType_default_ = "";
340 static constexpr const char * polyType_default_ = "Arnoldi";
341 static constexpr const char * orthoType_default_ = "ICGS";
342 static constexpr bool addRoots_default_ = true;
343 static constexpr bool dampPoly_default_ = false;
344 static constexpr bool randomRHS_default_ = true;
345
346 // Current solver values.
352 bool damp_;
354 std::string polyType_;
355 std::string outerSolverType_;
356 std::string orthoType_;
357
358 // Polynomial storage
360 Teuchos::RCP<gmres_poly_t> poly_Op_;
361
362 // Timers.
363 std::string label_;
364 Teuchos::RCP<Teuchos::Time> timerPoly_;
365
366 // Internal state variables.
367 bool isSet_;
369
371 mutable Teuchos::RCP<const Teuchos::ParameterList> validPL_;
372};
373
374
375template<class ScalarType, class MV, class OP>
377 outputStream_ (Teuchos::rcpFromRef(std::cout)),
378 polyTol_ (DefaultSolverParameters::polyTol),
379 achievedTol_(MTS::zero()),
380 maxDegree_ (maxDegree_default_),
381 numIters_ (0),
382 verbosity_ (verbosity_default_),
383 hasOuterSolver_ (false),
384 randomRHS_ (randomRHS_default_),
385 damp_ (dampPoly_default_),
386 addRoots_ (addRoots_default_),
387 polyType_ (polyType_default_),
388 outerSolverType_ (outerSolverType_default_),
389 orthoType_ (orthoType_default_),
390 poly_dim_ (0),
391 label_ (label_default_),
392 isSet_ (false),
393 loaDetected_ (false)
394{}
395
396
397template<class ScalarType, class MV, class OP>
399GmresPolySolMgr (const Teuchos::RCP<LinearProblem<ScalarType,MV,OP> > &problem,
400 const Teuchos::RCP<Teuchos::ParameterList> &pl) :
401 problem_ (problem),
402 outputStream_ (Teuchos::rcpFromRef(std::cout)),
403 polyTol_ (DefaultSolverParameters::polyTol),
404 maxDegree_ (maxDegree_default_),
405 numIters_ (0),
406 verbosity_ (verbosity_default_),
407 hasOuterSolver_ (false),
408 randomRHS_ (randomRHS_default_),
409 damp_ (dampPoly_default_),
410 addRoots_ (addRoots_default_),
411 polyType_ (polyType_default_),
412 outerSolverType_ (outerSolverType_default_),
413 orthoType_ (orthoType_default_),
414 poly_dim_ (0),
415 label_ (label_default_),
416 isSet_ (false),
417 loaDetected_ (false)
418{
419 TEUCHOS_TEST_FOR_EXCEPTION(
420 problem_.is_null (), std::invalid_argument,
421 "Belos::GmresPolySolMgr: The given linear problem is null. "
422 "Please call this constructor with a nonnull LinearProblem argument, "
423 "or call the constructor that does not take a LinearProblem.");
424
425 // If the input parameter list is null, then the parameters take
426 // default values.
427 if (! pl.is_null ()) {
428 setParameters (pl);
429 }
430}
431
432
433template<class ScalarType, class MV, class OP>
434Teuchos::RCP<const Teuchos::ParameterList>
436{
437 if (validPL_.is_null ()) {
438 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList ();
439
440 // The static_cast is to resolve an issue with older clang versions which
441 // would cause the constexpr to link fail. With c++17 the problem is resolved.
442 pl->set("Polynomial Type", static_cast<const char *>(polyType_default_),
443 "The type of GMRES polynomial that is used as a preconditioner: Roots, Arnoldi, or Gmres.");
444 pl->set("Polynomial Tolerance", static_cast<MagnitudeType>(DefaultSolverParameters::polyTol),
445 "The relative residual tolerance that used to construct the GMRES polynomial.");
446 pl->set("Maximum Degree", static_cast<int>(maxDegree_default_),
447 "The maximum degree allowed for any GMRES polynomial.");
448 pl->set("Outer Solver", static_cast<const char *>(outerSolverType_default_),
449 "The outer solver that this polynomial is used to precondition.");
450 pl->set("Outer Solver Params", Teuchos::ParameterList(),
451 "Parameter list for the outer solver.");
452 pl->set("Verbosity", static_cast<int>(verbosity_default_),
453 "What type(s) of solver information should be outputted\n"
454 "to the output stream.");
455 pl->set("Output Stream", Teuchos::rcpFromRef(std::cout),
456 "A reference-counted pointer to the output stream where all\n"
457 "solver output is sent.");
458 pl->set("Timer Label", static_cast<const char *>(label_default_),
459 "The string to use as a prefix for the timer labels.");
460 pl->set("Orthogonalization", static_cast<const char *>(orthoType_default_),
461 "The type of orthogonalization to use to generate polynomial: DGKS, ICGS, or IMGS.");
462 pl->set("Random RHS", static_cast<bool>(randomRHS_default_),
463 "Add roots to polynomial for stability.");
464 pl->set("Add Roots", static_cast<bool>(addRoots_default_),
465 "Add roots to polynomial for stability.");
466 pl->set("Damp Poly", static_cast<bool>(dampPoly_default_),
467 "Damp polynomial for ill-conditioned problems.");
468 validPL_ = pl;
469 }
470 return validPL_;
471}
472
473
474template<class ScalarType, class MV, class OP>
476setParameters (const Teuchos::RCP<Teuchos::ParameterList>& params)
477{
478 // Create the internal parameter list if ones doesn't already exist.
479 if (params_.is_null ()) {
480 params_ = Teuchos::parameterList (*getValidParameters ());
481 }
482 else {
483 params->validateParameters (*getValidParameters (),0);
484 }
485
486 // Check which Gmres polynomial to use
487 if (params->isParameter("Polynomial Type")) {
488 polyType_ = params->get("Polynomial Type", polyType_default_);
489 }
490
491 // Update the outer solver in our list.
492 params_->set("Polynomial Type", polyType_);
493
494 // Check if there is an outer solver for this Gmres Polynomial
495 if (params->isParameter("Outer Solver")) {
496 outerSolverType_ = params->get("Outer Solver", outerSolverType_default_);
497 }
498
499 // Update the outer solver in our list.
500 params_->set("Outer Solver", outerSolverType_);
501
502 // Check if there is a parameter list for the outer solver
503 if (params->isSublist("Outer Solver Params")) {
504 outerParams_ = Teuchos::parameterList( params->get<Teuchos::ParameterList>("Outer Solver Params") );
505 }
506
507 // Check for maximum polynomial degree
508 if (params->isParameter("Maximum Degree")) {
509 maxDegree_ = params->get("Maximum Degree",maxDegree_default_);
510 }
511
512 // Update parameter in our list.
513 params_->set("Maximum Degree", maxDegree_);
514
515 // Check to see if the timer label changed.
516 if (params->isParameter("Timer Label")) {
517 std::string tempLabel = params->get("Timer Label", label_default_);
518
519 // Update parameter in our list and solver timer
520 if (tempLabel != label_) {
521 label_ = tempLabel;
522#ifdef BELOS_TEUCHOS_TIME_MONITOR
523 std::string polyLabel = label_ + ": GmresPolyOp creation time";
524 timerPoly_ = Teuchos::TimeMonitor::getNewCounter(polyLabel);
525#endif
526 }
527 }
528
529 // Update timer label
530 params_->set("Timer Label", label_);
531
532 // Check if the orthogonalization changed.
533 if (params->isParameter("Orthogonalization")) {
534 std::string tempOrthoType = params->get("Orthogonalization",orthoType_default_);
536 // Ensure that the specified orthogonalization type is valid.
537 if (! factory.isValidName (tempOrthoType)) {
538 std::ostringstream os;
539 os << "Belos::GCRODRSolMgr: Invalid orthogonalization name \""
540 << tempOrthoType << "\". The following are valid options "
541 << "for the \"Orthogonalization\" name parameter: ";
542 factory.printValidNames (os);
543 throw std::invalid_argument (os.str());
544 }
545 if (tempOrthoType != orthoType_) {
546 orthoType_ = tempOrthoType;
547 }
548 }
549
550 params_->set("Orthogonalization", orthoType_);
551
552 // Check for a change in verbosity level
553 if (params->isParameter("Verbosity")) {
554 if (Teuchos::isParameterType<int>(*params,"Verbosity")) {
555 verbosity_ = params->get("Verbosity", verbosity_default_);
556 } else {
557 verbosity_ = (int)Teuchos::getParameter<Belos::MsgType>(*params,"Verbosity");
558 }
559 }
560
561 // Update parameter in our list.
562 params_->set("Verbosity", verbosity_);
563
564 // output stream
565 if (params->isParameter("Output Stream")) {
566 outputStream_ = Teuchos::getParameter<Teuchos::RCP<std::ostream> >(*params,"Output Stream");
567 }
568
569 // Update parameter in our list.
570 params_->set("Output Stream", outputStream_);
571
572 // Convergence
573 // Check for polynomial convergence tolerance
574 if (params->isParameter("Polynomial Tolerance")) {
575 if (params->isType<MagnitudeType> ("Polynomial Tolerance")) {
576 polyTol_ = params->get ("Polynomial Tolerance",
578 }
579 else {
580 polyTol_ = params->get ("Polynomial Tolerance", DefaultSolverParameters::polyTol);
581 }
582 }
583
584 // Update parameter in our list and residual tests.
585 params_->set("Polynomial Tolerance", polyTol_);
586
587 // Check for maximum polynomial degree
588 if (params->isParameter("Random RHS")) {
589 randomRHS_ = params->get("Random RHS",randomRHS_default_);
590 }
591
592 // Update parameter in our list.
593 params_->set("Random RHS", randomRHS_);
594
595
596 // Check for polynomial damping
597 if (params->isParameter("Damped Poly")) {
598 damp_ = params->get("Damped Poly",dampPoly_default_);
599 }
600 // Update parameter in our list.
601 params_->set("Damped Poly", damp_);
602
603 // Check: Should we add roots for stability if needed?
604 if (params->isParameter("Add Roots")) {
605 addRoots_ = params->get("Add Roots",addRoots_default_);
606 }
607
608 // Update parameter in our list.
609 params_->set("Add Roots", addRoots_);
610
611 // Create the timers if we need to.
612#ifdef BELOS_TEUCHOS_TIME_MONITOR
613 if (timerPoly_ == Teuchos::null) {
614 std::string polyLabel = label_ + ": GmresPolyOp creation time";
615 timerPoly_ = Teuchos::TimeMonitor::getNewCounter(polyLabel);
616 }
617#endif
618
619 // Check if we are going to perform an outer solve.
620 if (outerSolverType_ != "") {
621 hasOuterSolver_ = true;
622 }
623
624 // Inform the solver manager that the current parameters were set.
625 isSet_ = true;
626}
627
628
629template<class ScalarType, class MV, class OP>
631{
632 using Teuchos::RCP;
633 using Teuchos::rcp;
634 using Teuchos::rcp_const_cast;
635
636 // Assume convergence is achieved if user does not require strict convergence.
638
639 // Set the current parameters if they were not set before. NOTE:
640 // This may occur if the user generated the solver manager with the
641 // default constructor and then didn't set any parameters using
642 // setParameters().
643 if (! isSet_) {
644 setParameters (Teuchos::parameterList (*getValidParameters ()));
645 }
646
647 TEUCHOS_TEST_FOR_EXCEPTION(
648 problem_.is_null (), GmresPolySolMgrLinearProblemFailure,
649 "Belos::GmresPolySolMgr::solve: The linear problem has not been set yet, "
650 "or was set to null. Please call setProblem() with a nonnull input before "
651 "calling solve().");
652
653 TEUCHOS_TEST_FOR_EXCEPTION(
654 ! problem_->isProblemSet (), GmresPolySolMgrLinearProblemFailure,
655 "Belos::GmresPolySolMgr::solve: The linear problem is not ready. Please "
656 "call setProblem() on the LinearProblem object before calling solve().");
657
658 // If the GMRES polynomial has not been constructed for this
659 // (nmatrix, preconditioner) pair, generate it.
660 if (!poly_dim_ && maxDegree_) {
661#ifdef BELOS_TEUCHOS_TIME_MONITOR
662 Teuchos::TimeMonitor slvtimer(*timerPoly_);
663#endif
664 poly_Op_ = Teuchos::rcp( new gmres_poly_t( problem_, params_ ) );
665 poly_dim_ = poly_Op_->polyDegree();
666
667 TEUCHOS_TEST_FOR_EXCEPTION( !poly_dim_, GmresPolySolMgrPolynomialFailure,
668 "Belos::GmresPolyOp: Failed to generate polynomial that satisfied requirements.");
669 }
670
671
672 // Solve the linear system using the polynomial
673 if (hasOuterSolver_ && maxDegree_) {
674
675 // Then the polynomial will be used as an operator for an outer solver.
676 // Use outer solver parameter list passed in a sublist.
678 RCP<SolverManager<ScalarType, MultiVec<ScalarType>, Operator<ScalarType> > > solver = factory.create( outerSolverType_, outerParams_ );
679 TEUCHOS_TEST_FOR_EXCEPTION( solver == Teuchos::null, std::invalid_argument,
680 "Belos::GmresPolySolMgr::solve(): Selected solver is not valid.");
681
682 // Create a copy of the linear problem that uses the polynomial as a preconditioner.
683 // The original initial solution and right-hand side are thinly wrapped in the gmres_poly_mv_t
684 RCP<gmres_poly_mv_t> new_lhs = rcp( new gmres_poly_mv_t( problem_->getLHS() ) );
685 RCP<gmres_poly_mv_t> new_rhs = rcp( new gmres_poly_mv_t( rcp_const_cast<MV>( problem_->getRHS() ) ) );
686 RCP<gmres_poly_t> A = rcp( new gmres_poly_t( problem_ ) ); // This just performs problem_->applyOp
687 RCP<LinearProblem<ScalarType,MultiVec<ScalarType>,Operator<ScalarType> > > newProblem =
688 rcp( new LinearProblem<ScalarType,MultiVec<ScalarType>,Operator<ScalarType> >( A, new_lhs, new_rhs ) );
689 std::string solverLabel = label_ + ": Hybrid Gmres";
690 newProblem->setLabel(solverLabel);
691
692 // If the preconditioner is left preconditioner, use Gmres poly as a left preconditioner.
693 if (problem_->getLeftPrec() != Teuchos::null)
694 newProblem->setLeftPrec( poly_Op_ );
695 else
696 newProblem->setRightPrec( poly_Op_ );
697 // Set the initial residual vector, if it has already been set in the original problem.
698 // Don't set the preconditioned residual vector, because it is not the GmresPoly preconditioned residual vector.
699 if (problem_->getInitResVec() != Teuchos::null)
700 newProblem->setInitResVec( rcp( new gmres_poly_mv_t( rcp_const_cast<MV>( problem_->getInitResVec() ) ) ) );
701 newProblem->setProblem();
702
703 solver->setProblem( newProblem );
704
705 ret = solver->solve();
706 numIters_ = solver->getNumIters();
707 loaDetected_ = solver->isLOADetected();
708 achievedTol_ = solver->achievedTol();
709
710 } // if (hasOuterSolver_ && maxDegree_)
711 else if (hasOuterSolver_) {
712
713 // There is no polynomial, just create the outer solver with the outerSolverType_ and outerParams_.
715 RCP<SolverManager<ScalarType, MV, OP> > solver = factory.create( outerSolverType_, outerParams_ );
716 TEUCHOS_TEST_FOR_EXCEPTION( solver == Teuchos::null, std::invalid_argument,
717 "Belos::GmresPolySolMgr::solve(): Selected solver is not valid.");
718
719 solver->setProblem( problem_ );
720
721 ret = solver->solve();
722 numIters_ = solver->getNumIters();
723 loaDetected_ = solver->isLOADetected();
724 achievedTol_ = solver->achievedTol();
725
726 }
727 else if (maxDegree_) {
728
729 // Apply the polynomial to the current linear system
730 poly_Op_->ApplyPoly( *problem_->getRHS(), *problem_->getLHS() );
731 achievedTol_ = MTS::one();
732
733 }
734
735 return ret;
736}
737
738
739template<class ScalarType, class MV, class OP>
741{
742 std::ostringstream out;
743
744 out << "\"Belos::GmresPolySolMgr\": {"
745 << "ScalarType: " << Teuchos::TypeNameTraits<ScalarType>::name ()
746 << ", Poly Degree: " << poly_dim_
747 << ", Poly Max Degree: " << maxDegree_
748 << ", Poly Tol: " << polyTol_;
749 out << "}";
750 return out.str ();
751}
752
753} // namespace Belos
754
755#endif // BELOS_GMRES_POLY_SOLMGR_HPP
Belos header file which uses auto-configuration information to include necessary C++ headers.
Defines the GMRES polynomial operator hybrid-GMRES iterative linear solver.
Class which describes the linear problem to be solved by the iterative solver.
Pure virtual base class which describes the basic interface for a solver manager.
Collection of types and exceptions used within the Belos solvers.
Parent class to all Belos exceptions.
Definition: BelosTypes.hpp:60
Belos's class for applying the GMRES polynomial operator that is used by the hybrid-GMRES linear solv...
GmresPolySolMgrLinearProblemFailure is thrown when the linear problem is not setup (i....
GmresPolySolMgrLinearProblemFailure(const std::string &what_arg)
GmresPolySolMgrPolynomialFailure is thrown when their is a problem generating the GMRES polynomial fo...
GmresPolySolMgrPolynomialFailure(const std::string &what_arg)
The GMRES polynomial can be created in conjunction with any standard preconditioner.
Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const override
Get a parameter list containing the current parameters for this object.
Teuchos::Array< Teuchos::RCP< Teuchos::Time > > getTimers() const
Return the timers for this object.
static constexpr const char * orthoType_default_
Teuchos::RCP< std::ostream > outputStream_
static constexpr const char * label_default_
int getNumIters() const override
Get the iteration count for the most recent call to solve().
MagnitudeType achievedTol() const override
Tolerance achieved by the last solve() invocation.
std::string description() const override
Method to return description of the hybrid block GMRES solver manager.
static constexpr bool randomRHS_default_
Teuchos::RCP< SolverManager< ScalarType, MV, OP > > clone() const override
clone for Inverted Injection (DII)
bool isLOADetected() const override
Return whether a loss of accuracy was detected by this solver during the most current solve.
Teuchos::ScalarTraits< ScalarType >::magnitudeType MagnitudeType
Teuchos::ScalarTraits< MagnitudeType > MTS
const LinearProblem< ScalarType, MV, OP > & getProblem() const override
Get current linear problem being solved for in this object.
virtual ~GmresPolySolMgr()
Destructor.
static constexpr const char * outerSolverType_default_
Teuchos::RCP< Teuchos::ParameterList > outerParams_
GmresPolySolMgr()
Empty constructor for GmresPolySolMgr. This constructor takes no arguments and sets the default value...
Belos::GmresPolyOp< ScalarType, MV, OP > gmres_poly_t
void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem) override
Set the linear problem that needs to be solved.
static constexpr int verbosity_default_
Teuchos::RCP< Teuchos::ParameterList > params_
Teuchos::RCP< const Teuchos::ParameterList > validPL_
Cached default (valid) parameters.
Belos::GmresPolyMv< ScalarType, MV > gmres_poly_mv_t
static constexpr bool dampPoly_default_
void reset(const ResetType type) override
Reset the solver.
static constexpr int maxDegree_default_
Teuchos::RCP< Teuchos::Time > timerPoly_
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Get a parameter list containing the valid parameters for this object.
Teuchos::RCP< gmres_poly_t > poly_Op_
static constexpr const char * polyType_default_
Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > problem_
void setParameters(const Teuchos::RCP< Teuchos::ParameterList > &params) override
Set the parameters the solver manager should use to solve the linear problem.
ReturnType solve() override
This method performs possibly repeated calls to the underlying linear solver's iterate() routine unti...
static constexpr bool addRoots_default_
virtual Teuchos::RCP< solver_base_type > create(const std::string &solverName, const Teuchos::RCP< Teuchos::ParameterList > &solverParams)
Create, configure, and return the specified solver.
A linear system to solve, and its associated information.
Interface for multivectors used by Belos' linear solvers.
Alternative run-time polymorphic interface for operators.
Enumeration of all valid Belos (Mat)OrthoManager classes.
std::ostream & printValidNames(std::ostream &out) const
Print all recognized MatOrthoManager names to the given ostream.
bool isValidName(const std::string &name) const
Whether this factory recognizes the MatOrthoManager with the given name.
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
ReturnType
Whether the Belos solve converged for all linear systems.
Definition: BelosTypes.hpp:155
@ Converged
Definition: BelosTypes.hpp:156
ResetType
How to reset the solver.
Definition: BelosTypes.hpp:206
typename ::Belos::Impl::SolverFactorySelector< SC, MV, OP >::type SolverFactory
Default parameters common to most Belos solvers.
Definition: BelosTypes.hpp:283
static const double polyTol
Relative residual tolerance for matrix polynomial construction.
Definition: BelosTypes.hpp:296