numerics
0.1.0
Loading...
Searching...
No Matches
jacobi.hpp
Go to the documentation of this file.
1
/// @file jacobi.hpp
2
/// @brief Jacobi iterative solver
3
#pragma once
4
#include "
core/matrix.hpp
"
5
#include "
core/policy.hpp
"
6
#include "
core/vector.hpp
"
7
#include "
linalg/solvers/solver_result.hpp
"
8
9
namespace
num
{
10
11
/// @brief Jacobi iterative solver for Ax = b
12
///
13
/// Updates all components simultaneously using only values from the previous
14
/// iteration. Converges for strictly diagonally dominant A. Trivially
15
/// parallelisable with Backend::omp.
16
///
17
/// @param A Square matrix
18
/// @param b Right-hand side vector
19
/// @param x Solution vector (initial guess on input, solution on output)
20
/// @param tol Convergence tolerance on residual norm (default 1e-10)
21
/// @param max_iter Maximum iterations (default 1000)
22
/// @param backend Execution backend (default: default_backend)
23
/// @return SolverResult with convergence info
24
SolverResult
jacobi
(
const
Matrix &A,
const
Vector
&b,
Vector
&x,
25
real
tol = 1
e
-10,
idx
max_iter = 1000,
26
Backend
backend =
default_backend
);
27
28
}
// namespace num
policy.hpp
Backend enum for linear algebra operations.
matrix.hpp
Matrix operations.
num
Definition
quadrature.hpp:8
num::real
double real
Definition
types.hpp:10
num::Backend
Backend
Selects which backend handles a linalg operation.
Definition
policy.hpp:19
num::idx
std::size_t idx
Definition
types.hpp:11
num::e
constexpr real e
Definition
math.hpp:43
num::Vector
BasicVector< real > Vector
Real-valued dense vector with full backend dispatch (CPU + GPU)
Definition
vector.hpp:130
num::jacobi
SolverResult jacobi(const Matrix &A, const Vector &b, Vector &x, real tol=1e-10, idx max_iter=1000, Backend backend=default_backend)
Jacobi iterative solver for Ax = b.
Definition
jacobi.cpp:7
num::default_backend
constexpr Backend default_backend
Definition
policy.hpp:92
solver_result.hpp
Common result type shared by all iterative solvers.
vector.hpp
Vector operations.
include
linalg
solvers
jacobi.hpp
Generated by
1.9.8