* G08EDF Example Program Text * Mark 22 Revised. NAG Copyright 2006. * .. Parameters .. INTEGER NOUT PARAMETER (NOUT=6) INTEGER M, N, MAXG, MSTATE, MSEED PARAMETER (M=0,N=1000,MAXG=10,MSTATE=200,MSEED=1) DOUBLE PRECISION RLO, RUP, TOTLEN PARAMETER (RLO=0.4D0,RUP=0.6D0,TOTLEN=1.0D0) * .. Local Scalars .. DOUBLE PRECISION CHI, DF, PROB INTEGER GENID, I, IFAIL, IFLGF, J, LSEED, LSTATE, NGAPS, + SUBID CHARACTER CL * .. Local Arrays .. DOUBLE PRECISION EX(MAXG), X(N) INTEGER NCOUNT(MAXG), SEED(MSEED), STATE(MSTATE) * .. External Subroutines .. EXTERNAL G05KFF, G05SQF, G08EDF * .. Executable Statements .. WRITE (NOUT,*) 'G08EDF Example Program Results' * IFLGF = 0 * GENID and SUBID identify the base generator GENID = 1 SUBID = 1 * Initialize the seed SEED(1) = 424232 * Initialize the generator to a repeatable sequence LSTATE = MSTATE LSEED = MSEED CALL G05KFF(GENID,SUBID,SEED,LSEED,STATE,LSTATE,IFLGF) * DO 20 I = 1, 5 * Generate some U(0,1) variates CALL G05SQF(N,0.0D0,1.0D0,STATE,X,IFLGF) * IF (I.EQ.1) THEN CL = 'F' ELSE IF (I.EQ.5) THEN CL = 'L' ELSE CL = 'I' END IF IFAIL = -1 * CALL G08EDF(CL,N,X,M,MAXG,RLO,RUP,TOTLEN,NGAPS,NCOUNT,EX,CHI, + DF,PROB,IFAIL) * IF (CL.NE.'L' .AND. CL.NE.'l' .AND. IFAIL.NE.0) GO TO 40 * 20 CONTINUE IF (IFAIL.EQ.0 .OR. IFAIL.GE.8) THEN WRITE (NOUT,*) WRITE (NOUT,99999) 'Total number of gaps found = ', NGAPS IF (IFAIL.EQ.8) WRITE (NOUT,*) + ' ** Note : the number of gaps requested were not found.' WRITE (NOUT,*) WRITE (NOUT,*) 'Count' WRITE (NOUT,*) + ' 0 1 2 3 4 5 6 7 8' + , ' >9' WRITE (NOUT,99998) (NCOUNT(J),J=1,MAXG) WRITE (NOUT,*) WRITE (NOUT,*) 'Expect' WRITE (NOUT,*) + ' 0 1 2 3 4 5 6 7 8' + , ' >9' WRITE (NOUT,99997) (EX(J),J=1,MAXG) WRITE (NOUT,*) WRITE (NOUT,99996) 'Chisq = ', CHI WRITE (NOUT,99995) 'DF = ', DF WRITE (NOUT,99996) 'Prob = ', PROB IF (IFAIL.EQ.9) WRITE (NOUT,*) + ' ** Note : the chi square approximation may not be very good.' END IF 40 CONTINUE * 99999 FORMAT (1X,A,I10) 99998 FORMAT (1X,10I7) 99997 FORMAT (1X,10F7.1) 99996 FORMAT (1X,A,F10.4) 99995 FORMAT (1X,A,F7.1) END