Belos  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BelosMinresSolMgr.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 #ifndef BELOS_MINRES_SOLMGR_HPP
43 #define BELOS_MINRES_SOLMGR_HPP
44 
47 
48 #include "BelosConfigDefs.hpp"
49 #include "BelosTypes.hpp"
50 
51 #include "BelosLinearProblem.hpp"
52 #include "BelosSolverManager.hpp"
53 
54 #include "BelosMinresIter.hpp"
57 #include "BelosStatusTestCombo.hpp"
59 #include "BelosOutputManager.hpp"
60 #include "Teuchos_BLAS.hpp"
61 #include "Teuchos_LAPACK.hpp"
62 #ifdef BELOS_TEUCHOS_TIME_MONITOR
63 #include "Teuchos_TimeMonitor.hpp"
64 #endif
65 
66 #include "Teuchos_StandardParameterEntryValidators.hpp"
67 // Teuchos::ScalarTraits<int> doesn't define rmax(), alas, so we get
68 // INT_MAX from here.
69 #include <climits>
70 
71 namespace Belos {
72 
74 
75 
85  //
90  public:
91  MinresSolMgrLinearProblemFailure (const std::string& what_arg) :
92  BelosError(what_arg)
93  {}
94  };
95 
114  template<class ScalarType, class MV, class OP>
115  class MinresSolMgr : public SolverManager<ScalarType,MV,OP> {
116 
117  private:
121  typedef typename Teuchos::ScalarTraits<ScalarType>::magnitudeType MagnitudeType;
123 
124  public:
125 
138 
140 
141 
150  MinresSolMgr();
151 
185 
187  virtual ~MinresSolMgr() {};
188 
192  }
194 
196 
197 
199  const LinearProblem<ScalarType,MV,OP>& getProblem() const override {
200  return *problem_;
201  }
202 
205  if (defaultParams_.is_null()) {
206  defaultParams_ = defaultParameters ();
207  }
208  return defaultParams_;
209  }
210 
213  return params_;
214  }
215 
226  return Teuchos::tuple (timerSolve_);
227  }
228 
234  MagnitudeType achievedTol() const override {
235  return achievedTol_;
236  }
237 
239  int getNumIters() const override {
240  return numIters_;
241  }
242 
248  bool isLOADetected() const override { return false; }
249 
251 
253 
254 
255  void
257  {
258  problem_ = problem;
259  }
260 
261  void
262  setParameters (const Teuchos::RCP<Teuchos::ParameterList>& params) override;
263 
265 
267 
268 
269  void
270  reset (const ResetType type) override
271  {
272  if ((type & Belos::Problem) && ! problem_.is_null()) {
273  problem_->setProblem ();
274  }
275  }
277 
279 
280 
298  ReturnType solve() override;
299 
301 
304 
305  std::string description() const override;
306 
308 
309  private:
312 
315  Teuchos::RCP<std::ostream> outputStream_;
316 
324 
329 
334 
339 
344 
350 
354  mutable Teuchos::RCP<const Teuchos::ParameterList> defaultParams_;
355 
358 
360  MagnitudeType convtol_;
361 
363  MagnitudeType achievedTol_;
364 
366  int maxIters_;
367 
369  int numIters_;
370 
372  int blockSize_;
373 
375  int verbosity_;
376 
378  int outputStyle_;
379 
381  int outputFreq_;
382 
384  std::string label_;
385 
387  Teuchos::RCP<Teuchos::Time> timerSolve_;
388 
390  bool parametersSet_;
391 
397  static void
398  validateProblem (const Teuchos::RCP<LinearProblem<ScalarType, MV, OP> >& problem);
399  };
400 
401 
402  template<class ScalarType, class MV, class OP>
405  {
407  using Teuchos::parameterList;
408  using Teuchos::RCP;
409  using Teuchos::rcp;
410  using Teuchos::rcpFromRef;
412  typedef MagnitudeType MT;
413  typedef Teuchos::ScalarTraits<MT> MST;
414 
415  // List of parameters accepted by MINRES, and their default values.
416  RCP<ParameterList> pl = parameterList ("MINRES");
417 
418  pl->set ("Convergence Tolerance", MST::squareroot (MST::eps()),
419  "Relative residual tolerance that needs to be achieved by "
420  "the iterative solver, in order for the linear system to be "
421  "declared converged.",
422  rcp (new EnhancedNumberValidator<MT> (MST::zero(), MST::rmax())));
423  pl->set ("Maximum Iterations", static_cast<int>(1000),
424  "Maximum number of iterations allowed for each right-hand "
425  "side solved.",
426  rcp (new EnhancedNumberValidator<int> (0, INT_MAX)));
427  pl->set ("Num Blocks", static_cast<int> (-1),
428  "Ignored, but permitted, for compatibility with other Belos "
429  "solvers.");
430  pl->set ("Block Size", static_cast<int> (1),
431  "Number of vectors in each block. WARNING: The current "
432  "implementation of MINRES only accepts a block size of 1, "
433  "since it can only solve for 1 right-hand side at a time.",
434  rcp (new EnhancedNumberValidator<int> (1, 1)));
435  pl->set ("Verbosity", (int) Belos::Errors,
436  "The type(s) of solver information that should "
437  "be written to the output stream.");
438  pl->set ("Output Style", (int) Belos::General,
439  "What style is used for the solver information written "
440  "to the output stream.");
441  pl->set ("Output Frequency", static_cast<int>(-1),
442  "How often (in terms of number of iterations) intermediate "
443  "convergence information should be written to the output stream."
444  " -1 means never.");
445  pl->set ("Output Stream", rcpFromRef(std::cout),
446  "A reference-counted pointer to the output stream where all "
447  "solver output is sent. The output stream defaults to stdout.");
448  pl->set ("Timer Label", std::string("Belos"),
449  "The string to use as a prefix for the timer labels.");
450  return pl;
451  }
452 
453  //
454  // Empty Constructor
455  //
456  template<class ScalarType, class MV, class OP>
458  convtol_(0.0),
459  achievedTol_(0.0),
460  maxIters_(0),
461  numIters_ (0),
462  blockSize_(0),
463  verbosity_(0),
464  outputStyle_(0),
465  outputFreq_(0),
466  parametersSet_ (false)
467  {}
468 
469  //
470  // Primary constructor (use this one)
471  //
472  template<class ScalarType, class MV, class OP>
475  const Teuchos::RCP<Teuchos::ParameterList>& params) :
476  problem_ (problem),
477  numIters_ (0),
478  parametersSet_ (false)
479  {
480  TEUCHOS_TEST_FOR_EXCEPTION(problem_.is_null(), std::invalid_argument,
481  "MinresSolMgr: The version of the constructor "
482  "that takes a LinearProblem to solve was given a "
483  "null LinearProblem.");
484  setParameters (params);
485  }
486 
487  template<class ScalarType, class MV, class OP>
488  void
491  {
492  TEUCHOS_TEST_FOR_EXCEPTION(problem.is_null(),
494  "MINRES requires that you have provided a nonnull LinearProblem to the "
495  "solver manager, before you call the solve() method.");
496  TEUCHOS_TEST_FOR_EXCEPTION(problem->getOperator().is_null(),
498  "MINRES requires a LinearProblem object with a non-null operator (the "
499  "matrix A).");
500  TEUCHOS_TEST_FOR_EXCEPTION(problem->getRHS().is_null(),
502  "MINRES requires a LinearProblem object with a non-null right-hand side.");
503  TEUCHOS_TEST_FOR_EXCEPTION( ! problem->isProblemSet(),
505  "MINRES requires that before you give it a LinearProblem to solve, you "
506  "must first call the linear problem's setProblem() method.");
507  }
508 
509  template<class ScalarType, class MV, class OP>
510  void
513  {
515  using Teuchos::parameterList;
516  using Teuchos::RCP;
517  using Teuchos::rcp;
518  using Teuchos::rcpFromRef;
519  using Teuchos::null;
520  using Teuchos::is_null;
521  using std::string;
522  using std::ostream;
523  using std::endl;
524 
525  if (params_.is_null()) {
526  params_ = parameterList (*getValidParameters());
527  }
528  RCP<ParameterList> pl = params;
529  pl->validateParametersAndSetDefaults (*params_);
530 
531  //
532  // Read parameters from the parameter list. We have already
533  // populated it with defaults.
534  //
535  blockSize_ = pl->get<int> ("Block Size");
536  verbosity_ = pl->get<int> ("Verbosity");
537  outputStyle_ = pl->get<int> ("Output Style");
538  outputFreq_ = pl->get<int>("Output Frequency");
539  outputStream_ = pl->get<RCP<std::ostream> > ("Output Stream");
540  convtol_ = pl->get<MagnitudeType> ("Convergence Tolerance");
541  maxIters_ = pl->get<int> ("Maximum Iterations");
542  //
543  // All done reading parameters from the parameter list.
544  // Now we know it's valid and we can store it.
545  //
546  params_ = pl;
547 
548  // Change the timer label, and create the timer if necessary.
549  const string newLabel = pl->get<string> ("Timer Label");
550  {
551  if (newLabel != label_ || timerSolve_.is_null()) {
552  label_ = newLabel;
553 #ifdef BELOS_TEUCHOS_TIME_MONITOR
554  const string solveLabel = label_ + ": MinresSolMgr total solve time";
555  // Unregister the old timer before creating a new one.
556  if (! timerSolve_.is_null()) {
558  timerSolve_ = Teuchos::null;
559  }
560  timerSolve_ = Teuchos::TimeMonitor::getNewCounter (solveLabel);
561 #endif // BELOS_TEUCHOS_TIME_MONITOR
562  }
563  }
564 
565  // Create output manager, if necessary; otherwise, set its parameters.
566  bool recreatedPrinter = false;
567  if (printer_.is_null()) {
568  printer_ = rcp (new OutputManager<ScalarType> (verbosity_, outputStream_));
569  recreatedPrinter = true;
570  } else {
571  // Set the output stream's verbosity level.
572  printer_->setVerbosity (verbosity_);
573  // Tell the output manager about the new output stream.
574  printer_->setOStream (outputStream_);
575  }
576 
577  //
578  // Set up the convergence tests
579  //
580  typedef StatusTestGenResNorm<ScalarType, MV, OP> res_norm_type;
581  typedef StatusTestCombo<ScalarType, MV, OP> combo_type;
582 
583  // Do we need to allocate at least one of the implicit or explicit
584  // residual norm convergence tests?
585  const bool allocatedConvergenceTests =
586  impConvTest_.is_null() || expConvTest_.is_null();
587 
588  // Allocate or set the tolerance of the implicit residual norm
589  // convergence test.
590  if (impConvTest_.is_null()) {
591  impConvTest_ = rcp (new res_norm_type (convtol_));
592  impConvTest_->defineResForm (res_norm_type::Implicit, TwoNorm);
593  // TODO (mfh 03 Nov 2011) Allow users to define the type of
594  // scaling (or a custom scaling factor).
595  impConvTest_->defineScaleForm (NormOfInitRes, TwoNorm);
596  } else {
597  impConvTest_->setTolerance (convtol_);
598  }
599 
600  // Allocate or set the tolerance of the explicit residual norm
601  // convergence test.
602  if (expConvTest_.is_null()) {
603  expConvTest_ = rcp (new res_norm_type (convtol_));
604  expConvTest_->defineResForm (res_norm_type::Explicit, TwoNorm);
605  // TODO (mfh 03 Nov 2011) Allow users to define the type of
606  // scaling (or a custom scaling factor).
607  expConvTest_->defineScaleForm (NormOfInitRes, TwoNorm);
608  } else {
609  expConvTest_->setTolerance (convtol_);
610  }
611 
612  // Whether we need to recreate the full status test. We only need
613  // to do that if at least one of convTest_ or maxIterTest_ had to
614  // be reallocated.
615  bool needToRecreateFullStatusTest = sTest_.is_null();
616 
617  // Residual status test is a combo of the implicit and explicit
618  // convergence tests.
619  if (convTest_.is_null() || allocatedConvergenceTests) {
620  convTest_ = rcp (new combo_type (combo_type::SEQ, impConvTest_, expConvTest_));
621  needToRecreateFullStatusTest = true;
622  }
623 
624  // Maximum number of iterations status test. It tells the solver to
625  // stop iteration, if the maximum number of iterations has been
626  // exceeded. Initialize it if we haven't yet done so, otherwise
627  // tell it the new maximum number of iterations.
628  if (maxIterTest_.is_null()) {
629  maxIterTest_ = rcp (new StatusTestMaxIters<ScalarType,MV,OP> (maxIters_));
630  needToRecreateFullStatusTest = true;
631  } else {
632  maxIterTest_->setMaxIters (maxIters_);
633  }
634 
635  // Create the full status test if we need to.
636  //
637  // The full status test: the maximum number of iterations have
638  // been reached, OR the residual has converged.
639  //
640  // "If we need to" means either that the status test was never
641  // created before, or that its two component tests had to be
642  // reallocated.
643  if (needToRecreateFullStatusTest) {
644  sTest_ = rcp (new combo_type (combo_type::OR, maxIterTest_, convTest_));
645  }
646 
647  // If necessary, create the status test output class. This class
648  // manages and formats the output from the status test. We have
649  // to recreate the output test if we had to (re)allocate either
650  // printer_ or sTest_.
651  if (outputTest_.is_null() || needToRecreateFullStatusTest || recreatedPrinter) {
652  StatusTestOutputFactory<ScalarType,MV,OP> stoFactory (outputStyle_);
653  outputTest_ = stoFactory.create (printer_, sTest_, outputFreq_,
655  } else {
656  outputTest_->setOutputFrequency (outputFreq_);
657  }
658  // Set the solver string for the output test.
659  // StatusTestOutputFactory has no constructor argument for this.
660  outputTest_->setSolverDesc (std::string (" MINRES "));
661 
662  // Inform the solver manager that the current parameters were set.
663  parametersSet_ = true;
664 
665  if (verbosity_ & Debug) {
666  using std::endl;
667 
668  std::ostream& dbg = printer_->stream (Debug);
669  dbg << "MINRES parameters:" << endl << params_ << endl;
670  }
671  }
672 
673 
674  template<class ScalarType, class MV, class OP>
676  {
677  using Teuchos::RCP;
678  using Teuchos::rcp;
679  using Teuchos::rcp_const_cast;
680  using std::endl;
681 
682  if (! parametersSet_) {
683  setParameters (params_);
684  }
685  std::ostream& dbg = printer_->stream (Debug);
686 
687 #ifdef BELOS_TEUCHOS_TIME_MONITOR
688  Teuchos::TimeMonitor solveTimerMonitor (*timerSolve_);
689 #endif // BELOS_TEUCHOS_TIME_MONITOR
690 
691  // We need a problem to solve, else we can't solve it.
692  validateProblem (problem_);
693 
694  // Reset the status test for this solve.
695  outputTest_->reset();
696 
697  // The linear problem has this many right-hand sides to solve.
698  // MINRES can solve only one at a time, so we solve for each
699  // right-hand side in succession.
700  const int numRHS2Solve = MVT::GetNumberVecs (*(problem_->getRHS()));
701 
702  // Create MINRES iteration object. Pass along the solver
703  // manager's parameters, which have already been validated.
704  typedef MinresIter<ScalarType, MV, OP> iter_type;
705  RCP<iter_type> minres_iter =
706  rcp (new iter_type (problem_, printer_, outputTest_, *params_));
707 
708  // The index/indices of the right-hand sides for which MINRES did
709  // _not_ converge. Hopefully this is empty after the for loop
710  // below! If it is not empty, at least one right-hand side did
711  // not converge.
712  std::vector<int> notConverged;
713  std::vector<int> currentIndices(1);
714 
715  numIters_ = 0;
716 
717  // Solve for each right-hand side in turn.
718  for (int currentRHS = 0; currentRHS < numRHS2Solve; ++currentRHS) {
719  // Inform the linear problem of the right-hand side(s) currently
720  // being solved. MINRES only knows how to solve linear problems
721  // with one right-hand side, so we only include one index, which
722  // is the index of the current right-hand side.
723  currentIndices[0] = currentRHS;
724  problem_->setLSIndex (currentIndices);
725 
726  dbg << "-- Current right-hand side index being solved: "
727  << currentRHS << endl;
728 
729  // Reset the number of iterations.
730  minres_iter->resetNumIters();
731  // Reset the number of calls that the status test output knows about.
732  outputTest_->resetNumCalls();
733  // Set the new state and initialize the solver.
735 
736  // Get the residual vector for the current linear system
737  // (that is, for the current right-hand side).
738  newstate.Y = MVT::CloneViewNonConst (*(rcp_const_cast<MV> (problem_->getInitResVec())), currentIndices);
739  minres_iter->initializeMinres (newstate);
740 
741  // Attempt to solve for the solution corresponding to the
742  // current right-hand side.
743  while (true) {
744  try {
745  minres_iter->iterate();
746 
747  // First check for convergence
748  if (convTest_->getStatus() == Passed) {
749  dbg << "---- Converged after " << maxIterTest_->getNumIters()
750  << " iterations" << endl;
751  break;
752  }
753  // Now check for max # of iterations
754  else if (maxIterTest_->getStatus() == Passed) {
755  dbg << "---- Did not converge after " << maxIterTest_->getNumIters()
756  << " iterations" << endl;
757  // This right-hand side didn't converge!
758  notConverged.push_back (currentRHS);
759  break;
760  } else {
761  // If we get here, we returned from iterate(), but none of
762  // our status tests Passed. Something is wrong, and it is
763  // probably our fault.
764  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
765  "Belos::MinresSolMgr::solve(): iterations neither converged, "
766  "nor reached the maximum number of iterations " << maxIters_
767  << ". That means something went wrong.");
768  }
769  } catch (const std::exception &e) {
770  printer_->stream (Errors)
771  << "Error! Caught std::exception in MinresIter::iterate() at "
772  << "iteration " << minres_iter->getNumIters() << endl
773  << e.what() << endl;
774  throw e;
775  }
776  }
777 
778  // Inform the linear problem that we are finished with the
779  // current right-hand side. It may or may not have converged,
780  // but we don't try again if the first time didn't work.
781  problem_->setCurrLS();
782 
783  // Get iteration information for this solve: total number of
784  // iterations for all right-hand sides.
785  numIters_ += maxIterTest_->getNumIters();
786  }
787 
788  // Print final summary of the solution process
789  sTest_->print (printer_->stream (FinalSummary));
790 
791  // Print timing information, if the corresponding compile-time and
792  // run-time options are enabled.
793 #ifdef BELOS_TEUCHOS_TIME_MONITOR
794  // Calling summarize() can be expensive, so don't call unless the
795  // user wants to print out timing details. summarize() will do all
796  // the work even if it's passed a "black hole" output stream.
797  if (verbosity_ & TimingDetails) {
798  Teuchos::TimeMonitor::summarize (printer_->stream (TimingDetails));
799  }
800 #endif // BELOS_TEUCHOS_TIME_MONITOR
801 
802  // Save the convergence test value ("achieved tolerance") for this
803  // solve. This solver always has two residual norm status tests:
804  // an explicit and an implicit test. The master convergence test
805  // convTest_ is a SEQ combo of the implicit resp. explicit tests.
806  // If the implicit test never passes, then the explicit test won't
807  // ever be executed. This manifests as
808  // expConvTest_->getTestValue()->size() < 1. We deal with this
809  // case by using the values returned by
810  // impConvTest_->getTestValue().
811  {
812  const std::vector<MagnitudeType>* pTestValues = expConvTest_->getTestValue();
813  if (pTestValues == NULL || pTestValues->size() < 1) {
814  pTestValues = impConvTest_->getTestValue();
815  }
816  TEUCHOS_TEST_FOR_EXCEPTION(pTestValues == NULL, std::logic_error,
817  "Belos::MinresSolMgr::solve(): The implicit convergence test's getTestValue() "
818  "method returned NULL. Please report this bug to the Belos developers.");
819  TEUCHOS_TEST_FOR_EXCEPTION(pTestValues->size() < 1, std::logic_error,
820  "Belos::MinresSolMgr::solve(): The implicit convergence test's getTestValue() "
821  "method returned a vector of length zero. Please report this bug to the "
822  "Belos developers.");
823 
824  // FIXME (mfh 12 Dec 2011) Does pTestValues really contain the
825  // achieved tolerances for all vectors in the current solve(), or
826  // just for the vectors from the last deflation?
827  achievedTol_ = *std::max_element (pTestValues->begin(), pTestValues->end());
828  }
829 
830  if (notConverged.size() > 0) {
831  return Unconverged;
832  } else {
833  return Converged;
834  }
835  }
836 
837  // This method requires the solver manager to return a std::string that describes itself.
838  template<class ScalarType, class MV, class OP>
840  {
841  std::ostringstream oss;
842  oss << "Belos::MinresSolMgr< "
844  <<", MV, OP >";
845  // oss << "{";
846  // oss << "Block Size=" << blockSize_;
847  // oss << "}";
848  return oss.str();
849  }
850 
851 } // end Belos namespace
852 
853 #endif /* BELOS_MINRES_SOLMGR_HPP */
Collection of types and exceptions used within the Belos solvers.
Belos&#39;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.
Teuchos::Array< Teuchos::RCP< Teuchos::Time > > getTimers() const
Return all timers for this object.
virtual ~MinresSolMgr()
Destructor.
MINRES implementation.
static void clearCounter(const std::string &name)
static RCP< Time > getNewCounter(const std::string &name)
bool is_null(const std::shared_ptr< T > &p)
int getNumIters() const override
Get the iteration count for the most recent call to solve().
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
A factory class for generating StatusTestOutput objects.
static Teuchos::RCP< const Teuchos::ParameterList > defaultParameters()
List of valid MINRES parameters and their default values.
An implementation of StatusTestResNorm using a family of residual norms.
Belos::StatusTest class for specifying a maximum number of iterations.
static std::string name()
A factory class for generating StatusTestOutput objects.
Teuchos::RCP< SolverManager< ScalarType, MV, OP > > clone() const override
clone for Inverted Injection (DII)
Traits class which defines basic operations on multivectors.
Belos::StatusTest for logically combining several status tests.
const LinearProblem< ScalarType, MV, OP > & getProblem() const override
Return the linear problem to be solved.
MinresSolMgrLinearProblemFailure(const std::string &what_arg)
A Belos::StatusTest class for specifying a maximum number of iterations.
ResetType
How to reset the solver.
Definition: BelosTypes.hpp:206
MagnitudeType achievedTol() const override
Tolerance achieved by the last solve() invocation.
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.
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. ...
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)
MINRES linear solver solution manager.
MINRES iteration implementation.
std::string description() const override
A linear system to solve, and its associated information.
Class which describes the linear problem to be solved by the iterative solver.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Return the list of default parameters for this object.
Structure to contain pointers to MinresIteration state variables.
void validateParametersAndSetDefaults(ParameterList const &validParamList, int const depth=1000)
ReturnType
Whether the Belos solve converged for all linear systems.
Definition: BelosTypes.hpp:155
The Belos::SolverManager is a templated virtual base class that defines the basic interface that any ...
Teuchos::RCP< const Teuchos::ParameterList > getCurrentParameters() const override
Return the list of current parameters for this object.
void reset(const ResetType type) override
Reset the solver manager.
void setProblem(const Teuchos::RCP< LinearProblem< ScalarType, MV, OP > > &problem) override
Set the linear problem that needs to be solved.
Teuchos::RCP< const MV > Y
The current residual.
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.
A class for extending the status testing capabilities of Belos via logical combinations.
MinresSolMgr()
Default constructor.
Class which defines basic traits for the operator type.
Parent class to all Belos exceptions.
Definition: BelosTypes.hpp:60
Belos header file which uses auto-configuration information to include necessary C++ headers...
ReturnType solve() override
Iterate until the status test tells us to stop.
bool isLOADetected() const override
Whether a loss of accuracy was detected in the solver.
bool is_null() const

Generated on Fri Aug 14 2020 10:48:33 for Belos by doxygen 1.8.5