Solve system of linear equations — generalized minimum residual method
attempts to solve the system of linear equationsx
= gmres(A
,b
)A*x = b
forx
使用theGeneralized Minimum Residual Method。什么时候the attempt is successful,gmres
displays a message to confirm convergence. Ifgmres
fails to converge after the maximum number of iterations or halts for any reason, it displays a diagnostic message that includes the relative residualnorm(b-A*x)/norm(b)
和the iteration number at which the method stopped. For this syntax,gmres
does not restart; the maximum number of iterations is最小(尺寸(a,1),10)
。
restarts the method everyx
= gmres(A
,b
,restart
)restart
inner iterations。The maximum number of outer iterations is外= min(size(A,1)/restart,10)
。The maximum number of total iterations isrestart*outer
, sincegmres
performsrestart
inner iterations for each outer iteration. Ifrestart
issize(A,1)
或者[]
,ngmres
does not restart and the maximum number of total iterations is最小(尺寸(a,1),10)
。
specifies the maximum number of外iterationssuch that the total number of iterations does not exceedx
= gmres(A
,b
,restart
,tol
,maxit
)restart*maxit
。Ifmaxit
is[]
然后gmres
uses the default,min(size(A,1)/restart,10)
。Ifrestart
issize(A,1)
或者[]
,那么总迭代的最大数量是maxit
(代替restart*maxit
)。gmres
displays a diagnostic message if it fails to converge within the maximum number of total iterations.
Convergence of most iterative methods depends on the condition number of the coefficient matrix,cond(A)
。You can useequilibrate
to improve the condition number ofA
, 和上its own this makes it easier for most iterative solvers to converge. However, usingequilibrate
also leads to better quality preconditioner matrices when you subsequently factor the equilibrated matrixB = R*P*A*C
。
You can use matrix reordering functions such asdissect
和symrcm
要计算到系数矩阵的行和列,并在系数矩阵时将非齐射码的数量最小化以生成预处理。这可以减少随后求解预处理的线性系统所需的内存和时间。
[1] Barrett, R., M. Berry, T. F. Chan, et al.,Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods, SIAM, Philadelphia, 1994.
[2] Saad, Yousef and Martin H. Schultz, “GMRES: A generalized minimal residual algorithm for solving nonsymmetric linear systems,”暹罗j .科学。Stat。第一版。,1986年7月,第1卷。7,第3号,第856-869页。