* F11DBF Example Program Text * Mark 18 Release. NAG Copyright 1997. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NMAX, LA, LIWORK PARAMETER (NMAX=1000,LA=10000,LIWORK=7*NMAX+2) * .. Local Scalars .. DOUBLE PRECISION DTOL INTEGER I, IFAIL, LFILL, N, NNZ, NNZC, NPIVM CHARACTER CHECK, MILU, PSTRAT, TRANS * .. Local Arrays .. DOUBLE PRECISION A(LA), X(NMAX), Y(NMAX) INTEGER ICOL(LA), IDIAG(NMAX), IPIVP(NMAX), IPIVQ(NMAX), + IROW(LA), ISTR(NMAX+1), IWORK(LIWORK) * .. External Subroutines .. EXTERNAL F11DAF, F11DBF * .. Executable Statements .. WRITE (NOUT,*) 'F11DBF Example Program Results' WRITE (NOUT,*) * * Skip heading in data file * READ (NIN,*) * * Read order of matrix and number of non-zero entries * READ (NIN,*) N IF (N.LE.NMAX) THEN READ (NIN,*) NNZ * * Read the matrix A * DO 20 I = 1, NNZ READ (NIN,*) A(I), IROW(I), ICOL(I) 20 CONTINUE * * Read the vector y * READ (NIN,*) (Y(I),I=1,N) * * Calculate LU factorization * LFILL = -1 DTOL = 0.D0 PSTRAT = 'C' MILU = 'N' IFAIL = 0 * CALL F11DAF(N,NNZ,A,LA,IROW,ICOL,LFILL,DTOL,PSTRAT,MILU,IPIVP, + IPIVQ,ISTR,IDIAG,NNZC,NPIVM,IWORK,LIWORK,IFAIL) * * Check value of NPIVM * IF (NPIVM.GT.0) THEN * WRITE (NOUT,*) 'Factorization is not complete' * ELSE * * Solve P L D U x = y * TRANS = 'N' CHECK = 'C' * CALL F11DBF(TRANS,N,A,LA,IROW,ICOL,IPIVP,IPIVQ,ISTR,IDIAG, + CHECK,Y,X,IFAIL) * * Output results * WRITE (NOUT,*) ' Solution of linear system' DO 40 I = 1, N WRITE (NOUT,'(D16.4)') X(I) 40 CONTINUE * END IF * END IF STOP END