gmres_solve#
- iskra.sparse_linalg.gmres_solve(f: Callable[[Tensor], Tensor], b: Tensor, init: Tensor, max_iter: int, abs_tol: float, rel_tol: float, preconditioner: Callable[[Tensor], Tensor] | None = None, verbose: bool = False) Tensor[SOURCE]#
Matrix-free GMRES solver for J^T u = b.
- Parameters:
f (Callable[[
Tensor],Tensor]) – Function which computes J^T @ z (e.g., a vector-Jacobian product).b (
Tensor) – Right-hand side of linear system, same shape as u.init (
Tensor) – Initial guess for u.max_iter (int) – Maximum number of iterations for the solver.
abs_tol (float) – Absolute tolerance the solver needs to reach before exiting.
rel_tol (float) – Relative tolerance the solver needs to reach before exiting.
preconditioner (Optional[Callable]) – Function representing M^-1. If provided, the solver solves the left-preconditioned system M^-1 A u = M^-1 b.
verbose (bool) – Whether to print logging information.
- Returns:
(
Tensor) – Solution to the linear system, u.