Previous Next Contents Generated Index Doc Set Home



Applied Given's Plane Rotation

The subroutines in this section apply a Given's plane rotation constructed by xROTG:

Calling Sequence

CALL DROT 
(N, DX, INCX, DY, INCY, DC, DS)
CALL SROT 
(N, SX, INCX, SY, INCY, SC, SS)






void drot 
(int n, double *dx, int incx, double *dy, int incy, 
double dc, double ds)
void srot 
(int n, float *sx, int incx, float *sy, int incy, float 
sc, float ss)

Arguments

N

Number of elements in the vector. N 0.

xX

Input vector X; the size of array X must be at least max(1,N*|INCX|).

INCX

Specifies the storage spacing between successive elements of the vector X. A value of one indicates that the elements of the vector are consecutive in memory.

If X refers to a two-dimensional array and the value of INCX is equal to the leading dimension of X then the elements of the vector will be a row of X.

If X refers to a two-dimensional array and the value of INCX is equal to the leading dimension of X plus one then the elements of the vector will be a diagonal of X.

xY

Result vector Y; the size of array Y must be at least max(1,N*|INCY|).

INCY

Specifies the storage spacing between successive elements of the vector Y. A value of one indicates that the elements of the vector are consecutive in memory.

If Y refers to a two-dimensional array and the value of INCY is equal to the leading dimension of Y then the elements of the vector will be a row of Y.

If Y refers to a two-dimensional array and the value of INCY is equal to the leading dimension of Y plus one then the elements of the vector will be a diagonal of Y.

xC

Value of the C argument from xROTG.

xS

Value of the S argument from xROTG.

Sample Program

 
      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           N
      PARAMETER        (N = 5)
C
      DOUBLE PRECISION  A, B, C, S, X(N), Y(N)
      INTEGER           I, INCX, INCY
C
      EXTERNAL          DROT, DROTG
C
C     Initialize the arrays X and Y to store the vectors x and y
C     shown below.
C
C         1         2
C         2         4
C     x = 3    y =  8
C         4        16
C         5        32
C
      DATA X / 1.0D0, 2.0D0, 3.0D0, 4.0D0, 5.0D0 /
      DATA Y / 2.0D0, 4.0D0, 8.0D0, 1.6D1, 3.2D1 /
C
      PRINT 1000
      PRINT 1010, (X(I), Y(I), I = 1, N)
C
C     Set up the rotation that will eliminate the last element.
C
      A = X(N)
      B = Y(N)
      CALL DROTG (A, B, C, S)
C
C     Apply the rotation to eliminate the last element and print
C     the results.
C
      INCX = 1
      INCY = 1
      CALL DROT (N, X, INCX, Y, INCY, C, S)
      PRINT 1020
      PRINT 1010, (X(I), Y(I), I = 1, N)
C
 1000 FORMAT (7X, 'x', 9X, 'y')
 1010 FORMAT (2(3X, F7.4))
 1020 FORMAT (/7X, 'x''', 8X, 'y''')
C
      END
 

Sample Output

 
       x         y
    1.0000    2.0000
    2.0000    4.0000
    3.0000    8.0000
    4.0000   16.0000
    5.0000   32.0000



       x'        y'
    2.1304   -0.6793
    4.2608   -1.3585
    8.3672   -1.7290
   16.4257   -1.4820
   32.3883    0.0000






Previous Next Contents Generated Index Doc Set Home