Use Generalized Minimal RESidual iteration to solve A x = b.
Parameters : | A : {sparse matrix, dense matrix, LinearOperator}
b : {array, matrix}
|
---|---|
Returns : | x : {array, matrix}
info : int
|
Other Parameters: | |
x0 : {array, matrix}
tol : float
restart : int, optional
maxiter : int, optional
xtype : {‘f’,’d’,’F’,’D’}
M : {sparse matrix, dense matrix, LinearOperator}
callback : function
restrt : int, optional
|
See also
Notes
A preconditioner, P, is chosen such that P is close to A but easy to solve for. The preconditioner parameter required by this routine is M = P^-1. The inverse should preferably not be calculated explicitly. Rather, use the following template to produce M:
# Construct a linear operator that computes P^-1 * x.
import scipy.sparse.linalg as spla
M_x = lambda x: spla.spsolve(P, x)
M = spla.LinearOperator((n, n), M_x)