PARALUTION  1.0.0
PARALUTION
gmres.hpp
Go to the documentation of this file.
1 #ifndef PARALUTION_GMRES_GMRES_HPP_
2 #define PARALUTION_GMRES_GMRES_HPP_
3 
4 #include "../solver.hpp"
5 
6 #include <vector>
7 
8 namespace paralution {
9 
10 template <class OperatorType, class VectorType, typename ValueType>
11 class GMRES : public IterativeLinearSolver<OperatorType, VectorType, ValueType> {
12 
13 public:
14 
15  GMRES();
16  virtual ~GMRES();
17 
18  virtual void Print(void) const;
19 
20  virtual void Build(void);
21  virtual void Clear(void);
22 
24  virtual void SetBasisSize(const int size_basis);
25 
26 protected:
27 
28  virtual void SolveNonPrecond_(const VectorType &rhs,
29  VectorType *x);
30  virtual void SolvePrecond_(const VectorType &rhs,
31  VectorType *x);
32 
33  virtual void PrintStart_(void) const;
34  virtual void PrintEnd_(void) const;
35 
36  virtual void MoveToHostLocalData_(void);
37  virtual void MoveToAcceleratorLocalData_(void);
38 
39  void GenerateGivensRotation_(const ValueType &x, const ValueType &y,
40  ValueType &c, ValueType &s) const;
41 
42  void ApplyGivensRotation_(const ValueType &c, const ValueType &s,
43  ValueType &x, ValueType &y) const;
44 
45  void BackSubstitute_(std::vector<ValueType> &g,
46  const std::vector<ValueType> &H,
47  int k) const;
48 
49 private:
50 
51  VectorType z_, w_;
52  VectorType **v_;
53 
55 
56 };
57 
58 
59 }
60 
61 #endif // PARALUTION_GMRES_GMRES_HPP_
VectorType w_
Definition: gmres.hpp:51
virtual ~GMRES()
Definition: gmres.cpp:28
void BackSubstitute_(std::vector< ValueType > &g, const std::vector< ValueType > &H, int k) const
Definition: gmres.cpp:679
int size_basis_
Definition: gmres.hpp:54
virtual void Clear(void)
Clear (free all local data) the solver.
Definition: gmres.cpp:131
virtual void SetBasisSize(const int size_basis)
Set the size of the Krylov-space basis.
Definition: gmres.cpp:205
virtual void PrintStart_(void) const
Print starting msg of the solver.
Definition: gmres.cpp:54
VectorType z_
Definition: gmres.hpp:51
Base class for all linear (iterative) solvers.
Definition: solver.hpp:94
Definition: gmres.hpp:11
const IndexType const IndexType const IndexType const ValueType const ValueType const ValueType ValueType * y
Definition: cuda_kernels_coo.hpp:91
virtual void PrintEnd_(void) const
Print ending msg of the solver.
Definition: gmres.cpp:70
virtual void SolvePrecond_(const VectorType &rhs, VectorType *x)
Preconditioned solution procedure.
Definition: gmres.cpp:419
virtual void Print(void) const
Print information about the solver.
Definition: gmres.cpp:38
virtual void MoveToHostLocalData_(void)
Move all local data to the host.
Definition: gmres.cpp:159
virtual void MoveToAcceleratorLocalData_(void)
Move all local data to the accelerator.
Definition: gmres.cpp:182
VectorType ** v_
Definition: gmres.hpp:52
Definition: backend_manager.cpp:43
GMRES()
Definition: gmres.cpp:18
const IndexType const IndexType const IndexType const ValueType const ValueType const ValueType * x
Definition: cuda_kernels_coo.hpp:91
virtual void Build(void)
Build the solver (data allocation, structure computation, numerical computation)
Definition: gmres.cpp:85
void ApplyGivensRotation_(const ValueType &c, const ValueType &s, ValueType &x, ValueType &y) const
Definition: gmres.cpp:669
virtual void SolveNonPrecond_(const VectorType &rhs, VectorType *x)
Non-preconditioner solution procedure.
Definition: gmres.cpp:219
void GenerateGivensRotation_(const ValueType &x, const ValueType &y, ValueType &c, ValueType &s) const
Definition: gmres.cpp:644