scipy 1.8.0 Pypi GitHub Homepage
Other Docs
Other ParametersParametersReturnsBackRef
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

Other Parameters

x0 : ndarray

Starting guess for the solution.

shift : float

Value to apply to the system (A - shift * I)x = b . Default is 0.

tol : float

Tolerance to achieve. The algorithm terminates when the relative residual is below :None:None:`tol`.

maxiter : integer

Maximum number of iterations. Iteration will stop after maxiter steps even if the specified tolerance has not been achieved.

M : {sparse matrix, ndarray, LinearOperator}

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.

callback : function

User-supplied function to call after each iteration. It is called as callback(xk), where xk is the current solution vector.

show : bool

If True , print out a summary and metrics related to the solution during iterations. Default is False .

check : bool

If True , run additional input validation to check that A and M (if specified) are symmetric. Default is False .

Parameters

A : {sparse matrix, ndarray, LinearOperator}

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 .

b : ndarray

Right hand side of the linear system. Has shape (N,) or (N,1).

Returns

x : ndarray

The converged solution.

info : integer

Use MINimum RESidual iteration to solve Ax=b

Examples

>>> 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)
True
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.sparse.linalg._isolve.minres.minres

Local connectivity graph

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


GitHub : /scipy/sparse/linalg/_isolve/minres.py#10
type: <class 'function'>
Commit: