ROL
ROL_Krylov.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Rapid Optimization Library (ROL) Package
4//
5// Copyright 2014 NTESS and the ROL contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef ROL_KRYLOV_H
11#define ROL_KRYLOV_H
12
17#include "ROL_Vector.hpp"
19#include "ROL_ParameterList.hpp"
20
21namespace ROL {
22
23template<class Real>
24class Krylov {
25
26 Real absTol_; // Absolute residual tolerance
27 Real relTol_; // Relative residual tolerance
28 unsigned maxit_; // Maximum number of iterations
29
30public:
31 virtual ~Krylov(void) {}
32
33 Krylov( Real absTol = 1.e-4, Real relTol = 1.e-2, unsigned maxit = 100 )
34 : absTol_(absTol), relTol_(relTol), maxit_(maxit) {}
35
36 Krylov( ROL::ParameterList &parlist ) {
37 ROL::ParameterList &krylovList = parlist.sublist("General").sublist("Krylov");
38 absTol_ = krylovList.get("Absolute Tolerance", 1.e-4);
39 relTol_ = krylovList.get("Relative Tolerance", 1.e-2);
40 maxit_ = krylovList.get("Iteration Limit", 100);
41 }
42
43 // Run Krylov Method
46 int &iter, int &flag ) = 0;
47
48 void resetAbsoluteTolerance(const Real absTol) {
49 absTol_ = absTol;
50 }
51 void resetRelativeTolerance(const Real relTol) {
52 relTol_ = relTol;
53 }
54 void resetMaximumIteration(const unsigned maxit) {
55 maxit_ = maxit;
56 }
57 Real getAbsoluteTolerance(void) const {
58 return absTol_;
59 }
60 Real getRelativeTolerance(void) const {
61 return relTol_;
62 }
63 unsigned getMaximumIteration(void) const {
64 return maxit_;
65 }
66};
67
68}
69
70#endif
Provides definitions for Krylov solvers.
unsigned getMaximumIteration(void) const
unsigned maxit_
Krylov(ROL::ParameterList &parlist)
virtual Real run(Vector< Real > &x, LinearOperator< Real > &A, const Vector< Real > &b, LinearOperator< Real > &M, int &iter, int &flag)=0
virtual ~Krylov(void)
void resetMaximumIteration(const unsigned maxit)
Krylov(Real absTol=1.e-4, Real relTol=1.e-2, unsigned maxit=100)
Real getAbsoluteTolerance(void) const
void resetRelativeTolerance(const Real relTol)
Real getRelativeTolerance(void) const
void resetAbsoluteTolerance(const Real absTol)
Provides the interface to apply a linear operator.
Defines the linear algebra or vector space interface.