FUNCTION REFERENCE
gmres
Restarted generalized minimum residual method.
Restarted generalized minimum residual method.
Syntax
x = gmres(A, b)Syntax
[x, flag, relres, iter, resvec] = gmres(A, b, restart, tol, maxit, M1, M2, x0, ...)GMRES with Householder Arnoldi (Saad and Schultz, 1986), left preconditioned: relres and resvec measure M\(b - A*x) relative to M\b. With restart, iter is [outer inner] and maxit counts outer iterations. Defaults: no restart, tol 1e-6, maxit min(n,10).
Example
[x, flag, relres, iter] = gmres([4 1; 2 5], [1; 0]) % iter = [1 2]Differences from MATLAB: Real dense or sparse matrices and real-valued function handles; complex systems are unsupported. A sparse A is used through sparse products (same values as full(A)); a sparse M1 or M2 is solved by substitution when triangular (same values as full) and otherwise factorized once per call by sparse LU. Singular dense preconditioners return flag 2 without MATLAB's singular-matrix warning.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.