%----------------------------------------------------------% %- @description: computes the LU-Decompositon of a %- matrix without using pivot method %- @input: A - regular square matrix %- @output: L - a lower triangle matrix %- R - an upper triangle matrix %----------------------------------------------------------% function [L,R] = lr(A) R = A; n = size(R,1); for k = 1:n L(k,k) = 1; for i = k+1:n %compute l_ik L(i,k) = R(i,k) / R(k,k); for j = k+1:n %compute a_jk^(k+1) R(i,j) = R(i,j) - L(i,k) * R(k,j); end R(i,k) = 0; end end