* G05SEF Example Program Text * Mark 22 Release. NAG Copyright 2006. * .. Parameters .. INTEGER NOUT PARAMETER (NOUT=6) INTEGER MSTATE, MSEED, N, M, LDX PARAMETER (MSTATE=633,MSEED=1,N=5,M=4,LDX=N) * .. Local Scalars .. INTEGER GENID, I, IFAIL, J, LSEED, LSTATE, SUBID * .. Local Arrays .. DOUBLE PRECISION A(M), X(LDX,M) INTEGER SEED(MSEED), STATE(MSTATE) * .. External Subroutines .. EXTERNAL G05KFF, G05SEF * .. Executable Statements .. WRITE (NOUT,*) 'G05SEF Example Program Results' WRITE (NOUT,*) * Set the distribution parameters A DO 20 I = 1, M A(I) = 2.0D0 20 CONTINUE * 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 * Generate the variates IFAIL = 1 CALL G05SEF(N,M,A,STATE,X,LDX,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99997) IFAIL GO TO 60 END IF * Display the variates DO 40 I = 1, N WRITE (NOUT,99999) (X(I,J),J=1,M) 40 CONTINUE * 60 CONTINUE * 99999 FORMAT (4(1X,F10.4)) 99998 FORMAT (1X,' ** G05KFF returned with IFAIL = ',I5) 99997 FORMAT (1X,' ** G05SEF returned with IFAIL = ',I5) END