In linear algebra, the Cholesky decomposition or Cholesky factorization (pronounced /ʃə.ˈlɛs.ki/) is a decomposition of a Hermitian, positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose, which is useful for efficient numerical solutions, e.g., Monte Carlo simulations. It was discovered by André-Louis Cholesky for real matrices. When it is applicable, the Cholesky decomposition is roughly twice as efficient as the LU decomposition for solving systems of linear equations.
I’ve written this algorithm as matlab function which accepts one parameter as Matrix for Cholesky decomposition.
%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
after creating Cholesky.m file, inside command window, call the function as below
A=[4 5 9;-2 6 0;1/2 6 10]; L=Cholesky(A)