gko::matrix::Identity#
Identity LinOp. apply(b, x) copies b into x without allocating
explicit storage for the identity matrix itself. Used as a no-op
preconditioner placeholder and in the SpGEAM path (A->apply(alpha, I, beta, B) computes B = alpha * A + beta * B).
-
template<typename ValueType = default_precision>
class Identity # Inherits from
public gko::EnableLinOp<Identity<default_precision>>
public gko::Transposable
This class is a utility which efficiently implements the identity matrix (a linear operator which maps each vector to itself).
Thus, objects of the Identity class always represent a square matrix, and don’t require any storage for their values. The apply method is implemented as a simple copy (or a linear combination).
Note
This class is useful when composing it with other operators. For example, it can be used instead of a preconditioner in Krylov solvers, if one wants to run a “plain” solver, without using a preconditioner.
- Template Parameters:
ValueType – precision of matrix elements
Public Functions
-
virtual std::unique_ptr<LinOp> transpose() const override#
Returns a LinOp representing the transpose of the Transposable object.
- Returns:
a pointer to the new transposed object
-
virtual std::unique_ptr<LinOp> conj_transpose() const override#
Returns a LinOp representing the conjugate transpose of the Transposable object.
- Returns:
a pointer to the new conjugate transposed object