Previous Next Contents Generated Index Doc Set Home



Modified Given's Plane Rotation

The subroutines in this section construct Gentleman's modified Given's plane rotation. It is typical to follow the call to xROTMG with a call to xROTM to apply the plane rotation to annihilate an element of the input vector.

Calling Sequence

CALL DROTMG 
(DD1, DD2, DB1, DB2, DPARAM)
CALL SROTMG 
(SD1, SD2, SB1, SB2, SPARAM)






void drotmg 
(double *dd1, double *dd2, double *db1, double *db2, 
double *dparam)
void srotmg 
(float *sd1, float *sd2, float *sb1, float *sb2, float 
*sparam)

Arguments

xD1

On entry, contains the value d1 shown in the equation above.

On exit, changed to represent the effect of the transformation.

xD2

On entry, contains the value d2 shown in the equation above.

On exit, changed to represent the effect of the transformation.

xB1

On entry, contains the value b1 shown in the equation above.

On exit, changed to represent the effect of the transformation.

xB2

On entry, contains the value b2 shown in the equation above.

On exit, changed to represent the effect of the transformation.

xPARAM

On entry, PARAM(1) indicates the form of the H matrix. The H matrix is defined in the section that describes the subroutines xROTM. On exit, elements 2 through 5 of PARAM contain the H matrix as defined above. Elements of PARAM that are not listed are not changed.

If PARAM(1) = 1 then h12 = 1, h21 = -1, PARAM(2) = h11, and PARAM(5) = h22.

If PARAM(1) = 0 then h11 = h22 = 1, PARAM(3) = h21, and
PARAM(4) = h12.

If PARAM(1) = -1 then PARAM(2) = h11, PARAM(3) = h21,
PARAM(4) = h12, and PARAM(5) = h22.

If PARAM(1) = -2 then H = I and no elements of PARAM are modified.

Sample Program

 
      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           N
      PARAMETER        (N = 4)
C
      DOUBLE PRECISION  B1, B2, D1, D2, PARAM(5), X(N), Y(N)
      INTEGER           I, INCX, INCY
C
      EXTERNAL          DROTM, DROTMG
C
C     Initialize the arrays X and Y to store the vectors x and y
C     shown below.
C
C         5         2
C     x = 5    y =  4
C         5         8
C         5        16
C
      DATA X / 5.0D0, 5.0D0, 5.0D0, 5.0D0 /
      DATA Y / 2.0D0, 4.0D0, 8.0D0, 1.6D1 /
C
      PARAM(1) = -2
      PRINT 1000
      PRINT 1010, (X(I), Y(I), I = 1, N)
C
C     Set up the rotation that will eliminate the third element.
C
      D1 = 1.0D0
      D2 = 1.0D0
      B1 = X(3)
      B2 = Y(3)
      CALL DROTMG (D1, D2, B1, B2, PARAM)
C
C     Apply the rotation to eliminate the third element and print
C     the results.
C
      INCX = 1
      INCY = 1
      CALL DROTM (N, X, INCX, Y, INCY, PARAM)
      PRINT 1020
      PRINT 1010, (X(I), Y(I), I = 1, N)
C
 1000 FORMAT (7X, 'x ', 8X, 'y')
 1010 FORMAT (2(3X, F7.4))
 1020 FORMAT (/7X, 'x''', 8X, 'y''')
C
      END
 

Sample Output

 
       x         y
    5.0000    2.0000
    5.0000    4.0000
    5.0000    8.0000
    5.0000   16.0000



       x'        y'
    5.1250   -3.7500
    7.1250   -2.5000
   11.1250    0.0000
   19.1250    5.0000






Previous Next Contents Generated Index Doc Set Home