Cholesky-decomposition of a Matrix

Cholesky-decomposition of a Matrix

Size
Price:

Read more

Cholesky-decomposition of a Matrix

When a coefficient matrix of a linear system of equations is positive definite and symmetric, then Cholesky decomposition can be used. A positive definite symmetric matrix satisfies the condition $x^{T}Ax > 0$ and the elements of the lower $L$ and upper $U$ triangular matrix satisfies the condition $L_{i,j}=U_{j,i}$ i.e. $U = L^{T}$ and hence $A = LL^{T}$ . A symmetric matrix is positive definite if all its diagonal elements are positive and the diagonal element is larger than the sum of all other elements in that row (i.e. diagonally dominant).

Example:

choleskydeco_example
function [X,C] = choleskydecomposition(A,B)
% Applicable to only symmetric positive definite matrix
% Input :
%             A : Coefficient matrix
%             B : right hand vector
% Output :
%             X : Solution vector
%             C : Upper triangular metrix
[n,m] = size(A);    % rank of matrix A
C = zeros(n,n);
for i=1:n
    for j=i:n
        C(i,j) = A(i,j);
        for k=1:i-1
            C(i,j) = C(i,j) - C(k,i)*C(k,j);
        end
        if(j==i)
            C(i,j) = sqrt(C(i,j));
        else
            C(i,j) = C(i,j)/C(i,i);
        end
    end
end
Y = C'\B;       % Forward substitution
X = C\Y;        % Backward substitution
  
  
  
  
 
A = [4 1 1 1; 1 4 1 1; 1 1 4 1; 1 1 1 4]; B = [15.9; 17.7; 13.2; 9.9]; [x,C] = choleskydecomposition(A,B)
x =

    2.6000
    3.2000
    1.7000
    0.6000


C =

    2.0000    0.5000    0.5000    0.5000
         0    1.9365    0.3873    0.3873
         0         0    1.8974    0.3162
         0         0         0    1.8708

0 Reviews

Contact form

Name

Email *

Message *