Coding my own Cholesky Decomposition Algorithm help?

17 ビュー (過去 30 日間)
J
J 2019 年 2 月 8 日
I understand the idea of Cholesky Decomposition and can find it manually, but I am having a hard time creating my own MATLAB code to find a cholesky factor R, for a given positive definite matrix A.
So far my code is,
function[R] = getCholeskyFactor(A,n)
R=zeros(n,n);
for i=1:n
for j=1:n
R(i,i) = sqrt(A(i,i)-((R(j,i))^2))
for k = 1:n
R(i,j) = (A(i,j)-R(k,i)*R(k,j))/R(i,i)
end
end
end
But I realize I am missing different summations because r(i,i) = sqrt(A(i,i) - sum(R(k,i)^2,k=1:(i-1)) and r(i,j) = (A(i,j) - sum(R(k,i)*(R(k,j)),k=1:(i-1))/R(i,i).

回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by