function main_LU_cond

rng(555)
m = 250;

for i = 1:100

  A = randn(m);
  [L,U] = LU_hack(A);
  fprintf(1,'max|A - L*U| = %10.3e   max|L| = %10.3e   max|U| = %10.3e \n',...
          max(max(abs(A - L*U))),max(max(abs(L))),max(max(abs(U))))
  keyboard
  
end

return

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [L,U] = LU_hack(A)

m = size(A,2);
U = A;
L = eye(m);

%%% Perform LU factorization.
for i = 1:(m-1)
  J      = (i+1):m;
  lvec   = (1/U(i,i))*U(J,i);
  L(J,i) = lvec;
  U(J,i) = zeros(m-i,1);
  U(J,J) = U(J,J) - lvec*U(i,J);
end

return

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

