16template < OperatorLike OperatorT >
40 : inverse_diagonal_( inverse_diagonal )
41 , iterations_( iterations )
53 for (
int iteration = 0; iteration < iterations_; ++iteration )
56 lincomb( tmp_, { 1.0, -1.0 }, { b, tmp_ } );
58 lincomb( x, { 1.0, omega_ }, { x, tmp_ } );
63 return inverse_diagonal_;
74static_assert( SolverLike< Jacobi< linalg::detail::DummyConcreteOperator > > );
Jacobi iterative solver for linear systems.
Definition jacobi.hpp:18
SolutionVectorType & get_inverse_diagonal()
Definition jacobi.hpp:62
Jacobi(const SolutionVectorType &inverse_diagonal, const int iterations, const SolutionVectorType &tmp, const ScalarType omega=1.0)
Construct a Jacobi solver.
Definition jacobi.hpp:35
SolutionVectorType::ScalarType ScalarType
Scalar type for computations.
Definition jacobi.hpp:28
DstOf< OperatorType > RHSVectorType
Right-hand side vector type.
Definition jacobi.hpp:25
SrcOf< OperatorType > SolutionVectorType
Solution vector type.
Definition jacobi.hpp:23
void solve_impl(OperatorType &A, SolutionVectorType &x, const RHSVectorType &b)
Solve the linear system using Jacobi iteration. Applies the update rule for the specified number of i...
Definition jacobi.hpp:51
OperatorT OperatorType
Operator type to be solved.
Definition jacobi.hpp:21
Definition block_preconditioner_2x2.hpp:7
void lincomb(Vector &y, const std::vector< ScalarOf< Vector > > &c, const std::vector< Vector > &x, const ScalarOf< Vector > &c0)
Compute a linear combination of vectors. Implements: .
Definition vector.hpp:72
Operator::SrcVectorType SrcOf
Alias for the source vector type of an operator.
Definition operator.hpp:145
void apply(LinearForm &L, typename LinearForm::DstVectorType &dst)
Apply a linear form and write to a destination vector.
Definition linear_form.hpp:37
Operator::DstVectorType DstOf
Alias for the destination vector type of an operator.
Definition operator.hpp:149
void scale_in_place(Vector &y, const Vector &x)
Scale a vector in place with another vector. For each entry , computes .
Definition vector.hpp:137