Belos Version of the Day
Loading...
Searching...
No Matches
BelosGmresIteration.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Belos: Block Linear Solvers Package
4//
5// Copyright 2004-2016 NTESS and the Belos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef BELOS_GMRES_ITERATION_HPP
11#define BELOS_GMRES_ITERATION_HPP
12
16
17#include "BelosConfigDefs.hpp"
18#include "BelosTypes.hpp"
19#include "BelosIteration.hpp"
20
21namespace Belos {
22
24
25
30 template <class ScalarType, class MV, class DM = DefaultDenseMatrix<int,ScalarType>>
36 int curDim;
37
39 Teuchos::RCP<const MV> V;
40
42 Teuchos::RCP<const MV> Z;
43
49
50 Teuchos::RCP<const DM> H;
52
53 Teuchos::RCP<const DM> R;
55
56 Teuchos::RCP<const DM> z;
57
58
59 GmresIterationState() : curDim(0), V(Teuchos::null), Z(Teuchos::null),
60 H(Teuchos::null), R(Teuchos::null),
61 z(Teuchos::null)
62 {}
63 };
64
66
67
72 template <class ScalarType, class MV, class DM = DefaultDenseMatrix<int,ScalarType>>
74
75 typedef Teuchos::ScalarTraits<ScalarType> SCT;
76 typedef typename SCT::magnitudeType MagnitudeType;
77
82 int curDim;
84 std::vector<Teuchos::RCP<const MV> > V;
90 std::vector<Teuchos::RCP<const DM> > H;
92 std::vector<Teuchos::RCP<const DM> > R;
94 std::vector<Teuchos::RCP<const DM> > Z;
96 std::vector<Teuchos::RCP<const std::vector<ScalarType> > > sn;
97 std::vector<Teuchos::RCP<const std::vector<MagnitudeType> > > cs;
98
100 H(0), R(0), Z(0),
101 sn(0), cs(0)
102 {}
103 };
104
106
108
109
121 class GmresIterationInitFailure : public BelosError {public:
122 GmresIterationInitFailure(const std::string& what_arg) : BelosError(what_arg)
123 {}};
124
132 GmresIterationOrthoFailure(const std::string& what_arg) : BelosError(what_arg)
133 {}};
134
142 GmresIterationLAPACKFailure(const std::string& what_arg) : BelosError(what_arg)
143 {}};
144
146
148
149
157 PseudoBlockGmresIterOrthoFailure(const std::string& what_arg) : BelosError(what_arg)
158 {}};
159
161
162template<class ScalarType, class MV, class OP, class DM = DefaultDenseMatrix<int,ScalarType>>
163class GmresIteration : virtual public Iteration<ScalarType,MV,OP,DM> {
164
165 public:
166
168
169
184
193
195
196
198
201 virtual void updateLSQR( int dim = -1 ) = 0;
202
204 virtual int getCurSubspaceDim() const = 0;
205
207 virtual int getMaxSubspaceDim() const = 0;
208
210
212
213
220 virtual void setSize(int blockSize, int numBlocks) = 0;
221
223
224};
225
226} // end Belos namespace
227
228#endif /* BELOS_GMRES_ITERATION_HPP */
Belos header file which uses auto-configuration information to include necessary C++ headers.
Pure virtual base class which describes the basic interface to the linear solver iteration.
Collection of types and exceptions used within the Belos solvers.
BelosError(const std::string &what_arg)
virtual int getCurSubspaceDim() const =0
Get the dimension of the search subspace used to generate the current solution to the linear problem.
virtual GmresIterationState< ScalarType, MV, DM > getState() const =0
Get the current state of the linear solver.
virtual void updateLSQR(int dim=-1)=0
Method for updating QR factorization of upper Hessenberg matrix.
virtual void setSize(int blockSize, int numBlocks)=0
Set the blocksize and number of blocks to be used by the iterative solver in solving this linear prob...
virtual void initializeGmres(GmresIterationState< ScalarType, MV, DM > &newstate)=0
Initialize the solver to an iterate, providing a complete state.
virtual int getMaxSubspaceDim() const =0
Get the maximum dimension allocated for the search subspace.
GmresIterationInitFailure(const std::string &what_arg)
GmresIterationLAPACKFailure(const std::string &what_arg)
GmresIterationOrthoFailure(const std::string &what_arg)
Iteration()
Default Constructor.
PseudoBlockGmresIterOrthoFailure(const std::string &what_arg)
Structure to contain pointers to GmresIteration state variables.
Teuchos::RCP< const MV > Z
The current preconditioned Krylov basis (only used in flexible GMRES).
Teuchos::RCP< const DM > z
The current right-hand side of the least squares system RY = Z.
Teuchos::RCP< const DM > R
The current upper-triangular matrix from the QR reduction of H.
Teuchos::RCP< const DM > H
The current Hessenberg matrix.
int curDim
The current dimension of the reduction.
Teuchos::RCP< const MV > V
The current Krylov basis.
int curDim
The current dimension of the reduction.
std::vector< Teuchos::RCP< const std::vector< ScalarType > > > sn
The current Given's rotation coefficients.
std::vector< Teuchos::RCP< const DM > > R
The current upper-triangular matrix from the QR reduction of H.
std::vector< Teuchos::RCP< const DM > > Z
The current right-hand side of the least squares system RY = Z.
Teuchos::ScalarTraits< ScalarType > SCT
std::vector< Teuchos::RCP< const DM > > H
The current Hessenberg matrix.
std::vector< Teuchos::RCP< const std::vector< MagnitudeType > > > cs
std::vector< Teuchos::RCP< const MV > > V
The current Krylov basis.

Generated for Belos by doxygen 1.15.0