template<typename V, typename M>
class amrex::GMRES< V, M >
GMRES.
This class implements the GMRES algorithm. The template parameter V is for a linear algebra vector class. For example, it could be amrex::MultiFab. The other template parameter M is for a linear operator class with a number of required member functions. Note that conceptually M contains a matrix. However, it does not mean it needs to have a member variable storing the matrix, because GMRES only needs the matrix vector product, not the matrix itself.
- Template Parameters
-
V | linear algebra vector. It must be default constructible, move constructible, and move assignable. |
M | linear operator. A list of required member functions for M is shown below. Here RT (typename V::value_type) is either double or float.
- void apply(V& lhs, V const& rhs)
lhs = L(rhs), where L is the linear operator performing matrix vector product.
- void assign(V& lhs, V const& rhs)
lhs = rhs.
- RT dotProduct(V const& v1, V const& v2)
returns v1 * v2.
- void increment(V& lhs, V const& rhs, RT a)
lhs += a * rhs.
- void linComb(V& lhs, RT a, V const& rhs_a, RT b, V const& rhs_b)
lhs = a * rhs_a + b * rhs_b.
- V makeVecRHS()
returns a V object that is suitable as RHS in M x = b. The reason we distinguish between LHS and RHS is M might need the distinction for efficiency. For example, if V is MultiFab, we might need the x in the LHS of M x = b to have ghost cells for efficiency, whereas no ghost cells are needed for the RHS (i.e., b).
- V makeVecLHS()
returns a V object that is suitable as LHS in M x = b. See the description for makeVecRHS for more details.
- RT norm2(V const& v)
returns the 2-norm of v.
- void precond(V& lhs, V const& rhs)
applies preconditioner to rhs. If there is no preconditioner, this function should do lhs = rhs.
- void setToZero(V& v)
v = 0.
|