* F11MDF Example Program Text * Mark 21 Release. NAG Copyright 2004. * .. 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 SPEC * .. Local Arrays .. INTEGER ICOLZP(NMAX+1), IPRM(7*NMAX), IROWIX(LA) * .. External Subroutines .. EXTERNAL F11MDF * .. Executable Statements .. WRITE (NOUT,*) 'F11MDF Example Program Results' * Skip heading in data file READ (NIN,*) * * Read order of matrix * READ (NIN,*) N IF (N.LE.NMAX) THEN * * Read the matrix A * DO 20 I = 1, N + 1 READ (NIN,*) ICOLZP(I) 20 CONTINUE NNZ = ICOLZP(N+1) - 1 DO 40 I = 1, NNZ READ (NIN,*) IROWIX(I) 40 CONTINUE * * Calculate COLAMD permutation * SPEC = 'M' IFAIL = 0 CALL F11MDF(SPEC,N,ICOLZP,IROWIX,IPRM,IFAIL) * * Output results * WRITE (NOUT,*) WRITE (NOUT,*) 'COLAMD Permutation' WRITE (NOUT,'(10I6)') (IPRM(I),I=1,N) * * Calculate user permutation * SPEC = 'U' IFAIL = 0 IPRM(1) = 4 IPRM(2) = 3 IPRM(3) = 2 IPRM(4) = 1 IPRM(5) = 0 CALL F11MDF(SPEC,N,ICOLZP,IROWIX,IPRM,IFAIL) * * Output results * WRITE (NOUT,*) WRITE (NOUT,*) 'User Permutation' WRITE (NOUT,'(10I6)') (IPRM(I),I=1,N) * * Calculate natural permutation * SPEC = 'N' IFAIL = 0 CALL F11MDF(SPEC,N,ICOLZP,IROWIX,IPRM,IFAIL) * * Output results * WRITE (NOUT,*) WRITE (NOUT,*) 'Natural Permutation' WRITE (NOUT,'(10I6)') (IPRM(I),I=1,N) * END IF END