* G05PYF Example Program Text * Mark 22 Release. NAG Copyright 2006. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER MSEED, MSTATE, NMAX PARAMETER (MSEED=1,MSTATE=633,NMAX=10) * .. Local Scalars .. DOUBLE PRECISION EPS INTEGER GENID, I, IFAIL, J, LDC, LSEED, LSTATE, N, SUBID * .. Local Arrays .. DOUBLE PRECISION C(NMAX,NMAX), D(NMAX) INTEGER SEED(MSEED), STATE(MSTATE) * .. External Subroutines .. EXTERNAL G05KFF, G05PYF * .. Executable Statements .. WRITE (NOUT,*) 'G05PYF Example Program Results' WRITE (NOUT,*) * Read data from a file * Skip heading READ (NIN,*) * Read in initial parameters READ (NIN,*) N * Check the specified array limits IF (N.GT.NMAX) THEN WRITE (NOUT,99996) GO TO 40 END IF * Read in the eigenvalues READ (NIN,*) (D(I),I=1,N) * Set the size of C and tolerance LDC = NMAX EPS = 0.00001D0 * 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 * Generate the correlation matrix IFAIL = 1 CALL G05PYF(N,D,EPS,STATE,C,LDC,IFAIL) IF (IFAIL.NE.0) THEN WRITE (NOUT,99997) IFAIL GO TO 40 END IF * Display the results DO 20 I = 1, N WRITE (NOUT,99999) (C(I,J),J=1,N) 20 CONTINUE * 40 CONTINUE * 99999 FORMAT (1X,10F9.3) 99998 FORMAT (1X,' ** G05KFF returned with IFAIL = ',I5) 99997 FORMAT (1X,' ** G05PYF returned with IFAIL = ',I5) 99996 FORMAT (1X,' ** Problem size too large, increase array limits') END