I need a working algorithm of Cholesky LU decomposition

조회 수: 2 (최근 30일)
Emmanuel Chile
Emmanuel Chile 2017년 11월 15일
편집: the cyclist 2017년 11월 15일
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개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by