function x=upsolve(U,y)
%
% U = upper triangular matrix, Ux=y
% x=upsolve(U,y)
% 
n=length(y);
for i=n:-1:1;
 x(i)=y(i);
 for j=n:-1:i+1;
  x(i)=x(i)-U(i,j)*x(j);
 end;
x(i)=x(i)/U(i,i);
end;
