cupyx.scipy.sparse.linalg.gmres#
- cupyx.scipy.sparse.linalg.gmres(A, b, x0=None, tol=1e-05, restart=None, maxiter=None, M=None, callback=None, atol=None, callback_type=None)[source]#
Uses Generalized Minimal RESidual iteration to solve
Ax = b.- Parameters:
A (ndarray, spmatrix or LinearOperator) – The real or complex matrix of the linear system with shape
(n, n).Amust becupy.ndarray,cupyx.scipy.sparse.spmatrixorcupyx.scipy.sparse.linalg.LinearOperator.b (cupy.ndarray) – Right hand side of the linear system with shape
(n,)or(n, 1).x0 (cupy.ndarray) – Starting guess for the solution.
tol (float) – Tolerance for convergence.
restart (int) – Number of iterations between restarts. Larger values increase iteration cost, but may be necessary for convergence.
maxiter (int) – Maximum number of iterations.
M (ndarray, spmatrix or LinearOperator) – Preconditioner for
A. The preconditioner should approximate the inverse ofA.Mmust becupy.ndarray,cupyx.scipy.sparse.spmatrixorcupyx.scipy.sparse.linalg.LinearOperator.callback (function) – User-specified function to call on every restart. It is called as
callback(arg), whereargis selected bycallback_type.callback_type (str) – ‘x’ or ‘pr_norm’. If ‘x’, the current solution vector is used as an argument of callback function. if ‘pr_norm’, relative (preconditioned) residual norm is used as an arugment.
atol (float) – Tolerance for convergence.
- Returns:
It returns
x(cupy.ndarray) andinfo(int) wherexis the converged solution andinfoprovides convergence information.- Return type:
- Reference:
M. Wang, H. Klie, M. Parashar and H. Sudan, “Solving Sparse Linear Systems on NVIDIA Tesla GPUs”, ICCS 2009 (2009).
See also