* F07CDF Example Program Text * Mark 21 Release. NAG Copyright 2004. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NMAX PARAMETER (NMAX=50) * .. Local Scalars .. INTEGER I, INFO, N * .. Local Arrays .. DOUBLE PRECISION D(NMAX), DL(NMAX-1), DU(NMAX-1), DU2(NMAX-2) INTEGER IPIV(NMAX) * .. External Subroutines .. EXTERNAL DGTTRF * .. Executable Statements .. WRITE (NOUT,*) 'F07CDF Example Program Results' WRITE (NOUT,*) * Skip heading in data file READ (NIN,*) READ (NIN,*) N IF (N.LE.NMAX) THEN * * Read the tridiagonal matrix A from data file * READ (NIN,*) (DU(I),I=1,N-1) READ (NIN,*) (D(I),I=1,N) READ (NIN,*) (DL(I),I=1,N-1) * * Factorize the tridiagonal matrix A * CALL DGTTRF(N,DL,D,DU,DU2,IPIV,INFO) * IF (INFO.GT.0) THEN WRITE (NOUT,99999) 'The (', INFO, ',', INFO, ')', + ' element of the factor U is zero' END IF * * Print details of the factorization * WRITE (NOUT,*) 'Details of factorization' WRITE (NOUT,*) WRITE (NOUT,*) ' Second super-diagonal of U' WRITE (NOUT,99998) (DU2(I),I=1,N-2) WRITE (NOUT,*) WRITE (NOUT,*) ' First super-diagonal of U' WRITE (NOUT,99998) (DU(I),I=1,N-1) WRITE (NOUT,*) WRITE (NOUT,*) ' Main diagonal of U' WRITE (NOUT,99998) (D(I),I=1,N) WRITE (NOUT,*) WRITE (NOUT,*) ' Multipliers' WRITE (NOUT,99998) (DL(I),I=1,N-1) WRITE (NOUT,*) WRITE (NOUT,*) ' Vector of interchanges' WRITE (NOUT,99997) (IPIV(I),I=1,N) * ELSE WRITE (NOUT,*) 'NMAX too small' END IF * 99999 FORMAT (1X,A,I3,A,I3,A,A) 99998 FORMAT (1X,8F9.4) 99997 FORMAT (1X,5I9) END