cg_solve#
- iskra.sparse_linalg.cg_solve(f: Callable[[Tensor], Tensor], b: Tensor, init: Tensor, maxiter: int, tol: float) Tensor[SOURCE]#
Matrix-free Conjugate Gradient solver for (I - J^T) u = b.
- Parameters:
f (Callable[[
Tensor],Tensor]) – Computes J^T @ z (vector-Jacobian product)b (
Tensor) – Right-hand side of linear system, same shape as u.init (
Tensor) – Initial guess for u.maxiter (int) – Maximum number of iterations for the solver.
tol (float) – Minimum tolerance the solver needs to reach before exiting.
- Returns:
(
Tensor) – Solution to the linear system (I - J^T) u = b.