mtl5.sparse.gmres#

mtl5.sparse.gmres(A, b, *, rtol=1e-10, maxiter=1000, M=None, callback=None, device=None, restart=30)#

GMRES with restarts, for general non-symmetric systems. restart bounds the Krylov subspace, trading memory against convergence.

Parameters:
  • A (MTL5 SparseMatrix or scipy.sparse matrix)

  • b (array-like)

  • rtol (float) – Relative residual tolerance.

  • maxiter (int) – Iteration cap. info is 1 if it is reached without converging.

  • M (preconditioner, optional) – Any object from this module’s preconditioner factories — ilu0, ic0, diagonal, ssor, ilut, ildl, block_diagonal, identity. Defaults to identity, i.e. unpreconditioned.

  • callback (callable, optional) – Reserved for per-iteration monitoring. Currently raises NotImplementedError.

  • device (str, optional) – Reserved for KPU dispatch. Currently raises NotImplementedError for anything other than ‘cpu’.

Returns:

  • x (np.ndarray) – Solution vector.

  • info (int) – 0 on convergence, nonzero otherwise.