% LU_rowPivott.m
% Script to test LU_rowPivot.m
% Gauss elimination using row pivoting to
% solve Ax = b.

clear all; format short g;
% This is example 2.13 on p.69 of Heath:
A = [1 2 2
     4 4 2
     4 6 4]; b = [3; 6; 10]; n = length(b);
%A = [ 2 6 10; 1 3 3; 3 14 28]; b = [0; 2; -8]; % Example on p.109 Fausett
n = 100; A = rand(n,n); b = rand(n,1);  % Test using rand data.

[x,P,L,U] = LU_rowPivot(A,b,n),
check = max(max(abs(P*A-L*U))), % check to see if PA = LU
xMatlab = A\b;
disp('  x   xMatlab');
disp([x xMatlab]);
maxError = max(abs(x-xMatlab)),

