Next: Householder Transformations, Previous: Bidiagonalization, Up: Linear Algebra [Index]
A Givens rotation is a rotation in the plane acting on two elements of a given vector. It can be represented in matrix form as
where the \cos{\theta} and \sin{\theta} appear at the intersection of the ith and jth rows and columns. When acting on a vector x, G(i,j,\theta) x performs a rotation of the (i,j) elements of x. Givens rotations are typically used to introduce zeros in vectors, such as during the QR decomposition of a matrix. In this case, it is typically desired to find c and s such that
with r = \sqrt{a^2 + b^2}.
This function computes c = \cos{\theta} and s = \sin{\theta} so that the Givens matrix G(\theta) acting on the vector (a,b) produces (r, 0), with r = \sqrt{a^2 + b^2}.
This function applies the Givens rotation defined by c = \cos{\theta} and s = \sin{\theta} to the i and j elements of v. On output, (v(i),v(j)) \leftarrow G(\theta) (v(i),v(j)).