* G05NCF Example Program Text * Mark 22 Release. NAG Copyright 2006. * .. Parameters .. INTEGER NOUT PARAMETER (NOUT=6) INTEGER MSTATE, MSEED, N PARAMETER (MSTATE=633,MSEED=1,N=8) * .. Local Scalars .. INTEGER GENID, I, IFAIL, J, LSEED, LSTATE, M, SUBID * .. Local Arrays .. INTEGER INDEX(N), SEED(MSEED), STATE(MSTATE) * .. External Subroutines .. EXTERNAL G05KFF, G05NCF * .. Executable Statements .. WRITE (NOUT,*) 'G05NCF Example Program Results' WRITE (NOUT,*) * Number of permutations M = 10 * Initialize the seed SEED(1) = 1762543 * GENID and SUBID identify the base generator GENID = 1 SUBID = 1 * Initialize the generator to a repeatable sequence LSTATE = MSTATE LSEED = MSEED IFAIL = 1 CALL G05KFF(GENID,SUBID,SEED,LSEED,STATE,LSTATE,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99997) IFAIL GO TO 60 END IF * WRITE (NOUT,99998) M, ' Permutations of first ', N, ' integers' WRITE (NOUT,*) * Permutate M times DO 40 J = 1, M * Set up the index vector DO 20 I = 1, N INDEX(I) = I 20 CONTINUE * Call the permutation routine IFAIL = 1 CALL G05NCF(INDEX,N,STATE,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99996) IFAIL GO TO 60 END IF * Display the results WRITE (NOUT,99999) (INDEX(I),I=1,N) 40 CONTINUE * 60 CONTINUE * 99999 FORMAT (1X,8I3) 99998 FORMAT (1X,I2,A,I1,A) 99997 FORMAT (1X,' ** G05KFF returned with IFAIL = ',I5) 99996 FORMAT (1X,' ** G05NCF returned with IFAIL = ',I5) END