I need a working algorithm of Cholesky LU decomposition
조회 수: 2 (최근 30일)
이전 댓글 표시
function [L] = cholesky(~)
% Computes L in Choleski's decomposition A = LL'
% USAGE: L = choleski(A)
A = [4, -2, 2; -2, 2, -4; 2, -4, 11];
n = size(A);
for j = 1:n
temp = (A(j,j) - dot(A(j,1:j-1),A(j,1:j-1)));
if temp < 0.0
error('matrix A must be square');
end
A(j,j) = sqrt(temp);
for i = j+1:n
A(i,j) = (A(i,j) - dot(A(i,1:j-1), A(j,1:j-1)))/A(j,j);
end;
end
L = tril(A);
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!