* G05PFF Example Program Text * Mark 22 Release. NAG Copyright 2006. * .. Parameters .. INTEGER NOUT PARAMETER (NOUT=6) INTEGER MSTATE, MSEED, NUM, IP, IQ PARAMETER (MSTATE=633,MSEED=1,NUM=10,IP=1,IQ=1) INTEGER LR PARAMETER (LR=2*(IQ+IP+2)) * .. Local Scalars .. DOUBLE PRECISION GAMMA INTEGER DF, GENID, I, IFAIL, LSEED, LSTATE, SUBID LOGICAL FCALL CHARACTER DIST * .. Local Arrays .. DOUBLE PRECISION ET(NUM), HT(NUM), R(LR), THETA(IP+IQ+1) INTEGER SEED(MSEED), STATE(MSTATE) * .. External Subroutines .. EXTERNAL G05KFF, G05PFF * .. Executable Statements .. WRITE (NOUT,*) 'G05PFF 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,99998) IFAIL GO TO 60 END IF * Set up the parameters for the series being generated DIST = 'N' THETA(1) = 0.4D0 THETA(2) = 0.1D0 THETA(3) = 0.7D0 GAMMA = 0.1D0 DF = 0 FCALL = .TRUE. * Generate the first realisation IFAIL = 1 CALL G05PFF(DIST,NUM,IP,IQ,THETA,GAMMA,DF,HT,ET,FCALL,R,LR,STATE, + IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99997) IFAIL GO TO 60 END IF * Display the results WRITE (NOUT,*) WRITE (NOUT,*) ' Realisation Number 1' WRITE (NOUT,*) ' I HT(I) ET(I)' WRITE (NOUT,*) ' --------------------------------------' DO 20 I = 1, NUM WRITE (NOUT,99999) I, HT(I), ET(I) 20 CONTINUE * Generate a second realisation FCALL = .FALSE. IFAIL = 1 CALL G05PFF(DIST,NUM,IP,IQ,THETA,GAMMA,DF,HT,ET,FCALL,R,LR,STATE, + IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99997) IFAIL GO TO 60 END IF * Display the results WRITE (NOUT,*) WRITE (NOUT,*) ' Realisation Number 2' WRITE (NOUT,*) ' I HT(I) ET(I)' WRITE (NOUT,*) ' --------------------------------------' DO 40 I = 1, NUM WRITE (NOUT,99999) I, HT(I), ET(I) 40 CONTINUE * 60 CONTINUE * 99999 FORMAT (1X,I5,2(1X,F16.4)) 99998 FORMAT (1X,' ** G05KFF returned with IFAIL = ',I5) 99997 FORMAT (1X,' ** G05PFF returned with IFAIL = ',I5) END