% drivePLU.m - main program for function [L,U,P]=PALU(A) for 
%              solving Gaussian Elimination with Partial Pivoting)
%
%              b=[4; 7; -3; 3];  x=[1; 0; -1; 2]; for testing
%
A=[ 0  1  2  3; ... 
    1  2  4  5; ... 
    2 -2  3 -1; ...
    4  2  1  0];
A0=A;
[L,U,P]=PALU(A)
norm(P*A0-L*U,2)
%
% 4.0000  2.0000  1.0000  0.0000
% 0.2500 -3.2500  2.5000 -1.0000
% 0.5000 -0.5000  5.0000  4.5000
% 0.0000 -0.3333  0.5667  0.1167
%--------------------------------
% P = [ 0 0 0 1;
%       0 0 1 0;
%       0 1 0 0;
%       1 0 0 0];