function [u,b]=ge2(a,b)
%routine to triangulate matrix a into upper triangular matrix u.
n=length(a);
for k=1:n-1
   for i=k+1:n
      v(i)=a(i,k)/a(k,k);
      b(i)=b(i)-v(i)*b(k);
      for j=k+1:n
         a(i,j)=a(i,j)-v(i)*a(k,j);
      end
   end
end
u=triu(a);