Skip to content

__givens__

builtin · libnexusinterp/corefcn/givens-proprietary.cc

: g = __givens__ (x1, x2)
: [g, y] = __givens__ (x1, x2)

Build the 2-by-2 Givens rotation that annihilates the second component of the scalar pair [x1; x2].

The result g is the orthogonal matrix [c, s; -s, c], where c = x1/r, s = x2/r, and r = hypot (x1, x2). Multiplying by it rotates the pair onto the first axis, so that g * [x1; x2] equals [r; 0]. When both inputs are zero the rotation reduces to the identity matrix.

Request a second output to obtain the rotated vector y, which is [r; 0].