Class documentation of Concepts

Loading...
Searching...
No Matches
gmres.hh
Go to the documentation of this file.
1
6#ifndef gmres_hh
7#define gmres_hh
8
9#include <string>
10
12#include "basics/typedefs.hh"
13#include "compositions.hh"
14
15namespace concepts {
16
17 // ***************************************************************** GMRes **
18
23 template<class F>
24 class GMRes : public VecOperator<F> {
25 public:
34 GMRes(Operator<F>& A, Real maxeps, int maxit = 0, uint rs = 0,
35 uint relres = 0, Operator<F>* W = 0)
36 : VecOperator<F>(A.dimY(), A.dimX()), W_(W), A_(A), maxeps_(maxeps), maxit_(maxit)
37 , eps_(1.0), it_(0), rs_(rs ? rs : maxit), relres_(relres) {}
38 virtual ~GMRes();
39
43 uint iterations() const { return it_; }
44
48 Real epsilon() const { return eps_; }
49 protected:
50 virtual std::ostream& info(std::ostream& os) const;
51 private:
52 struct R {
53 R* right;
54 R* left;
55 Vector<F>* v;
56 F sin;
57 Real cos;
58 F* h;
59
60 R(uint szh, R* lnk = 0) : right(0), v(0) {
61 if ((left = lnk)) lnk->right = this;
62 h = szh ? new F[szh] : 0;
63 std::memset(h, 0, szh * sizeof(F));
64 }
65 ~R() { delete v; delete[] h;}
66 };
67
69 Operator<F>* W_;
71 Operator<F>& A_;
72
74 Real maxeps_;
76 uint maxit_;
78 Real eps_;
80 uint it_;
82 uint rs_;
84 uint relres_;
85
86 virtual void apply_(const Vector<F>& fncY, Vector<F>& fncX);
87 virtual void apply_();
88 };
89
90} // namespace concepts
91
92#endif // gmres_hh
Real epsilon() const
Definition gmres.hh:48
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
uint iterations() const
Definition gmres.hh:43
GMRes(Operator< F > &A, Real maxeps, int maxit=0, uint rs=0, uint relres=0, Operator< F > *W=0)
Definition gmres.hh:34
virtual const uint dimY() const
virtual const uint dimX() const
double Real
Definition typedefs.hh:39
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320