* G05RZF Example Program Text * Mark 22 Release. NAG Copyright 2006. * .. Parameters .. INTEGER NOUT PARAMETER (NOUT=6) INTEGER MSEED, MSTATE, LDC, LDX, LR PARAMETER (MSEED=1,MSTATE=633,LDC=5,LDX=100, + LR=LDC*LDC+LDC+1) * .. Local Scalars .. INTEGER GENID, I, IFAIL, J, LSEED, LSTATE, M, MODE, N, + SUBID * .. Local Arrays .. DOUBLE PRECISION C(LDC,LDC), R(LR), X(LDX,LDC), XMU(LDC) INTEGER SEED(MSEED), STATE(MSTATE) * .. External Subroutines .. EXTERNAL G05KFF, G05RZF * .. Executable Statements .. WRITE (NOUT,*) 'G05RZF Example Program Results' WRITE (NOUT,*) * Set the number of variables and variates M = 4 N = 10 * Input the upper triangle portion of the covariance matrix C(1,1) = 1.69D0 C(1,2) = 0.39D0 C(1,3) = -1.86D0 C(1,4) = 0.07D0 C(2,2) = 98.01D0 C(2,3) = -7.07D0 C(2,4) = -0.71D0 C(3,3) = 11.56D0 C(3,4) = 0.03D0 C(4,4) = 0.01D0 * Input the means XMU(1) = 1.0D0 XMU(2) = 2.0D0 XMU(3) = -3.0D0 XMU(4) = 0.0D0 * 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 40 END IF * Set up reference vector and generate N numbers * Choose MODE = 2 MODE = 2 IFAIL = 1 CALL G05RZF(MODE,N,M,XMU,C,LDC,R,LR,STATE,X,LDX,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99997) IFAIL GO TO 40 END IF * Display the variates DO 20 I = 1, N WRITE (NOUT,99999) (X(I,J),J=1,M) 20 CONTINUE * 40 CONTINUE * 99999 FORMAT (1X,10F10.4) 99998 FORMAT (1X,' ** G05KFF returned with IFAIL = ',I5) 99997 FORMAT (1X,' ** G05RZF returned with IFAIL = ',I5) END