带原点位移的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分解的过程,直到R的对角线元素都趋近于收敛值tol while abs(R(n,n)) > tol mu = A(n,n); [Q,R] = qr(A - mueye(n)); A = RQ + mueye(n); end Q = eye(n); for i = 1:n-1 for j = i+1:n G = eye(n); theta = atan2(A(j,i),A(i,i)); c = cos(theta); s = sin(theta); G(i,i) = c; G(j,j) = c; G(i,j) = s; G(j,i) = -s; A = G'AG; Q = QG; end end R = A;
原文地址: https://www.cveoy.top/t/topic/bRLn 著作权归作者所有。请勿转载和采集!