我有
我知道,,。
如何获得Cholesky 分解和?
我有
我知道,,。
如何获得Cholesky 分解和?
让我将特征分解重写为:。现在,考虑 QR 分解,其中是单一的,是上三角形。为了唯一性,必须确保具有正对角线条目。的相应行。是 Cholesky 分解。
这是一个要重现的 MATLAB 代码段:
n = 5;
A = rand(n);
% construct S to be positive-definite:
S = A'*A;
S = S + n*eye(n);
[U,D] = eig(S); % we assume this to be given.
% original cholesky for comparisons
Rchol = chol(S);
% perform the proposed Cholesky
[~,Rqr] = qr(sqrt(D) * U');
Dg = diag(sign(diag(Rqr)));
Rqr = Dg * Rqr;
% now verify that Rqr = Rchol are the same
disp(['error in R: ' num2str(norm(Rchol-Rqr))]);
% now verify that S can be reconstructed from Rqr
disp(['reconstruction error: ' num2str(norm(S - Rqr'*Rqr))]);
% both results should be almost 0 (up to the numerical precision)
如果是满秩且正定的,则 Cholesky 分解是唯一的。