Construct Givens rotation

 

SROTG/DROTG/CROTG/ZROTG

Output

a

The rotated result r overwrites a.

 

b

Not used as output by CROTG and ZROTG. In SROTG

 

 

and DROTG, the reconstruction quantity z overwrites

 

 

b. The reconstruction quantity z is useful if a matrix is

 

 

being transformed by a sequence of Givens rotations

 

 

that must be saved to be applied again. Because each z

 

 

overwrites an element that has been reduced to zero,

 

 

the transformations can be saved without using any

 

 

additional storage. The quantities c and s can be

 

 

reconstructed from z as follows:

 

 

if z = 0,

set c = 0 and s = 1.

 

 

if z < 0,

set c = √(1−z2) ανδ σ = ζ.

 

 

if z > 0,

set c = 1/z and s = √(1−c2).

 

c

The rotation scalar c.

 

s

The rotation scalar s.

Notes

VECLIB also contains subprograms that construct and apply modified Givens

 

rotations. They are documented elsewhere in this chapter. The modified Givens

 

subprograms are a little more difficult to use but are more efficient.

Example

Construct a Givens plane rotation that rotates vectors x and y in such a way as

 

to annihilate y1. x and y are vectors 10 elements long stored in one-dimensional

 

arrays X and Y of dimension 20.

 

REAL*8 X(20),Y(20),C,S

CALL DROTG (X(1),Y(1),C,S)

X(1) is the rotated result and Y(1) is the reconstruction quantity, so these elements should not be rotated by a subsequent call to DROT.

Chapter 2 Basic Vector Operations 119