1
// *************************************************************************
3
// PARALUTION www.paralution.com
5
// Copyright (C) 2012-2013 Dimitar Lukarski
7
// This program is free software: you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation, either version 3 of the License, or
10
// (at your option) any later version.
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with this program. If not, see <http://www.gnu.org/licenses/>.
20
// *************************************************************************
22
#ifndef PARALUTION_GMRES_GMRES_HPP_
23
#define PARALUTION_GMRES_GMRES_HPP_
25
#include "../solver.hpp"
29
namespace paralution {
32
template <class OperatorType, class VectorType, typename ValueType>
33
class GMRES : public IterativeLinearSolver<OperatorType, VectorType, ValueType> {
40
virtual void Print(void) const;
42
virtual void Build(void);
43
virtual void Clear(void);
45
/// Set the size of the Krylov-space basis
46
virtual void SetBasisSize(const int size_basis);
50
virtual void SolveNonPrecond_(const VectorType &rhs,
52
virtual void SolvePrecond_(const VectorType &rhs,
55
virtual void PrintStart_(void) const;
56
virtual void PrintEnd_(void) const;
58
virtual void MoveToHostLocalData_(void);
59
virtual void MoveToAcceleratorLocalData_(void);
61
void ApplyGivensRotation_(const ValueType &c, const ValueType &s,
62
ValueType &x, ValueType &y) const;
64
void BackSubstitute_(std::vector<ValueType> &g,
65
const std::vector<ValueType> &H,
80
#endif // PARALUTION_GMRES_GMRES_HPP_