cupyx.scipy.sparse.linalg.gmres#
- cupyx.scipy.sparse.linalg.gmres(A, b, x0=None, *, rtol=1e-05, atol=0.0, restart=None, maxiter=None, M=None, callback=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)
.A
must becupy.ndarray
,cupyx.scipy.sparse.spmatrix
orcupyx.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.
rtol (float) – Tolerance for convergence.
atol (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
.M
must becupy.ndarray
,cupyx.scipy.sparse.spmatrix
orcupyx.scipy.sparse.linalg.LinearOperator
.callback (function) – User-specified function to call on every restart. It is called as
callback(arg)
, wherearg
is 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 argument.
- Returns:
It returns
x
(cupy.ndarray) andinfo
(int) wherex
is the converged solution andinfo
provides 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