* F11ZAF Example Program Text * Mark 19 Revised. NAG Copyright 1999. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER LA, NMAX PARAMETER (LA=10000,NMAX=1000) * .. Local Scalars .. INTEGER I, IFAIL, N, NNZ CHARACTER DUP, ZERO * .. Local Arrays .. DOUBLE PRECISION A(LA) INTEGER ICOL(LA), IROW(LA), ISTR(NMAX+1), IWORK(NMAX) * .. External Subroutines .. EXTERNAL F11ZAF * .. Executable Statements .. WRITE (NOUT,*) 'F11ZAF 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 and output the original non-zero elements * DO 20 I = 1, NNZ READ (NIN,*) A(I), IROW(I), ICOL(I) 20 CONTINUE WRITE (NOUT,*) 'Original elements' WRITE (NOUT,'(A,I4)') ' NNZ = ', NNZ DO 40 I = 1, NNZ WRITE (NOUT,'(I8,E16.4,2I8)') I, A(I), IROW(I), ICOL(I) 40 CONTINUE * * Reorder, sum duplicates and remove zeros * DUP = 'S' ZERO = 'R' IFAIL = 1 * CALL F11ZAF(N,NNZ,A,IROW,ICOL,DUP,ZERO,ISTR,IWORK,IFAIL) IF (IFAIL.EQ.0) THEN * * Output results * WRITE (NOUT,*) 'Reordered elements' WRITE (NOUT,'(A,I4)') ' NNZ = ', NNZ DO 60 I = 1, NNZ WRITE (NOUT,'(I8,E16.4,2I8)') I, A(I), IROW(I), ICOL(I) 60 CONTINUE * ELSE WRITE (NOUT,99999) IFAIL END IF END IF * 99999 FORMAT (1X,/1X,' ** F11ZAF returned with IFAIL = ',I5) END