SRLazyGMRES(diag_shift=0.01, tol=1e-05, atol=0.0, maxiter=None, M=None, centered=True, restart=20, solve_method='batched')¶
Computes x = ⟨S⟩⁻¹⟨F⟩ by using an iterative GMRES method.
See Jax docs for more informations.
__init__(diag_shift=0.01, tol=1e-05, atol=0.0, maxiter=None, M=None, centered=True, restart=20, solve_method='batched')¶
Initialize self. See help(type(self)) for accurate signature.
M: Optional[Union[Callable, Any]] = None¶
Preconditioner for A. The preconditioner should approximate the inverse of A. Effective preconditioning dramatically improves the rate of convergence, which implies that fewer iterations are needed to reach a given error tolerance.
centered: bool = True¶
Uses S=⟨ΔÔᶜΔÔ⟩ if True (default), S=⟨ÔᶜΔÔ⟩ otherwise. The two forms are mathematically equivalent, but might lead to different results due to numerical precision. The non-centered variaant should bee approximately 33% faster.
maxiter: int = None¶
Maximum number of iterations. Iteration will stop after maxiter steps even if the specified tolerance has not been achieved.
restart: int = 20¶
Size of the Krylov subspace (“number of iterations”) built between restarts. GMRES works by approximating the true solution x as its projection into a Krylov space of this dimension - this parameter therefore bounds the maximum accuracy achievable from any guess solution. Larger values increase both number of iterations and iteration cost, but may be necessary for convergence. The algorithm terminates early if convergence is achieved before the full subspace is built. Default is 20
solve_method: str = 'batched'¶
(‘incremental’ or ‘batched’) – The ‘incremental’ solve method builds a QR decomposition for the Krylov subspace incrementally during the GMRES process using Givens rotations. This improves numerical stability and gives a free estimate of the residual norm that allows for early termination within a single “restart”. In contrast, the ‘batched’ solve method solves the least squares problem from scratch at the end of each GMRES iteration. It does not allow for early termination, but has much less overhead on GPUs.