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\
37 Compute the Givens rotation matrix @var{G}.\n\
40 The Givens matrix is a $2\\times 2$ orthogonal matrix\n\
42 G = \\left[\\matrix{c & s\\cr -s'& c\\cr}\\right]\n\
46 G \\left[\\matrix{x\\cr y}\\right] = \\left[\\matrix{\\ast\\cr 0}\\right]\n\
48 with $x$ and $y$ scalars.\n\
51 The Givens matrix is a 2 by 2 orthogonal matrix\n\
53 @code{@var{g} = [@var{c} @var{s}; -@var{s}' @var{c}]}\n\
57 @code{@var{g} [@var{x}; @var{y}] = [*; 0]}\n\
59 with @var{x} and @var{y} scalars.\n\
62 If two output arguments are requested, return the factors @var{c} and\n\
63 @var{s} rather than the Givens rotation matrix.\n\
70 @result{} 0.70711 0.70711\n\
79 int nargin = args.
length ();
81 if (nargin != 2 || nargout > 2)
88 if (args(0).is_single_type () || args(1).is_single_type ())
90 if (args(0).is_complex_type () || args(1).is_complex_type ())
109 retval(1) = result (0, 1);
110 retval(0) = result (0, 0);
118 float x = args(0).float_value ();
119 float y = args(1).float_value ();
135 retval(1) = result (0, 1);
136 retval(0) = result (0, 0);
145 if (args(0).is_complex_type () || args(1).is_complex_type ())
147 Complex cx = args(0).complex_value ();
148 Complex cy = args(1).complex_value ();
164 retval(1) = result (0, 1);
165 retval(0) = result (0, 0);
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);
OCTINTERP_API void print_usage(void)
octave_idx_type length(void) const
#define DEFUN(name, args_name, nargout_name, doc)
ComplexMatrix Givens(const Complex &x, const Complex &y)
std::complex< float > FloatComplex
std::complex< double > Complex
F77_RET_T const double * x