15 #ifndef ALLIUM_LA_ITERATIVE_SOLVER_HPP
16 #define ALLIUM_LA_ITERATIVE_SOLVER_HPP
18 #include <allium/util/numeric.hpp>
19 #include "vector_storage.hpp"
20 #include "linear_solver.hpp"
21 #include "linear_operator.hpp"
36 real_part_t<N> tolerance() {
return m_tol; }
37 void tolerance(real_part_t<N> t) { m_tol = t; }
48 template <
typename Base,
typename V>
56 using Number =
typename Vector::Number;
59 void setup(std::shared_ptr<Matrix> mat)
override {
63 void solve(V& solution,
66 Base::solve(solution, rhs, initial_guess);
70 std::shared_ptr<Matrix> m_mat;
74 ALLIUM_NO_NONNULL_WARNING
75 allium_assert(
dynamic_cast<const V*
>(&in) !=
nullptr);
76 allium_assert(
dynamic_cast<V*
>(&out) !=
nullptr);
77 ALLIUM_RESTORE_WARNING
79 m_mat->apply(
static_cast<V&
>(out),
80 static_cast<const V&
>(in));
Base class for iterative solvers.
Definition: iterative_solver.hpp:29
Mixin for iterative solvers, which implements the apply_matrix method.
Definition: iterative_solver.hpp:52
Linear operator for the use in iterative linear solvers.
Definition: linear_operator.hpp:29
Linear solver interface.
Definition: linear_solver.hpp:42
Abstract base class for any vector storage.
Definition: vector_storage.hpp:41
InitialGuess
Behavior for the initial guess.
Definition: linear_solver.hpp:32
@ NOT_PROVIDED
Initialize with zero.