
function demo_LU

% A=[3 -2 -1; 6 -2 2; -9 7 1]
% b=[0; 6; -1];

A=rand(5);
b=rand(5,1);

[L,U,P] = lu(A);

[P1,L1,U1]=LU_2018(A);

[x,L2,U2,P2]=lupivot(A,b);

L1
L2

norm(L-L1,inf)
norm(U-U1,inf)
norm(P-P1,inf)

norm(L-L2,inf)
norm(U-U2,inf)
norm(P-P2,inf)

norm(P*A-L*U,inf)
norm(P1*A-L1*U1,inf)
norm(P2*A-L2*U2,inf)