
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

