PARALUTION  1.0.0
PARALUTION
dpcg.hpp
Go to the documentation of this file.
1 // *************************************************************************
2 //
3 // This code is developed and maintained by TU Delft.
4 // The deflation solver (files src/solvers/deflation/dpcg.hpp and
5 // src/solvers/deflation/dpcg.cpp) are released under GNU LESSER GENERAL
6 // PUBLIC LICENSE (LGPL v3)
7 //
8 // Copyright (C) 2013 Kees Vuik (TU Delft)
9 // Delft University of Technology, the Netherlands
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU Lesser General Public License as
13 // published by the Free Software Foundation, either version 3 of the
14 // License, or (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU Lesser General Public
22 // License along with this program.
23 // If not, see <http://www.gnu.org/licenses/>.
24 //
25 // *************************************************************************
26 
27 #ifndef PARALUTION_DEFLATION_DPCG_HPP_
28 #define PARALUTION_DEFLATION_DPCG_HPP_
29 
30 #include "../solver.hpp"
31 
32 namespace paralution {
33 
34 template <class OperatorType, class VectorType, typename ValueType>
35 class DPCG : public IterativeLinearSolver<OperatorType, VectorType, ValueType> {
36 
37 public:
38 
39  DPCG();
40  virtual ~DPCG();
41 
42  virtual void Print(void) const;
43 
44  virtual void Build(void);
45  virtual void Clear(void);
46 
47  virtual void SetNVectors(const int novecni);
48 
49 protected:
50  virtual void SolveNonPrecond_(const VectorType &rhs,
51  VectorType *x);
52 
53  virtual void SolvePrecond_(const VectorType &rhs,
54  VectorType *x);
55 
56  virtual void PrintStart_(void) const;
57  virtual void PrintEnd_(void) const;
58 
59  virtual void MoveToHostLocalData_(void);
60  virtual void MoveToAcceleratorLocalData_(void);
61 
62 private:
63 
64  void MakeZ_COO(void);
65  void MakeZ_CSR(void);
66 
67  OperatorType L_, LT_;
68  OperatorType AZ_, ZT_;
69  OperatorType Z_, AZT_;
70  OperatorType E_;
71 
72  VectorType r_, w_;
73  VectorType p_, q_;
74 
75  VectorType Dinv_;
76  VectorType hat_, intmed_;
77  VectorType Qb_, Ptx_;
78  VectorType LLtx_, LLtx2_;
79 
80  int novecni_;
81 };
82 
83 
84 }
85 
86 #endif // PARALUTION_DEFLATION_DPCG_HPP_
87 
OperatorType ZT_
Definition: dpcg.hpp:68
void MakeZ_CSR(void)
Definition: dpcg.cpp:170
VectorType Qb_
Definition: dpcg.hpp:77
OperatorType L_
Definition: dpcg.hpp:67
VectorType r_
Definition: dpcg.hpp:72
OperatorType Z_
Definition: dpcg.hpp:69
VectorType p_
Definition: dpcg.hpp:73
virtual void PrintEnd_(void) const
Print ending msg of the solver.
Definition: dpcg.cpp:98
OperatorType AZ_
Definition: dpcg.hpp:68
VectorType intmed_
Definition: dpcg.hpp:76
DPCG()
Definition: dpcg.cpp:44
Definition: dpcg.hpp:35
virtual void MoveToHostLocalData_(void)
Move all local data to the host.
Definition: dpcg.cpp:358
Base class for all linear (iterative) solvers.
Definition: solver.hpp:94
int novecni_
Definition: dpcg.hpp:80
virtual void Print(void) const
Print information about the solver.
Definition: dpcg.cpp:64
VectorType Ptx_
Definition: dpcg.hpp:77
virtual ~DPCG()
Definition: dpcg.cpp:54
virtual void Clear(void)
Clear (free all local data) the solver.
Definition: dpcg.cpp:321
VectorType w_
Definition: dpcg.hpp:72
Definition: backend_manager.cpp:43
VectorType Dinv_
Definition: dpcg.hpp:75
OperatorType LT_
Definition: dpcg.hpp:67
VectorType q_
Definition: dpcg.hpp:73
virtual void MoveToAcceleratorLocalData_(void)
Move all local data to the accelerator.
Definition: dpcg.cpp:391
const IndexType const IndexType const IndexType const ValueType const ValueType const ValueType * x
Definition: cuda_kernels_coo.hpp:91
virtual void SolveNonPrecond_(const VectorType &rhs, VectorType *x)
Non-preconditioner solution procedure.
Definition: dpcg.cpp:426
virtual void Build(void)
Build the solver (data allocation, structure computation, numerical computation)
Definition: dpcg.cpp:224
virtual void SetNVectors(const int novecni)
Definition: dpcg.cpp:113
void MakeZ_COO(void)
Definition: dpcg.cpp:124
virtual void PrintStart_(void) const
Print starting msg of the solver.
Definition: dpcg.cpp:82
VectorType hat_
Definition: dpcg.hpp:76
VectorType LLtx2_
Definition: dpcg.hpp:78
OperatorType E_
Definition: dpcg.hpp:70
virtual void SolvePrecond_(const VectorType &rhs, VectorType *x)
Preconditioned solution procedure.
Definition: dpcg.cpp:612
VectorType LLtx_
Definition: dpcg.hpp:78
OperatorType AZT_
Definition: dpcg.hpp:69