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 Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by