PROGRAM g05mefe ! G05MEF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : g05kbf, g05mef, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: m = 5, n = 10, nout = 6 ! .. Local Scalars .. INTEGER :: i, ifail, igen, j ! .. Local Arrays .. REAL (KIND=nag_wp) :: vlamda(m) INTEGER :: iseed(4), x(m) ! .. Executable Statements .. WRITE (nout,*) 'G05MEF Example Program Results' WRITE (nout,*) ! Set the distribution parameter LAMBDA vlamda(1) = 0.5E0_nag_wp vlamda(2) = 5.0E0_nag_wp vlamda(3) = 1.0E1_nag_wp vlamda(4) = 5.0E2_nag_wp vlamda(5) = 1.0E3_nag_wp ! Initialize the seed to a repeatable sequence iseed(1) = 1762543 iseed(2) = 9324783 iseed(3) = 423442 iseed(4) = 742355 ! IGEN identifies the stream. igen = 1 CALL g05kbf(igen,iseed) ! Generate integers and store in X DO i = 1, n ifail = 1 CALL g05mef(m,vlamda,x,igen,iseed,ifail) IF (ifail==0) THEN WRITE (nout,99999) (x(j),j=1,m) ELSE WRITE (nout,99998) ifail GO TO 20 END IF END DO 20 CONTINUE 99999 FORMAT (1X,5(1X,I12)) 99998 FORMAT (1X,' ** G05MEF returned with IFAIL = ',I5) END PROGRAM g05mefe