DROTG(3) BLAS routine of NEC Numeric Library Collection DROTG(3)
NAME
DGROTG - BLAS level one rotation subroutines
SYNOPSIS
SUBROUTINE DROTG ( a, b, c, s )
DOUBLE PRECISION a, b, c, s
DESCRIPTION
DROTG computes the elements of a Givens plane rotation matrix such
that:
_ _ _ _ _ _
| c s | | a | | r |
|-s c | * | b | = | 0 |
- - - - - -
where r = +- sqrt ( a**2 + b**2 ) and c**2 + s**2 =1.
The Givens plane rotation can be used to introduce zero elements into
a matrix selectively.
ARGUMENTS
a (input and output) DOUBLE PRECISION
First vector component. On input, the first component of the
vector to be rotated. On output, a is overwritten by by r, the
first component of the vector in the rotated coordinate system
where:
r = sign(sqrt(a**2 + b**2),a), if |a| > |b|
r = sign(sqrt(a**2 + b**2),b), if |a| <= |b|
b (input and output) DOUBLE PRECISION
Second vector component.
On input, the second component of the vector to be rotated. On
output, b contains z, where:
z=s if |a| > |b|
z=1/c if |a| <= |b| and c != 0 and r != 0
z=1 if |a| <= |b| and c = 0 and r != 0
z=0 if r = 0
c (output) DOUBLE PRECISION
Cosine of the angle of rotation:
c = a/r if r != 0
c = 1 if r = 0
s (output) DOUBLE PRECISION
Sine of the angle of rotation:
s = b/r if r != 0
s = 0 if r = 0
NOTE
The value of z, returned in b by DROTG, gives a compact representation
of the rotation matrix, which can be used later to reconstruct c and s
as in the following example:
IF (B .EQ. 1. ) THEN
C = 0.
S = 1.
ELSEIF( ABS( B) .LT. 1) THEN
C = SQRT( 1. - B * B)
S = B
ELSE
C = 1. / B
S = SQRT( 1 - C * C)
ENDIF
SEE ALSO
DROT(3), DROTM(3), DROTMG(3)
BLAS routine DROTG(3)