  function [U] = cholR (A)
% function [U] = cholR (A)
% row outer product Cholesky
% returns an upper triangular matrix
%-----------------------------------
 n = size(A,1) ;
 for k=1:n
     if (A(k,k)<=0), error(' non-positive piv.'), end
     A(k,k:n) = A(k,k:n) / sqrt(A(k,k)) ; 
     for i=k+1:n
         A(i,i:n)=A(i,i:n)-A(k,i)*A(k,i:n);
     end
 end 
 %%-------------------- return Upper part
 U = triu(A);
