Loading...
Searching...
No Matches
identity_solver.hpp
Go to the documentation of this file.
1#pragma once
2
6
8
9/// @brief "Identity solver" for linear systems.
10///
11/// Implements a "no-op" solve operation by directly assigning
12/// the right-hand side to the solution vector: \f$ x \gets b \f$.
13/// Satisfies the SolverLike concept (see solver.hpp).
14/// Can be used as a placeholder for "no preconditioner".
15///
16/// OperatorT is essentially ignored (does not need to be the identity operator).
17///
18/// @tparam OperatorT Operator type (must satisfy OperatorLike).
19template < OperatorLike OperatorT >
21{
22 public:
23 /// @brief Operator type to be solved.
24 using OperatorType = OperatorT;
25 /// @brief Solution vector type.
27 /// @brief Right-hand side vector type.
29
30 /// @brief Solve the linear system by assigning the right-hand side to the solution.
31 /// Implements \f$ x = b \f$.
32 /// @param A Operator (matrix), unused.
33 /// @param x Solution vector (output).
34 /// @param b Right-hand side vector (input).
36 {
37 assign( x, b );
38 (void) A;
39 }
40};
41
42/// @brief Static assertion: IdentitySolver satisfies SolverLike concept.
43static_assert( SolverLike< IdentitySolver< linalg::detail::DummyOperator<
46
47} // namespace terra::linalg::solvers
Dummy operator for testing concepts. Implements apply_impl as a no-op.
Definition operator.hpp:167
Dummy vector class for concept checks and testing. Implements required vector operations as no-ops.
Definition vector.hpp:210
"Identity solver" for linear systems.
Definition identity_solver.hpp:21
DstOf< OperatorType > RHSVectorType
Right-hand side vector type.
Definition identity_solver.hpp:28
void solve_impl(OperatorType &A, SolutionVectorType &x, const RHSVectorType &b)
Solve the linear system by assigning the right-hand side to the solution. Implements .
Definition identity_solver.hpp:35
OperatorT OperatorType
Operator type to be solved.
Definition identity_solver.hpp:24
SrcOf< OperatorType > SolutionVectorType
Solution vector type.
Definition identity_solver.hpp:26
Definition block_preconditioner_2x2.hpp:7
Operator::SrcVectorType SrcOf
Alias for the source vector type of an operator.
Definition operator.hpp:145
Operator::DstVectorType DstOf
Alias for the destination vector type of an operator.
Definition operator.hpp:149
void assign(Vector &y, const ScalarOf< Vector > &c0)
Assign a scalar value to a vector. Implements: .
Definition vector.hpp:97