* F11ZNF Example Program Text * Mark 19 Release. 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 .. COMPLEX *16 A(LA) INTEGER ICOL(LA), IROW(LA), ISTR(NMAX+1), IWORK(NMAX) * .. External Subroutines .. EXTERNAL F11ZNF * .. Executable Statements .. WRITE (NOUT,*) 'F11ZNF 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,5X,''('',E16.4,'','',E16.4,'')'',2I8)') I, + A(I), IROW(I), ICOL(I) 40 CONTINUE * * Reorder, sum duplicates and remove zeros * DUP = 'S' ZERO = 'R' IFAIL = 0 * CALL F11ZNF(N,NNZ,A,IROW,ICOL,DUP,ZERO,ISTR,IWORK,IFAIL) * * Output results * WRITE (NOUT,*) 'Reordered elements' WRITE (NOUT,'(A,I4)') ' NNZ = ', NNZ DO 60 I = 1, NNZ WRITE (NOUT,'(I8,5X,''('',E16.4,'','',E16.4,'')'',2I8)') I, + A(I), IROW(I), ICOL(I) 60 CONTINUE * END IF STOP END