gko::preconditioner::NullspaceProjection#
Wraps a preconditioner \(M\) with projections onto the complement of a nullspace, computing \(z = P M Q r\). It applies \(M\), removes the right nullspace (\(P\)) from the result and, if a left nullspace is given, removes it (\(Q\)) from the input first.
Cg, Fcg, Minres, Gmres and Bicgstab create this wrapper around their
preconditioner automatically when a nullspace is set. It can also be built by hand and used as the
preconditioner of any solver (with a solver that does not handle the nullspace itself, project b and the initial guess by hand with Nullspace::project); the factory parameters are preconditioner,
generated_preconditioner, nullspace and left_nullspace. The system matrix
has to be square.
-
template<typename ValueType = default_precision>
class NullspaceProjection # Inherits from
public gko::LinOp
public gko::EnableCloneable<NullspaceProjection<default_precision>>
public gko::Transposable
NullspaceProjection wraps a preconditioner \( M \) with projections onto the complement of a nullspace, \( z = P M Q r \). \( P \) removes the nullspace from the preconditioned vector, which keeps the search directions of a Krylov solver, and thus its solution, orthogonal to the nullspace. The optional \( Q \) removes the left nullspace from the input. If both are the same nullspace, \( P M P \) is symmetric for a symmetric \( M \), which solvers like Minres need on ill-conditioned problems or when iterated past convergence.
Iterative solvers that support nullspaces (see solver::nullspace_traits) wrap their preconditioner in a NullspaceProjection when their
nullspaceparameter is set, unless it already is one removing the nullspace. It can also be used as the preconditioner of any solver directly; then the right-hand side and the initial guess need to be projected by the user, see solver::Nullspace::project.A constant-only nullspace is adapted to the size and value type of the system matrix, so the factory can be used for matrices of any size.
- Template Parameters:
ValueType – the value type of the vectors
Public Functions
- std::shared_ptr<const solver::Nullspace<ValueType>> get_nullspace(
- Returns:
the nullspace removed after the preconditioner, or nullptr if there is none
- std::shared_ptr<const solver::Nullspace<ValueType>> get_left_nullspace(
- Returns:
the left nullspace removed before the preconditioner, or nullptr if there is none
-
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
Public Static Functions
- static parameters_type parse(
- const config::pnode &config,
- const config::registry &context,
- const config::type_descriptor &td_for_child = config::make_type_descriptor<ValueType>(),
Create the parameters from the property_tree. Because this is directly tied to the specific type, the value type in the property tree is ignored. The nullspaces and the generated preconditioner are read from the registry.
- Parameters:
config – the property tree for setting
context – the registry
td_for_child – the type descriptor for children configs. The default uses the value type of this class.
- Returns:
parameters
-
struct parameters_type#
Public Members
-
std::shared_ptr<const LinOpFactory> preconditioner#
The preconditioner \( M \) to wrap. By default, the identity.
-
std::shared_ptr<const LinOp> generated_preconditioner#
Already generated preconditioner. If one is provided, the factory
preconditionerwill be ignored.
-
std::shared_ptr<const LinOp> nullspace#
The nullspace removed from the preconditioned vector, given as a solver::Nullspace<ValueType>. By default, none.
-
std::shared_ptr<const LinOp> left_nullspace#
The left nullspace removed from the input before the preconditioner, given as a solver::Nullspace<ValueType>. For symmetric problems, pass the same object as
nullspace. By default, none, so only the output is projected.
-
std::shared_ptr<const LinOpFactory> preconditioner#
See also
Singular systems and nullspaces: concept page.
gko::solver::Nullspace: the projector passed asnullspace.