This procedure attempts to solve a system of linear equations A*x = b for x. The A must be square, symmetric and positive definite real matrix N*N. The b must be a one column vector with a length of N. The tol specifies the tolerance of the method, the default value is 1e-6. The maxit specifies the maximum number of iterations, the default value is min(20,N). The M1 specifies a preconditioner, can also be a function handler which returns M\X. The M2 combined with M1 defines preconditioner as preconditioner=M1*M2. The x0 is the initial guess, the default value is zeros(N,1).
The value x is a computed result of this procedure. The value flag can be 0 when we reach tolerance in maxit iterations, 1 when we don't reach tolerance in maxit iterations and 3 when the procedure stagnates. The value relres is a relative residual - norm(b-A*x)/norm(b). The value iter is an iteration number in which x was computed. The value resvec is a vector of relres for each iteration.
This procedure attempts to solve a system of linear equations A*x = b for x. The A must be square, symmetric and positive definite real matrix N*N. The b must be a one column vector with a length of N. The tol specifies the tolerance of the method, default value is 1e-6. The maxit specifies the maximum number of iteration, default value is MIN(20,N). The M1 specifies a preconditioner, can also be a function handler which returns M\X. The M2 combined with M1 defines preconditioner as preconditioner=M1*M2. The x0 is initial guess, default value is zeros(N,1).
Solve
A x = b
using the Preconditioned GMRES iterative method with restart, a.k.a. PGMRES(m).
- rtol is the relative tolerance, if not given or set to [] the default value 1e-6 is used.
- maxit is the maximum number of outer iterations, if not given or set to [] the default value
min (10, numel (b) / restart)
is used.- x0 is the initial guess, if not given or set to [] the default value
zeros(size (b))
is used.- m is the restart parameter, if not given or set to [] the default value
numel (b)
is used.Argument A can be passed as a matrix, function handle, or inline function
f
such thatf(x) = A*x
.The preconditioner P is given as
P = M1 * M2
. Both M1 and M2 can be passed as a matrix, function handle, or inline functiong
such thatg(x) = M1\x
org(x) = M2\x
.Besides the vector x, additional outputs are:
- flag indicates the exit status:
- 0 : iteration converged to within the specified tolerance
- 1 : maximum number of iterations exceeded
- 2 : unused, but skipped for compatibility
- 3 : algorithm reached stagnation
- relres is the final value of the relative residual.
- iter is a vector containing the number of outer iterations and total iterations performed.
- resvec is a vector containing the relative residual at each iteration.