Created
November 30, 2018 11:43
-
-
Save mrfarhadir/9ca5307111eeb80025fd1470b1c6e691 to your computer and use it in GitHub Desktop.
Cholesky matrix decompression in matlab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Cholesky matrix decompression | |
function [retval] = Cholesky (A) | |
n = length( A ); | |
L = zeros( n, n ); | |
for i=1:n | |
L(i, i) = sqrt(A(i, i) - L(i, :)*L(i, :)'); | |
for j=(i + 1):n | |
L(j, i) = (A(j, i) - L(i,:)*L(j ,:)')/L(i, i); | |
end | |
end | |
retval = L; | |
endfunction | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A=[4 5 9;-2 6 0;1/2 6 10]; | |
L=Cholesky(A) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment