* G05NDF 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, LSEED, LSTATE, M, SUBID * .. Local Arrays .. INTEGER IPOP(N), ISAMPL(N), SEED(MSEED), STATE(MSTATE) * .. External Subroutines .. EXTERNAL G05KFF, G05NDF * .. Executable Statements .. WRITE (NOUT,*) 'G05NDF Example Program Results' WRITE (NOUT,*) * 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,99999) ' Samples from the first ', N, ' integers' WRITE (NOUT,*) WRITE (NOUT,*) ' Sample size Values' * Initialize the population DO 20 I = 1, N IPOP(I) = I 20 CONTINUE * Generate samples of different sizes DO 40 M = 1, N IFAIL = 1 CALL G05NDF(IPOP,N,ISAMPL,M,STATE,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99996) IFAIL GO TO 60 END IF * Display the results WRITE (NOUT,99998) M, (ISAMPL(I),I=1,M) 40 CONTINUE * 60 CONTINUE * 99999 FORMAT (1X,A,I1,A) 99998 FORMAT (1X,I6,10X,8I3) 99997 FORMAT (1X,' ** G05KFF returned with IFAIL = ',I5) 99996 FORMAT (1X,' ** G05NDF returned with IFAIL = ',I5) END