上周,我了解了PCG, MINRES, GMRES的稳健迭代方法的细节,它将步内收敛到非奇异系统:
对矩阵的要求是:PCG 为 SPD 矩阵,MINRES 为对称矩阵,GMRES 为非对称矩阵。原因是上面这三种方法是最优的,即它们的残差向量是相互正交的,所以它们的残差向量,例如,必须满足,这会产生
clc;clear;
rng(0);% to fix the rand number
n=10;
A=rand(n); % generate a nonsingular matrix
b=rand(n,1);
% for general matrix
gmres(A,b);
%% for SPD matrix
pcg(A*A',b);
minres(A*A',b);
gmres(A*A',b);
结果是:
gmres converged at iteration 10 to a solution with relative residual 0.
pcg stopped at iteration 10 without converging to the desired tolerance 1e-06
because the maximum number of iterations was reached.
The iterate returned (number 10) has relative residual 0.02.
minres stopped at iteration 10 without converging to the desired tolerance 1e-06
because the maximum number of iterations was reached.
The iterate returned (number 10) has relative residual 0.016.
gmres converged at iteration 10 to a solution with relative residual 0.
奇怪的是,gmres 对于非对称矩阵和 SPD 矩阵都是正常的,但 pcg 和 minres 是异常的。因为矩阵是SPD,那么理论上pcg和minres必须N步收敛,但是都失败了。这是否意味着我们应该尽可能多地使用GMRES而不是其他方法,而不管 SPD 矩阵还是其他方法,因为 gmres 命令对于非对称和 SPD 矩阵非常健壮?有什么问题吗?有什么建议?