Code covered by the BSD License  

Highlights from
LU factorization of a square matrix using DooLittle's algorithm

from LU factorization of a square matrix using DooLittle's algorithm by Mazhar Iqbal
Doolittle's algorithm to find LU factors

[L U]=LU_DooLittle(A)
function [L U]=LU_DooLittle(A)
%Function to carryout LU factorization using DooLittlle's Algorithm
%By Mazhar Iqbal,NUST College of E&ME,Islamabad,Pakistan
clc
[m n]=size(A);
L=zeros(size(A));
U=zeros(size(A));
U(1,:)=A(1,:);
L(:,1)=A(:,1)/U(1,1);
L(1,1)=1;
for k=2:m
for i=2:m
    for j=i:m
        U(i,j)=A(i,j)-dot(L(i,1:i-1),U(1:i-1,j));
    end
    L(i,k)=(A(i,k)-dot(L(i,1:k-1),U(1:k-1,k)))/U(k,k);
end
end

Contact us