Belos Version of the Day
Loading...
Searching...
No Matches
BelosMinresSolMgr.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Belos: Block Linear Solvers Package
4//
5// Copyright 2004-2016 NTESS and the Belos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef BELOS_MINRES_SOLMGR_HPP
11#define BELOS_MINRES_SOLMGR_HPP
12
15
16#include "BelosConfigDefs.hpp"
17#include "BelosTypes.hpp"
18
21
22#include "BelosMinresIter.hpp"
30
31#ifdef BELOS_TEUCHOS_TIME_MONITOR
32#include "Teuchos_TimeMonitor.hpp"
33#endif
34
35#include "Teuchos_StandardParameterEntryValidators.hpp"
36// Teuchos::ScalarTraits<int> doesn't define rmax(), alas, so we get
37// INT_MAX from here.
38#include <climits>
39
40namespace Belos {
41
43
44
54 //
59 public:
63 };
64
83 template<class ScalarType, class MV, class OP, class DM = DefaultDenseMatrix<int,ScalarType>>
84 class MinresSolMgr : public SolverManager<ScalarType,MV,OP,DM> {
85
86 private:
89 typedef Teuchos::ScalarTraits<ScalarType> SCT;
90 typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType MagnitudeType;
91 typedef Teuchos::ScalarTraits< MagnitudeType > MST;
92
93 public:
94
106 static Teuchos::RCP<const Teuchos::ParameterList> defaultParameters();
107
109
110
119 MinresSolMgr();
120
153 const Teuchos::RCP<Teuchos::ParameterList> &params);
154
156 virtual ~MinresSolMgr() {};
157
159 Teuchos::RCP<SolverManager<ScalarType, MV, OP, DM> > clone () const override {
160 return Teuchos::rcp(new MinresSolMgr<ScalarType,MV,OP,DM>);
161 }
163
165
166
169 return *problem_;
170 }
171
173 Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const override {
174 if (defaultParams_.is_null()) {
175 defaultParams_ = defaultParameters ();
176 }
177 return defaultParams_;
178 }
179
181 Teuchos::RCP<const Teuchos::ParameterList> getCurrentParameters() const override {
182 return params_;
183 }
184
194 Teuchos::Array<Teuchos::RCP<Teuchos::Time> > getTimers() const {
195 return Teuchos::tuple (timerSolve_);
196 }
197
203 MagnitudeType achievedTol() const override {
204 return achievedTol_;
205 }
206
208 int getNumIters() const override {
209 return numIters_;
210 }
211
217 bool isLOADetected() const override { return false; }
218
220
222
223
224 void
226 {
227 problem_ = problem;
228 }
229
230 void
231 setParameters (const Teuchos::RCP<Teuchos::ParameterList>& params) override;
232
234 void
236 {
237 debugStatusTest_ = debugStatusTest;
238 // Force the full status-test tree (including this debug test) to be
239 // rebuilt on the next solve(). MINRES has no single isSTSet_-style flag,
240 // so we drop sTest_ and clear parametersSet_ to trigger a rebuild.
241 sTest_ = Teuchos::null;
242 parametersSet_ = false;
243 }
244
246
248
249
250 void
251 reset (const ResetType type) override
252 {
253 if ((type & Belos::Problem) && ! problem_.is_null()) {
254 problem_->setProblem ();
255 }
256 }
258
260
261
279 ReturnType solve() override;
280
282
285
286 std::string description() const override;
287
289
290 private:
292 Teuchos::RCP<LinearProblem<ScalarType,MV,OP,DM> > problem_;
293
295 Teuchos::RCP<OutputManager<ScalarType> > printer_;
296 Teuchos::RCP<std::ostream> outputStream_;
297
304 Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > sTest_;
305
309 Teuchos::RCP<StatusTestMaxIters<ScalarType,MV,OP,DM> > maxIterTest_;
310
314 Teuchos::RCP<StatusTest<ScalarType,MV,OP,DM> > convTest_;
315
319 Teuchos::RCP<StatusTestGenResNorm<ScalarType,MV,OP,DM> > impConvTest_;
320
324 Teuchos::RCP<StatusTestGenResNorm<ScalarType,MV,OP,DM> > expConvTest_;
325
330 Teuchos::RCP<StatusTestOutput<ScalarType,MV,OP,DM> > outputTest_;
331
335 Teuchos::RCP<StatusTest<ScalarType, MV, OP, DM> > debugStatusTest_;
336
340 mutable Teuchos::RCP<const Teuchos::ParameterList> defaultParams_;
341
343 Teuchos::RCP<Teuchos::ParameterList> params_;
344
346 MagnitudeType convtol_;
347
349 MagnitudeType achievedTol_;
350
352 int maxIters_;
353
355 int numIters_;
356
358 int blockSize_;
359
361 int verbosity_;
362
364 int outputStyle_;
365
367 int outputFreq_;
368
370 std::string label_;
371
373 Teuchos::RCP<Teuchos::Time> timerSolve_;
374
376 bool parametersSet_;
377
383 static void
384 validateProblem (const Teuchos::RCP<LinearProblem<ScalarType, MV, OP, DM> >& problem);
385 };
386
387
388 template<class ScalarType, class MV, class OP, class DM>
389 Teuchos::RCP<const Teuchos::ParameterList>
391 {
392 using Teuchos::ParameterList;
393 using Teuchos::parameterList;
394 using Teuchos::RCP;
395 using Teuchos::rcp;
396 using Teuchos::rcpFromRef;
397 using Teuchos::EnhancedNumberValidator;
398 typedef MagnitudeType MT;
399
400 // List of parameters accepted by MINRES, and their default values.
402
403 pl->set ("Convergence Tolerance", MST::squareroot (MST::eps()),
404 "Relative residual tolerance that needs to be achieved by "
405 "the iterative solver, in order for the linear system to be "
406 "declared converged.",
407 rcp (new EnhancedNumberValidator<MT> (MST::zero(), MST::rmax())));
408 pl->set ("Maximum Iterations", static_cast<int>(1000),
409 "Maximum number of iterations allowed for each right-hand "
410 "side solved.",
412 pl->set ("Num Blocks", static_cast<int> (-1),
413 "Ignored, but permitted, for compatibility with other Belos "
414 "solvers.");
415 pl->set ("Block Size", static_cast<int> (1),
416 "Number of vectors in each block. WARNING: The current "
417 "implementation of MINRES only accepts a block size of 1, "
418 "since it can only solve for 1 right-hand side at a time.",
419 rcp (new EnhancedNumberValidator<int> (1, 1)));
420 pl->set ("Verbosity", (int) Belos::Errors,
421 "The type(s) of solver information that should "
422 "be written to the output stream.");
423 pl->set ("Output Style", (int) Belos::General,
424 "What style is used for the solver information written "
425 "to the output stream.");
426 pl->set ("Output Frequency", static_cast<int>(-1),
427 "How often (in terms of number of iterations) intermediate "
428 "convergence information should be written to the output stream."
429 " -1 means never.");
430 pl->set ("Output Stream", rcpFromRef(std::cout),
431 "A reference-counted pointer to the output stream where all "
432 "solver output is sent. The output stream defaults to stdout.");
433 pl->set ("Timer Label", std::string("Belos"),
434 "The string to use as a prefix for the timer labels.");
435 return pl;
436 }
437
438 //
439 // Empty Constructor
440 //
441 template<class ScalarType, class MV, class OP, class DM>
443 convtol_(0.0),
444 achievedTol_(0.0),
445 maxIters_(0),
446 numIters_ (0),
447 blockSize_(0),
448 verbosity_(0),
449 outputStyle_(0),
450 outputFreq_(0),
451 parametersSet_ (false)
452 {}
453
454 //
455 // Primary constructor (use this one)
456 //
457 template<class ScalarType, class MV, class OP, class DM>
460 const Teuchos::RCP<Teuchos::ParameterList>& params) :
461 problem_ (problem),
462 numIters_ (0),
463 parametersSet_ (false)
464 {
465 TEUCHOS_TEST_FOR_EXCEPTION(problem_.is_null(), std::invalid_argument,
466 "MinresSolMgr: The version of the constructor "
467 "that takes a LinearProblem to solve was given a "
468 "null LinearProblem.");
470 }
471
472 template<class ScalarType, class MV, class OP, class DM>
475 {
478 "MINRES requires that you have provided a nonnull LinearProblem to the "
479 "solver manager, before you call the solve() method.");
480 TEUCHOS_TEST_FOR_EXCEPTION(problem->getOperator().is_null(),
482 "MINRES requires a LinearProblem object with a non-null operator (the "
483 "matrix A).");
484 TEUCHOS_TEST_FOR_EXCEPTION(problem->getRHS().is_null(),
486 "MINRES requires a LinearProblem object with a non-null right-hand side.");
487 TEUCHOS_TEST_FOR_EXCEPTION( ! problem->isProblemSet(),
489 "MINRES requires that before you give it a LinearProblem to solve, you "
490 "must first call the linear problem's setProblem() method.");
491 }
492
493 template<class ScalarType, class MV, class OP, class DM>
495 setParameters (const Teuchos::RCP<Teuchos::ParameterList>& params)
496 {
497 using Teuchos::ParameterList;
498 using Teuchos::parameterList;
499 using Teuchos::RCP;
500 using Teuchos::rcp;
501 using Teuchos::rcpFromRef;
502 using Teuchos::null;
503 using Teuchos::is_null;
504 using std::string;
505 using std::ostream;
506 using std::endl;
507
508 if (params_.is_null()) {
509 params_ = parameterList (*getValidParameters());
510 }
512 pl->validateParametersAndSetDefaults (*params_);
513
514 //
515 // Read parameters from the parameter list. We have already
516 // populated it with defaults.
517 //
518 blockSize_ = pl->get<int> ("Block Size");
519 verbosity_ = pl->get<int> ("Verbosity");
520 outputStyle_ = pl->get<int> ("Output Style");
521 outputFreq_ = pl->get<int>("Output Frequency");
522 outputStream_ = pl->get<RCP<std::ostream> > ("Output Stream");
523 convtol_ = pl->get<MagnitudeType> ("Convergence Tolerance");
524 maxIters_ = pl->get<int> ("Maximum Iterations");
525 //
526 // All done reading parameters from the parameter list.
527 // Now we know it's valid and we can store it.
528 //
529 params_ = pl;
530
531 // Change the timer label, and create the timer if necessary.
532 const string newLabel = pl->get<string> ("Timer Label");
533 {
534 if (newLabel != label_ || timerSolve_.is_null()) {
535 label_ = newLabel;
536#ifdef BELOS_TEUCHOS_TIME_MONITOR
537 const string solveLabel = label_ + ": MinresSolMgr total solve time";
538 // Unregister the old timer before creating a new one.
539 if (! timerSolve_.is_null()) {
540 Teuchos::TimeMonitor::clearCounter (label_);
541 timerSolve_ = Teuchos::null;
542 }
543 timerSolve_ = Teuchos::TimeMonitor::getNewCounter (solveLabel);
544#endif // BELOS_TEUCHOS_TIME_MONITOR
545 }
546 }
547
548 // Create output manager, if necessary; otherwise, set its parameters.
549 bool recreatedPrinter = false;
550 if (printer_.is_null()) {
551 printer_ = rcp (new OutputManager<ScalarType> (verbosity_, outputStream_));
552 recreatedPrinter = true;
553 } else {
554 // Set the output stream's verbosity level.
555 printer_->setVerbosity (verbosity_);
556 // Tell the output manager about the new output stream.
557 printer_->setOStream (outputStream_);
558 }
559
560 //
561 // Set up the convergence tests
562 //
565
566 // Do we need to allocate at least one of the implicit or explicit
567 // residual norm convergence tests?
568 const bool allocatedConvergenceTests =
569 impConvTest_.is_null() || expConvTest_.is_null();
570
571 // Allocate or set the tolerance of the implicit residual norm
572 // convergence test.
573 if (impConvTest_.is_null()) {
574 impConvTest_ = rcp (new res_norm_type (convtol_));
575 impConvTest_->defineResForm (res_norm_type::Implicit, TwoNorm);
576 // TODO (mfh 03 Nov 2011) Allow users to define the type of
577 // scaling (or a custom scaling factor).
578 impConvTest_->defineScaleForm (NormOfInitRes, TwoNorm);
579 } else {
580 impConvTest_->setTolerance (convtol_);
581 }
582
583 // Allocate or set the tolerance of the explicit residual norm
584 // convergence test.
585 if (expConvTest_.is_null()) {
586 expConvTest_ = rcp (new res_norm_type (convtol_));
587 expConvTest_->defineResForm (res_norm_type::Explicit, TwoNorm);
588 // TODO (mfh 03 Nov 2011) Allow users to define the type of
589 // scaling (or a custom scaling factor).
590 expConvTest_->defineScaleForm (NormOfInitRes, TwoNorm);
591 } else {
592 expConvTest_->setTolerance (convtol_);
593 }
594
595 // Whether we need to recreate the full status test. We only need
596 // to do that if at least one of convTest_ or maxIterTest_ had to
597 // be reallocated.
598 bool needToRecreateFullStatusTest = sTest_.is_null();
599
600 // Residual status test is a combo of the implicit and explicit
601 // convergence tests.
602 if (convTest_.is_null() || allocatedConvergenceTests) {
603 convTest_ = rcp (new combo_type (combo_type::SEQ, impConvTest_, expConvTest_));
605 }
606
607 // Maximum number of iterations status test. It tells the solver to
608 // stop iteration, if the maximum number of iterations has been
609 // exceeded. Initialize it if we haven't yet done so, otherwise
610 // tell it the new maximum number of iterations.
611 if (maxIterTest_.is_null()) {
612 maxIterTest_ = rcp (new StatusTestMaxIters<ScalarType,MV,OP,DM> (maxIters_));
614 } else {
615 maxIterTest_->setMaxIters (maxIters_);
616 }
617
618 // Create the full status test if we need to.
619 //
620 // The full status test: the maximum number of iterations have
621 // been reached, OR the residual has converged.
622 //
623 // "If we need to" means either that the status test was never
624 // created before, or that its two component tests had to be
625 // reallocated.
627 sTest_ = rcp (new combo_type (combo_type::OR, maxIterTest_, convTest_));
628 }
629
630 // Add a debug status test if one was provided (e.g. a wall-clock time
631 // limit). OR-combining it into the top-level test lets it stop the solve;
632 // the dispatch in solve() treats such a stop as an unconverged
633 // (recoverable) termination.
634 if (Teuchos::nonnull(debugStatusTest_)) {
635 sTest_ = rcp (new combo_type (combo_type::OR, sTest_, debugStatusTest_));
636 }
637
638 // If necessary, create the status test output class. This class
639 // manages and formats the output from the status test. We have
640 // to recreate the output test if we had to (re)allocate either
641 // printer_ or sTest_.
642 if (outputTest_.is_null() || needToRecreateFullStatusTest || recreatedPrinter) {
644 outputTest_ = stoFactory.create (printer_, sTest_, outputFreq_,
646 } else {
647 outputTest_->setOutputFrequency (outputFreq_);
648 }
649 // Set the solver string for the output test.
650 // StatusTestOutputFactory has no constructor argument for this.
651 outputTest_->setSolverDesc (std::string (" MINRES "));
652
653 // Inform the solver manager that the current parameters were set.
654 parametersSet_ = true;
655
656 if (verbosity_ & Debug) {
657 using std::endl;
658
659 std::ostream& dbg = printer_->stream (Debug);
660 dbg << "MINRES parameters:" << endl << params_ << endl;
661 }
662 }
663
664
665 template<class ScalarType, class MV, class OP, class DM>
667 {
668 using Teuchos::RCP;
669 using Teuchos::rcp;
670 using Teuchos::rcp_const_cast;
671 using std::endl;
672
674
675 if (! parametersSet_) {
676 setParameters (params_);
677 }
678 std::ostream& dbg = printer_->stream (Debug);
679
680#ifdef BELOS_TEUCHOS_TIME_MONITOR
681 Teuchos::TimeMonitor solveTimerMonitor (*timerSolve_);
682#endif // BELOS_TEUCHOS_TIME_MONITOR
683
684 // We need a problem to solve, else we can't solve it.
685 validateProblem (problem_);
686
687 // Reset the status test for this solve.
688 outputTest_->reset();
689
690 // The linear problem has this many right-hand sides to solve.
691 // MINRES can solve only one at a time, so we solve for each
692 // right-hand side in succession.
693 const int numRHS2Solve = MVT::GetNumberVecs (*(problem_->getRHS()));
694
695 // Create MINRES iteration object. Pass along the solver
696 // manager's parameters, which have already been validated.
699 rcp (new iter_type (problem_, printer_, outputTest_, *params_));
700
701 // The index/indices of the right-hand sides for which MINRES did
702 // _not_ converge. Hopefully this is empty after the for loop
703 // below! If it is not empty, at least one right-hand side did
704 // not converge.
705 std::vector<int> notConverged;
706 std::vector<int> currentIndices(1);
707
708 numIters_ = 0;
709
710 // Solve for each right-hand side in turn.
711 for (int currentRHS = 0; currentRHS < numRHS2Solve; ++currentRHS) {
712 // Inform the linear problem of the right-hand side(s) currently
713 // being solved. MINRES only knows how to solve linear problems
714 // with one right-hand side, so we only include one index, which
715 // is the index of the current right-hand side.
717 problem_->setLSIndex (currentIndices);
718
719 dbg << "-- Current right-hand side index being solved: "
720 << currentRHS << endl;
721
722 // Reset the number of iterations.
723 minres_iter->resetNumIters();
724 // Reset the number of calls that the status test output knows about.
725 outputTest_->resetNumCalls();
726 // Set the new state and initialize the solver.
728
729 // Get the residual vector for the current linear system
730 // (that is, for the current right-hand side).
731 newstate.Y = MVT::CloneViewNonConst (*(rcp_const_cast<MV> (problem_->getInitResVec())), currentIndices);
732 minres_iter->initializeMinres (newstate);
733
734 // Attempt to solve for the solution corresponding to the
735 // current right-hand side.
736 while (true) {
737 try {
738 minres_iter->iterate();
739
740 // First check for convergence
741 if (convTest_->getStatus() == Passed) {
742 dbg << "---- Converged after " << maxIterTest_->getNumIters()
743 << " iterations" << endl;
744 break;
745 }
746 // Now check for max # of iterations
747 else if (maxIterTest_->getStatus() == Passed) {
749 dbg << "---- Did not converge after " << maxIterTest_->getNumIters()
750 << " iterations" << endl;
751 // This right-hand side didn't converge!
752 notConverged.push_back (currentRHS);
753 break;
754 }
755 // Now check whether a debug status test stopped the iteration.
756 else if (Teuchos::nonnull(debugStatusTest_) &&
757 debugStatusTest_->getStatus() == Passed) {
758 // A debug status test (e.g. a wall-clock time limit) stopped the
759 // iteration. Treat as an unconverged termination rather than an
760 // inconsistent state.
762 notConverged.push_back (currentRHS);
763 break;
764 } else {
766 // If we get here, we returned from iterate(), but none of
767 // our status tests Passed. Something is wrong, and it is
768 // probably our fault.
769 TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
770 "Belos::MinresSolMgr::solve(): iterations neither converged, "
771 "nor reached the maximum number of iterations " << maxIters_
772 << ". That means something went wrong.");
773 }
774 }
775 catch (const StatusTestNaNError& e) {
776 // A NaN was detected in the solver. Set the solution to zero and return unconverged.
778 achievedTol_ = MST::one();
779 Teuchos::RCP<MV> X = problem_->getLHS();
780 MVT::MvInit( *X, SCT::zero() );
781 printer_->stream(Warnings) << "Belos::MinresSolMgr::solve(): Warning! NaN has been detected!"
782 << std::endl;
783 return retType;
784 }
785 catch (const std::exception &e) {
787 printer_->stream (Errors)
788 << "Error! Caught std::exception in MinresIter::iterate() at "
789 << "iteration " << minres_iter->getNumIters() << endl
790 << e.what() << endl;
791 throw e;
792 }
793 }
794
795 // Inform the linear problem that we are finished with the
796 // current right-hand side. It may or may not have converged,
797 // but we don't try again if the first time didn't work.
798 problem_->setCurrLS();
799
800 // Get iteration information for this solve: total number of
801 // iterations for all right-hand sides.
802 numIters_ += maxIterTest_->getNumIters();
803 }
804
805 // Print final summary of the solution process
806 sTest_->print (printer_->stream (FinalSummary));
807
808 // Print timing information, if the corresponding compile-time and
809 // run-time options are enabled.
810#ifdef BELOS_TEUCHOS_TIME_MONITOR
811 // Calling summarize() can be expensive, so don't call unless the
812 // user wants to print out timing details. summarize() will do all
813 // the work even if it's passed a "black hole" output stream.
814 if (verbosity_ & TimingDetails) {
815 Teuchos::TimeMonitor::summarize (printer_->stream (TimingDetails));
816 }
817#endif // BELOS_TEUCHOS_TIME_MONITOR
818
819 // Save the convergence test value ("achieved tolerance") for this
820 // solve. This solver always has two residual norm status tests:
821 // an explicit and an implicit test. The master convergence test
822 // convTest_ is a SEQ combo of the implicit resp. explicit tests.
823 // If the implicit test never passes, then the explicit test won't
824 // ever be executed. This manifests as
825 // expConvTest_->getTestValue()->size() < 1. We deal with this
826 // case by using the values returned by
827 // impConvTest_->getTestValue().
828 {
829 const std::vector<MagnitudeType>* pTestValues = expConvTest_->getTestValue();
830 if (pTestValues == NULL || pTestValues->size() < 1) {
831 pTestValues = impConvTest_->getTestValue();
832 }
833 TEUCHOS_TEST_FOR_EXCEPTION(pTestValues == NULL, std::logic_error,
834 "Belos::MinresSolMgr::solve(): The implicit convergence test's getTestValue() "
835 "method returned NULL. Please report this bug to the Belos developers.");
836 TEUCHOS_TEST_FOR_EXCEPTION(pTestValues->size() < 1, std::logic_error,
837 "Belos::MinresSolMgr::solve(): The implicit convergence test's getTestValue() "
838 "method returned a vector of length zero. Please report this bug to the "
839 "Belos developers.");
840
841 // FIXME (mfh 12 Dec 2011) Does pTestValues really contain the
842 // achieved tolerances for all vectors in the current solve(), or
843 // just for the vectors from the last deflation?
844 achievedTol_ = *std::max_element (pTestValues->begin(), pTestValues->end());
845 }
846
847 if (notConverged.size() > 0) {
848 return retType;
849 } else {
850 return Converged;
851 }
852 }
853
854 // This method requires the solver manager to return a std::string that describes itself.
855 template<class ScalarType, class MV, class OP, class DM>
857 {
858 std::ostringstream oss;
859 oss << "Belos::MinresSolMgr< "
860 << Teuchos::ScalarTraits<ScalarType>::name()
861 <<", MV, OP >";
862 // oss << "{";
863 // oss << "Block Size=" << blockSize_;
864 // oss << "}";
865 return oss.str();
866 }
867
868} // end Belos namespace
869
870#ifdef HAVE_BELOS_TPETRA
872
873#define BELOS_TPETRA_MINRESSOLMGR_NOEXTERN_CALL(SC, LO, GO, NT) \
874 BELOS_TPETRA_CALL(Belos::MinresSolMgr, SC, LO, GO, NT)
875
876#define BELOS_TPETRA_MINRESSOLMGR_EXTERN_CALL(SC, LO, GO, NT) \
877 BELOS_TPETRA_EXTERN_CALL(Belos::MinresSolMgr, SC, LO, GO, NT)
878
879TPETRA_INSTANTIATE_SLGN_NO_ORDINAL_SCALAR(BELOS_TPETRA_MINRESSOLMGR_EXTERN_CALL)
880#endif
881
882
883#endif /* BELOS_MINRES_SOLMGR_HPP */
Belos header file which uses auto-configuration information to include necessary C++ headers.
Full specialization of Belos::DenseMatTraits for Kokkos::DualView with arbitrary scalarType....
Class which describes the linear problem to be solved by the iterative solver.
MINRES iteration implementation.
Class which manages the output and verbosity of the Belos solvers.
Pure virtual base class which describes the basic interface for a solver manager.
Belos::StatusTest for logically combining several status tests.
Belos::StatusTestResNorm for specifying general residual norm stopping criteria.
Belos::StatusTest class for specifying a maximum number of iterations.
A factory class for generating StatusTestOutput objects.
Full specialization of Belos::DenseMatTraits for Teuchos::SerialDenseMatrix with ordinal type int and...
Collection of types and exceptions used within the Belos solvers.
Parent class to all Belos exceptions.
MINRES linear solver solution manager.
static Teuchos::RCP< const Teuchos::ParameterList > defaultParameters()
List of valid MINRES parameters and their default values.
MagnitudeType achievedTol() const override
Tolerance achieved by the last solve() invocation.
void reset(const ResetType type) override
Reset the solver manager.
void setDebugStatusTest(const Teuchos::RCP< StatusTest< ScalarType, MV, OP, DM > > &debugStatusTest) override
Set a debug status test, OR-combined into the top-level status test.
bool isLOADetected() const override
Whether a loss of accuracy was detected in the solver.
virtual ~MinresSolMgr()
Destructor.
Teuchos::RCP< SolverManager< ScalarType, MV, OP, DM > > clone() const override
clone for Inverted Injection (DII)
Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const override
Return the list of current parameters for this object.
Teuchos::Array< Teuchos::RCP< Teuchos::Time > > getTimers() const
Return all timers for this object.
std::string description() const override
int getNumIters() const override
Get the iteration count for the most recent call to solve().
MinresSolMgr()
Default constructor.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Return the list of default parameters for this object.
ReturnType solve() override
Iterate until the status test tells us to stop.
const LinearProblem< ScalarType, MV, OP, DM > & getProblem() const override
Return the linear problem to be solved.
void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP, DM > > &problem) override
Set the linear problem that needs to be solved.
void setParameters(const Teuchos::RCP< Teuchos::ParameterList > &params) override
Set the parameters to use when solving the linear problem.
This subclass of std::exception may be thrown from the MinresSolMgr::solve() method.
MinresSolMgrLinearProblemFailure(const std::string &what_arg)
Alternative run-time polymorphic interface for operators.
Operator()
Default constructor (does nothing).
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
@ FinalSummary
@ TimingDetails
ReturnType
Whether the Belos solve converged for all linear systems.
@ NaNDetected
@ Unconverged
@ MaxItersReached
@ NonspecificException
@ InconsistentState
@ Undetermined
@ NormOfInitRes
ResetType
How to reset the solver.

Generated for Belos by doxygen 1.9.8