SROTG(3)        BLAS routine of NEC Numeric Library Collection        SROTG(3)



NAME
       SROTG - BLAS level one rotation subroutines

SYNOPSIS
       SUBROUTINE SROTG    ( a, b, c, s )

           REAL              a, b, c, s


DESCRIPTION
       SROTG computes the elements of a 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) REAL

               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) REAL
               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) REAL
               Cosine of the angle of rotation:

                    c = a/r  if  r != 0
                    c = 1    if  r  = 0

       s       (output) REAL
               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 SROTG, 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
       SROT(3), SROTM(3), SROTMG(3)



BLAS routine                                                          SROTG(3)