* G05YMF Example Program Text * Mark 22 Release. NAG Copyright 2006. * .. Parameters .. INTEGER NOUT PARAMETER (NOUT=6) INTEGER MN, MIDIM, ORDRC PARAMETER (MN=200,MIDIM=8,ORDRC=1) INTEGER LDQUAS, TDQUAS PARAMETER (LDQUAS=MIDIM,TDQUAS=MN) INTEGER LIREF PARAMETER (LIREF=32*MIDIM+7) * .. Local Scalars .. DOUBLE PRECISION SUM, TMP, VSBL INTEGER D, GENID, I, IDIM, IFAIL, ISKIP, J, N * .. Local Arrays .. DOUBLE PRECISION QUAS(LDQUAS,TDQUAS) INTEGER IREF(LIREF) * .. External Subroutines .. EXTERNAL G05YLF, G05YMF * .. Intrinsic Functions .. INTRINSIC ABS, DBLE * .. Executable Statements .. WRITE (NOUT,99999) 'G05YMF Example Program Results' IDIM = 8 N = MN * Skip the first few variates in the sequence ISKIP = 1000 * Initialize the Sobol generator GENID = 1 IFAIL = 1 CALL G05YLF(GENID,IDIM,IREF,LIREF,ISKIP,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99997) IFAIL GO TO 80 END IF * Generate N quasi-random variates IFAIL = 1 CALL G05YMF(N,ORDRC,QUAS,LDQUAS,IREF,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99996) IFAIL GO TO 80 END IF * Evaluate the function, and sum SUM = 0.0D0 DO 40 I = 1, N TMP = 1.0D0 DO 20 D = 1, IDIM TMP = TMP*ABS(4.0D0*QUAS(D,I)-2.0D0) 20 CONTINUE SUM = SUM + TMP 40 CONTINUE * Convert sum to mean value VSBL = SUM/DBLE(N) WRITE (NOUT,99999) WRITE (NOUT,99999) 'Value of integral = ', VSBL * Dump the first 10 variates WRITE (NOUT,99999) WRITE (NOUT,99999) 'First 10 variates' DO 60 I = 1, 10 WRITE (NOUT,99998) I, (QUAS(J,I),J=1,IDIM) 60 CONTINUE * 80 CONTINUE * 99999 FORMAT (1X,A,F8.4) 99998 FORMAT (1X,I3,20(1X,F8.4)) 99997 FORMAT (1X,' ** G05YLF returned with IFAIL = ',I5) 99996 FORMAT (1X,' ** G05YMF returned with IFAIL = ',I5) END