* G05RAF Example Program Text * Mark 21 Release. NAG Copyright 2004. * .. Parameters .. INTEGER NOUT, LDC, LDX, LR PARAMETER (NOUT=6,LDC=5,LDX=100,LR=LDC*LDC+LDC+1) * .. Local Scalars .. INTEGER I, IFAIL, IGEN, J, M, MODE, N * .. Local Arrays .. DOUBLE PRECISION C(LDC,LDC), R(LR), X(LDX,LDC) INTEGER ISEED(4) * .. External Subroutines .. EXTERNAL G05KBF, G05RAF * .. Executable Statements .. CONTINUE * WRITE (NOUT,*) 'G05RAF Example Program Results' WRITE (NOUT,*) * * Initialize the seed to a repeatable sequence ISEED(1) = 1762543 ISEED(2) = 9324783 ISEED(3) = 42344 ISEED(4) = 742355 * * Choose the random generator to use IGEN = 1 * * Initialize the random generator CALL G05KBF(IGEN,ISEED) * * 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 * MODE = 0 IFAIL = 1 * * Set up reference vector and generate N numbers CALL G05RAF(MODE,M,C,LDC,N,X,LDX,IGEN,ISEED,R,LR,IFAIL) * IF (IFAIL.EQ.0) THEN * Display the results DO 20 I = 1, N WRITE (NOUT,99999) (X(I,J),J=1,M) 20 CONTINUE ELSE WRITE (NOUT,99998) IFAIL END IF * 99999 FORMAT (1X,10F10.4) 99998 FORMAT (1X,' ** G05RAF returned with IFAIL = ',I5) END