Class documentation of Concepts

Loading...
Searching...
No Matches
bicgstab.hh
Go to the documentation of this file.
1
6#ifndef bicgstab_hh
7#define bicgstab_hh
8
9#include <string>
10#include "basics/typedefs.hh"
11#include "toolbox/sequence.hh"
12#include "compositions.hh"
13
14namespace concepts {
15
16 // ******************************************************************* CG **
17
33 template<class F, class G = F>
34 class BiCGStab : public VecOperator<F> {
35 public:
45 uint relres = false, bool throwing = true)
46 : VecOperator<F>(A.dimY(), A.dimX()), W_(0), A_(A), M_(0)
47 , maxeps_(maxeps), maxit_(maxit), eps_(1.0), it_(0)
48 , relres_(relres), throwing_(throwing), stag_(false) {}
49
62 bool relres = 0, bool throwing = true, Operator<G>* M = 0)
63 : VecOperator<F>(A.dimY(), A.dimX()), W_(&Minv), A_(A), M_(M)
64 , maxeps_(maxeps), maxit_(maxit), eps_(1.0), it_(0)
65 , relres_(relres), throwing_(throwing), stag_(false) {}
66
67// virtual void operator()(const Function<F,G>& fncY, Function<F,G>& fncX);
68// void operator()(const Vector<F,G>& fncY, Vector<F,G>& fncX);
69
73 uint iterations() const { return it_; }
74
78 Real epsilon() const { return eps_; }
80 bool stagnated() const { return stag_; }
81 protected:
82 std::ostream& info(std::ostream& os) const;
83 private:
85 Operator<G>* W_;
87 Operator<F>& A_;
89 Operator<G>* M_;
90
92 Real maxeps_;
94 uint maxit_;
96 Real eps_;
100 uint it_;
102 bool relres_;
106 bool throwing_;
108 bool stag_;
109
110 virtual void apply_();
111 virtual void apply_(const Vector<F>& fncY, Vector<F>& fncX);
112
116 template<class I>
117 bool scalarTooSmall_(I& scalar, const std::string name, const uint& it,
118 const Real& eps, const Real& maxeps) const;
122 bool converged_(const Vector<F>& fncY, Vector<F>& fncX,
123 const Vector<F>& x, const uint& it, Real& eps,
124 const Real& maxeps, const Real& l2Y);
125 bool stagnated_(const Vector<F>& x, const Vector<F>& s_p,
126 F& alpha_omega);
127 };
128
129} // namespace concepts
130
131#endif // bicgstab_hh
BiCGStab(Operator< F > &A, Operator< G > &Minv, Real maxeps, int maxit=0, bool relres=0, bool throwing=true, Operator< G > *M=0)
Definition bicgstab.hh:61
bool stagnated() const
Return true, if solver stagnated.
Definition bicgstab.hh:80
Real epsilon() const
Definition bicgstab.hh:78
uint iterations() const
Definition bicgstab.hh:73
BiCGStab(Operator< F > &A, Real maxeps, int maxit=0, uint relres=false, bool throwing=true)
Definition bicgstab.hh:44
std::ostream & info(std::ostream &os) const
Returns information in an output stream.
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