function [l,u]=ge3(a)
%routine to triangulate matrix a into upper and lower triangular matrices l and u.
n=length(a);
l=zeros(n);
for k=1:n-1
   for i=k+1:n
      v(i)=a(i,k)/a(k,k);
      l(i,k)=v(i);
      for j=k+1:n
         a(i,j)=a(i,j)-v(i)*a(k,j);
      end
   end
end
u=triu(a);
l=l+diag(ones(n,1));