
PROGRAM TEST

IMPLICIT NONE

C

INTEGER LDB, LDWORK, N, NRHS

PARAMETER (N = 4)

PARAMETER (LDB = N)

PARAMETER (LDWORK = N)

PARAMETER (NRHS = 1)

C

DOUBLE PRECISION ANORM, DIAG(N), DLOWER(N1), RCOND

DOUBLE PRECISION WORK(LDWORK)

INTEGER ICOL, INFO, IROW

C

EXTERNAL DPTCON, DPTTRF

INTRINSIC ABS

C

C Initialize the arrays DIAG and DLOWER to store the diagonal

C and first off diagonal of the matrix A shown below.

C

C 2 1

C 1 2 1

C A = 1 2 1

C 1 2 1

C

DATA DIAG / 2.0D0, 2.0D0, 2.0D0, 2.0D0 /

DATA DLOWER / 1.0D0, 1.0D0, 1.0D0 /

C

C Print the initial value of the arrays.

C

PRINT 1000

DO 100, IROW = 1, N

PRINT 1010, (0.0D0, ICOL = 1, IROW  2),

$ (DLOWER(ICOL + 1), ICOL = ABS(IROW  2), IROW  2),

$ DIAG(IROW),

$ (DLOWER(IROW), ICOL = 1, MIN(1, N  IROW)),

$ (0.0D0, ICOL = IROW + 2, N)

100 CONTINUE

C

C LDL factor A.

C

CALL DPTTRF (N, DIAG, DLOWER, INFO)

IF (INFO .NE. 0) THEN

PRINT 1020, INFO

STOP 1

END IF

C

C Estimate and print the condition number of A.

C

ANORM = 4.0D0

CALL DPTCON (N, DIAG, DLOWER, ANORM, RCOND, WORK, INFO)

IF (INFO .NE. 0) THEN

PRINT 1030, ABS (INFO)

STOP 2

END IF

PRINT 1040, 1.0D0 / RCOND

C

1000 FORMAT (1X, 'A:')

1010 FORMAT (5(3X, F5.2))

1020 FORMAT (1X, 'Error factoring A, INFO = ', I5)

1030 FORMAT (1X, 'Illegal argument to DPTCON, argument #', I2)

1040 FORMAT (/1X, 'Estimated condition number of A: ', F6.2)

C

END

