Skip to content

num::jacobi

Defined in header <linear/solvers/jacobi.hpp>

template <class Mat = with_law<mat<real>, law::diagonally_dominant>,
          bool Parallel = has_omp>
requires claims<Mat, law::diagonally_dominant>
solver_result jacobi(const Mat &A_in, const vec<real> &b, vec<real> &x,
                     real tol = 1e-10, idx max_iter = 1000);

Jacobi iterative solver for Ax = b.

Updates every component from the previous iterate, so both sweeps thread. It needs strictly diagonally dominant A: pass num::assume_diagonally_dominant(A).

Parameters

  • A_in: Square matrix claiming the law
  • b: Right-hand side vector
  • x: Solution vector (initial guess on input, solution on output)
  • tol: Convergence tolerance on residual norm (default 1e-10)
  • max_iter: Maximum iterations (default 1000)

Return value

solver_result with convergence info