function [c,s]=GivensRotation(x,y)
% GIVENSROTATION computes a Givens rotation matrix 
%   [c,s]=GivensRotation(x,y) computes for the given numbers x and y
%   the Givens rotation matrix [c s;-s c] with s=sin(phi) and
%   c=cos(phi) such that [c s;-s c]'*[x;y]=[r;0]

if y==0
  c=1; s=0;
elseif abs(y)>= abs(x)
  h=-x/y; s=1/sqrt(1+h*h); c=s*h;
else
  h=-y/x; c=1/sqrt(1+h*h); s=c*h;
end;