gko::LinOp#
Abstract base for every linear operator in Ginkgo. A LinOp exposes
the action \(x \leftarrow A b\) through apply(b, x) (and the scaled
form \(x \leftarrow \alpha A b + \beta x\) through the four-argument
overload). Everything that behaves like an operator — sparse and dense
matrices, factorisations, Krylov solvers, preconditioners, composed
operators — is a LinOp, so callers can treat them uniformly: feed any
of them to a Krylov solver as the system matrix, the preconditioner,
or both.
Concrete classes do not derive from LinOp directly. They use the
CRTP helper EnableLinOp, which supplies the
default copy/clone, the apply dispatcher, and the polymorphic-object
plumbing so the implementation only writes apply_impl.
-
class LinOp #
Inherits from
public EnableAbstractPolymorphicObject<LinOp>
Public Functions
- inline void apply( ) const#
Applies a linear operator to a vector (or a sequence of vectors).
Performs the operation x = op(b), where op is this linear operator.
- Parameters:
b – the input vector(s) on which the operator is applied
x – the output vector(s) where the result is stored
- inline void apply(
- ptr_param<const LinOp> alpha,
- ptr_param<const LinOp> b,
- ptr_param<const LinOp> beta,
- ptr_param<LinOp> x,
Performs the operation x = alpha * op(b) + beta * x.
- Parameters:
alpha – scaling of the result of op(b)
b – vector(s) on which the operator is applied
beta – scaling of the input x
x – output vector(s)
-
inline const dim<2> &get_size() const noexcept#
Returns the size of the operator.
- Returns:
size of the operator
-
inline virtual bool apply_uses_initial_guess() const#
Returns true if the linear operator uses the data given in x as an initial guess. Returns false otherwise.
- Returns:
true if the linear operator uses the data given in x as an initial guess. Returns false otherwise.
-
LinOp &operator=(const LinOp&) = default#
Copy-assigns a LinOp. Preserves the executor and copies the size.