function outmat=rri_normalize(inmat)
%syntax outmat=rri_normalize(inmat)
%
% Normalizes each vector of a matrix to be a unit length.  The sum of the 
% squared elements will be one.  Used for design matrices in PLS.
%
% Written by ARM 4-13-97
[r c]=size(inmat);
outmat=zeros(r,c);

%normalization achieved through division of each element in the 
%vector by the square root of the sum of the squared elements 


temp=sqrt(sum(inmat.^2));

for i=1:r
	outmat(i,:)=inmat(i,:)./temp;
end

