带原点位移的qr方法的MATLAB程序function QR = qr_shiftA QR factorization with shift A input matrix Q orthogonal matrix R upper triangular matrix Author Lisha Chen Date Jan 25th 2021mn = sizeA;Q进行QR分解的过程直到矩阵A变成上三角矩
while m > n % Choose shift s = A(n,n);
% QR factorization with shift
[Q,R] = qr(A - s*eye(m));
% Update A
A = R*Q + s*eye(m);
% Update m and n
m = m - 1;
n = n - 1;
end
% Final QR factorization without shift [Q,R] = qr(A);
% Check if A is close to upper triangular if norm(triu(A,1)) > 1e-10 warning('A is not upper triangular'); end
end
原文地址: https://www.cveoy.top/t/topic/bRLt 著作权归作者所有。请勿转载和采集!