function X = upper_inv(A)
% Finds the inverse of an upper triangular matrix A

[mA,nA] = size(A) ;
if mA == nA 
     n = nA ;
     B = eye(n) ;
     for k = 1:n
          X(:,k) = bsub1(A,B(:,k)) ;
     end     
else
    error('A is not square');
end            

end

