function  [c2, s2, mag, ang] = normalize_cs_pair(c1, s1)

%Normalizes a pair of real numbers c1 and s1
%so that the sum of their squares is 1. 

mag = sqrt( (c1)^2 + (s1)^2 );
if(abs(mag)>1e-13)
	c2 = c1/mag;
	s2 = s1/mag;
	ang = atan2(s2, c2);
else
	c2 = 1;
	s2 = 0;
	ang = 0;
end