I need a working algorithm of Cholesky LU decomposition
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear Algebra finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!