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 gko::EnableAbstractPolymorphicObject<LinOp>

Subclassed by

  • gko::EnableAbstractPolymorphicObject< BlockOperator

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Combination< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Composition< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< ConcreteLinOp

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Perturbation< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Matrix< default_precision

  • int32

  • int64 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Vector< double >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Schwarz< default_precision

  • int32

  • int64 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Factorization< ValueType

  • IndexType >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< ScaledReordered< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Direct< ValueType

  • IndexType >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Composition< gko::default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Coo< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Csr< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Dense< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Diagonal< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Ell< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Fbcsr< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Fft

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Fft2

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Fft3

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Hybrid< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Identity< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Permutation< int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< RowGatherer< int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< ScaledPermutation< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Sellp< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< SparsityCsr< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< FixedCoarsening< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Pgm< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Ic< solver::LowerTrs<>

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Isai< IsaiType

  • ValueType

  • IndexType >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Jacobi< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Bicg< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Bicgstab< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< CbGmres< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Cg< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Cgs< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Chebyshev< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Fcg< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Gcr< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Gmres< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Idr< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Ir< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< LowerTrs< default_precision

  • int32 >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Minres< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< Multigrid

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< PipeCg< default_precision >

  • LinOp >

  • gko::EnableAbstractPolymorphicObject< UpperTrs< default_precision

  • int32 >

  • LinOp >

Public Functions

inline LinOp *apply(
ptr_param<const LinOp> b,
ptr_param<LinOp> x,
)#

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

Returns:

this

inline LinOp *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)

Returns:

this

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.

inline LinOp &operator=(LinOp &&other)#

Move-assigns a LinOp. Preserves the executor and moves the size. The moved-from object has size 0x0 afterwards, but its executor is unchanged.

LinOp(const LinOp&) = default#

Copy-constructs a LinOp. Inherits executor and size from the input.

inline LinOp(LinOp &&other)#

Move-constructs a LinOp. Inherits executor and size from the input, which will have size 0x0 and unchanged executor afterwards.