cupyx.scipy.sparse.linalg.cgs#
- cupyx.scipy.sparse.linalg.cgs(A, b, x0=None, tol=1e-05, maxiter=None, M=None, callback=None, atol=None)[source]#
Use Conjugate Gradient Squared iteration to solve
Ax = b.- Parameters:
A (ndarray, spmatrix or LinearOperator) – The real or complex matrix of the linear system with shape
(n, n).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.
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 after each iteration. It is called as
callback(xk), wherexkis the current solution vector.atol (float) – Tolerance for convergence.
- Returns:
It returns
x(cupy.ndarray) andinfo(int) wherexis the converged solution andinfoprovides convergence information.- Return type:
See also