gmresFabric.hh

Go to the documentation of this file.
1 
6 #ifndef GMResfabric_hh
7 #define GMResfabric_hh
8 
9 #if __GNUC__ == 2
10 # include <float.h>
11 # define EPS DBL_EPSILON
12 #else
13 # include <limits>
14 # define EPS std::numeric_limits<double>::epsilon()
15 #endif
16 #include "operator/gmres.hh"
17 #include "operator/solverFabric.hh"
18 
19 namespace concepts {
20 
21  // *********************************************************** GMResFabric **
22 
26  template<typename F>
27  class GMResFabric : public SolverFabric<F> {
28  public:
35  GMResFabric(Real maxeps = EPS,
36  int maxit = 0, uint rs = 0, uint relres = 0)
37  : maxeps_(maxeps), maxit_(maxit), rs_(rs), relres_(relres) {}
38  virtual Operator<F>* operator()(Operator<F>& matrix) {
39  return new GMRes<F>(matrix, maxeps_, maxit_, rs_, relres_);
40  }
41  protected:
42  virtual std::ostream& info(std::ostream& os) const {
43  return os << "GMResFabric(maxeps = " << maxeps_ << ", maxit = "
44  << maxit_ << ", rs = " << rs_ << ", relres = "
45  << relres_ << ")";
46  }
47  private:
51  int maxit_;
53  uint rs_;
55  uint relres_;
56  };
57 
58 } // concepts
59 
60 #endif // GMResfabric_hh
uint relres_
relres = 0: absolute residual, relres = 1: relative residual
Definition: gmresFabric.hh:55
Real maxeps_
Convergence criteria for the solver.
Definition: gmresFabric.hh:49
int maxit_
Convergence criteria for the solver.
Definition: gmresFabric.hh:51
GMResFabric(Real maxeps=EPS, int maxit=0, uint rs=0, uint relres=0)
Constructor.
Definition: gmresFabric.hh:35
virtual std::ostream & info(std::ostream &os) const
Definition: gmresFabric.hh:42
Abstract fabric class for linear solvers.
Definition: jdbsym.hh:16
Abstract class for an operator.
Definition: ARPACK.hh:16
#define EPS
Definition: gmresFabric.hh:14
Fabric class for generalized minimal residual: GMRes.
Definition: gmresFabric.hh:27
virtual Operator< F > * operator()(Operator< F > &matrix)
Definition: gmresFabric.hh:38
Solves a system of linear equations with general minimal residuals (GMRes).
Definition: gmres.hh:24
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich