
PROGRAM TEST

IMPLICIT NONE

INTEGER N

PARAMETER (N = 3)

INTEGER I, INCX, INCY, J, LARGE

DOUBLE PRECISION A(N,N)

INTEGER IDAMAX

EXTERNAL DSWAP, IDAMAX

C

C Initialize the array A to store the matrix A shown below.

C

C 1.0 1.5 4.5

C A = 3.0 2.5 9.5

C 2.0 3.5 5.5

C

DATA A / 1.0D0, 3.0D0, 2.0D0, 1.5D0, 2.5D0, 3.5D0,

$ 4.5D0, 9.5D0, 5.5D0 /

C

PRINT 1000

PRINT 1010, ((A(I,J), J = 1, N), I = 1, N)

C

C Find the largest element in column 1.

C

INCX = 1

LARGE = IDAMAX (N, A, INCX)

C

C Swap the first row with the row containing the largest

C element in column 1.

C

INCX = N

INCY = N

CALL DSWAP (N, A(1,1), INCX, A(LARGE,1), INCY)

PRINT 1020

PRINT 1010, ((A(I,J), J = 1, N), I = 1, N)

C

1000 FORMAT (1X, 'A:')

1010 FORMAT (3(3(2X, F3.1) / ))

1020 FORMAT (1X, 'A'':')

C

END

