  function [L,U] = JKI1(A) 
%---------------------------------------------
% function [L,U] = jki(A) 
% LU fZactorization of A. Uses jki variant of GE
% dense code
%---------------------------------------------
 n = size(A,1) ;
 L = zeros(n,n);
 U = zeros(n,n);
 for j=1:n 
     w = A(:,j); 
% replace by: 1) [ii jj vals] = find(A(:,j))
% 
%             2) call TopSort to Lst for this column
%             3) do a sparse column allocation 
% w = sparse(....) % Need to know sparsity pattern of w
%             4) followed by an initialization: 
%             w(ii) = vals;

%% replace by for k=1:l    [l is length of Lst] 
   for k=1:j-1 
%       need to replace
       w = w - w(k)*L(:,k) ;
   end
%% You can leave the rest as is.. [fairly reflective] 
   L(j+1:n,j) =   w(j+1:n) / w(j); 
   U(1:j,j) =   w(1:j); 
 end 
 L = eye(n,n)+L;
