function [G,x] = planerot(x)
%PLANEROT Generate a Givens plane rotation.
%	[G,Y] = PLANEROT(X), where X is a 2-component column vector,
%	returns a 2-by-2 orthogonal matrix G so that Y = G*X has Y(2) = 0.
%
%	See also QRINSERT, QRDELETE.

%	CBM 9/11/92.
%	Copyright (c) 1984-93 by the MathWorks, Inc.

if x(2) ~= 0
   r = norm(x);
   G = [x(1) x(2); -x(2) x(1)]/r;
   x = [r; 0];
else
   G = eye(2);
end
