Learn R Programming

dr (version 1.0.2)

givens.rotation: Create givens rotation matrix

Description

For a given angle theta, returns a p by p Givens rotation matrix.

Usage

givens.rotation(theta, p=2, which=c(1, 2))

Arguments

theta
an angle in radians
p
the dimension of the matrix to be produced
which
two numbers between 1 and p giving the columns/rows for the nonzero elements of the result.

Value

  • Returns a p by p matrix z of all zeroes, except z[which,which] has elements cos(theta), -sin(theta), sin(theta) and cos(theta), in column order.

References

Gene H. Golub and Charles F. Van Loan (1989). Matrix Computations, Second Edition. Baltimore: Johns Hopkins Press, p. 202.

Examples

Run this code
givens.rotation(1,4,c(1,3))

Run the code above in your browser using DataLab