minres(A, b, x0=None, shift=0.0, tol=1e-05, maxiter=None, M=None, callback=None, show=False, check=False)
MINRES minimizes norm(Ax - b) for a real symmetric matrix A. Unlike the Conjugate Gradient method, A can be indefinite or singular.
If shift != 0 then the method solves (A - shift*I)x = b
Starting guess for the solution.
Value to apply to the system (A - shift * I)x = b
. Default is 0.
Tolerance to achieve. The algorithm terminates when the relative residual is below :None:None:`tol`
.
Maximum number of iterations. Iteration will stop after maxiter steps even if the specified tolerance has not been achieved.
Preconditioner for A. The preconditioner should approximate the inverse of A. Effective preconditioning dramatically improves the rate of convergence, which implies that fewer iterations are needed to reach a given error tolerance.
User-supplied function to call after each iteration. It is called as callback(xk), where xk is the current solution vector.
If True
, print out a summary and metrics related to the solution during iterations. Default is False
.
If True
, run additional input validation to check that A
and M
(if specified) are symmetric. Default is False
.
The real symmetric N-by-N matrix of the linear system Alternatively, A
can be a linear operator which can produce Ax
using, e.g., scipy.sparse.linalg.LinearOperator
.
Right hand side of the linear system. Has shape (N,) or (N,1).
Use MINimum RESidual iteration to solve Ax=b
>>> import numpy as np
... from scipy.sparse import csc_matrix
... from scipy.sparse.linalg import minres
... A = csc_matrix([[3, 2, 0], [1, -1, 0], [0, 5, 1]], dtype=float)
... A = A + A.T
... b = np.array([2, 4, -1], dtype=float)
... x, exitCode = minres(A, b)
... print(exitCode) # 0 indicates successful convergence 0
>>> np.allclose(A.dot(x), b) TrueSee :
The following pages refer to to this document either explicitly or contain code examples using this.
scipy.sparse.linalg._isolve.minres.minres
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them