function g = givens(x,y)
%GIVENS Givens rotation matrix.
%   G = GIVENS(x,y) returns the complex Givens rotation matrix
%
%       | c       s |                  | x |     | r |
%   G = |           |   such that  G * |   |  =  |   |
%       |-conj(s) c |                  | y |     | 0 |
%
%   where c is real, s is complex, and c^2 + |s|^2 = 1. 
 
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.8 $  $Date: 2000/08/02 16:25:06 $

absx = abs(x);
if absx == 0.0
    c = 0.0; s = 1.0;
else
    nrm = norm([x y]);
    c = absx/nrm;
    s = x/absx*(conj(y)/nrm);
end
g = [c s;-conj(s) c];
