%
% LU Factorization requires a permutation matrix P
%
A = [0 1 -4 8; 2 -3 2 1; 5 -8 7 1]
A([1,2],:) = A([2,1],:)
P = eye(3)
P([1,2],:) = P([2,1],:)
C = [A eye(3)]
C(3,:) = C(3,:) - (5/2) * C(1,:)
C(3,:) = C(3,:) + (1/2) * C(2,:)
E = C(:,5:7)
L = inv(E)
U = C(:,1:4)
A = [0 1 -4 8; 2 -3 2 1; 5 -8 7 1]
P * A
L * U
