33 DEFUN (givens, args, nargout,
35 @deftypefn {Built-in Function} {@var{g} =} givens (@var{x}, @var{y})\n\
36 @deftypefnx {Built-in Function} {[@var{c}, @var{s}] =} givens (@var{x}, @var{y})\n\
38 Return a $2\\times 2$ orthogonal matrix\n\
40 G = \\left[\\matrix{c & s\\cr -s'& c\\cr}\\right]\n\
44 G \\left[\\matrix{x\\cr y}\\right] = \\left[\\matrix{\\ast\\cr 0}\\right]\n\
46 with $x$ and $y$ scalars.\n\
49 Return a 2 by 2 orthogonal matrix\n\
50 @code{@var{g} = [@var{c} @var{s}; -@var{s}' @var{c}]} such that\n\
51 @code{@var{g} [@var{x}; @var{y}] = [*; 0]} with @var{x} and @var{y} scalars.\n\
59 @result{} 0.70711 0.70711\n\
67 int nargin = args.
length ();
69 if (nargin != 2 || nargout > 2)
76 if (args(0).is_single_type () || args(1).is_single_type ())
78 if (args(0).is_complex_type () || args(1).is_complex_type ())
97 retval(1) = result (0, 1);
98 retval(0) = result (0, 0);
102 error (
"givens: invalid number of output arguments");
110 float x = args(0).float_value ();
111 float y = args(1).float_value ();
127 retval(1) = result (0, 1);
128 retval(0) = result (0, 0);
132 error (
"givens: invalid number of output arguments");
141 if (args(0).is_complex_type () || args(1).is_complex_type ())
143 Complex cx = args(0).complex_value ();
144 Complex cy = args(1).complex_value ();
160 retval(1) = result (0, 1);
161 retval(0) = result (0, 0);
165 error (
"givens: invalid number of output arguments");
173 double x = args(0).double_value ();
174 double y = args(1).double_value ();
190 retval(1) = result (0, 1);
191 retval(0) = result (0, 0);
195 error (
"givens: invalid number of output arguments");