* G01AAF Example Program Text * Mark 14 Revised. NAG Copyright 1989. * .. Parameters .. INTEGER NMAX PARAMETER (NMAX=30) INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) * .. Local Scalars .. DOUBLE PRECISION S2, S3, S4, WTSUM, XMAX, XMEAN, XMIN INTEGER I, IFAIL, IWT, J, N, NPROB * .. Local Arrays .. DOUBLE PRECISION WT(NMAX), WTIN(NMAX), X(NMAX) * .. External Subroutines .. EXTERNAL DCOPY, G01AAF * .. Executable Statements .. WRITE (NOUT,*) 'G01AAF Example Program Results' * Skip heading in data file READ (NIN,*) READ (NIN,*) NPROB DO 20 J = 1, NPROB READ (NIN,*) N, IWT IF (N.GE.1 .AND. N.LE.NMAX) THEN READ (NIN,*) (X(I),I=1,N) IF (IWT.EQ.1) THEN READ (NIN,*) (WTIN(I),I=1,N) CALL DCOPY(N,WTIN,1,WT,1) END IF IFAIL = 1 * CALL G01AAF(N,X,IWT,WT,XMEAN,S2,S3,S4,XMIN,XMAX,WTSUM,IFAIL) * IF (IFAIL.GE.0) THEN WRITE (NOUT,*) WRITE (NOUT,99999) 'Problem ', J WRITE (NOUT,99999) 'Number of cases ', N WRITE (NOUT,*) 'Data as input -' WRITE (NOUT,99998) (X(I),I=1,N) IF (IWT.EQ.1) THEN WRITE (NOUT,*) 'Weights as input -' WRITE (NOUT,99998) (WTIN(I),I=1,N) END IF WRITE (NOUT,*) END IF IF (IFAIL.EQ.0) THEN WRITE (NOUT,*) 'Successful call of G01AAF' WRITE (NOUT,99999) 'No. of valid cases ', IWT WRITE (NOUT,99997) 'Mean ', XMEAN WRITE (NOUT,99997) 'Std devn ', S2 WRITE (NOUT,99997) 'Skewness ', S3 WRITE (NOUT,99997) 'Kurtosis ', S4 WRITE (NOUT,99997) 'Minimum ', XMIN WRITE (NOUT,99997) 'Maximum ', XMAX WRITE (NOUT,99997) 'Sum of weights', WTSUM ELSE IF (IFAIL.GT.0) THEN WRITE (NOUT,*) 'Unsuccessful call of G01AAF' WRITE (NOUT,99999) 'IFAIL =', IFAIL IF (IFAIL.EQ.2) THEN WRITE (NOUT,99999) 'No. of valid cases', IWT WRITE (NOUT,99997) 'Mean ', XMEAN WRITE (NOUT,99997) 'Minimum ', XMIN WRITE (NOUT,99997) 'Maximum ', XMAX WRITE (NOUT,99997) 'Sum of weights', WTSUM WRITE (NOUT,*) 'Std devn and coeffts of skewness' WRITE (NOUT,*) 'and kurtosis not defined' END IF ELSE WRITE (NOUT,99996) IFAIL GO TO 40 END IF ELSE GO TO 40 END IF 20 CONTINUE 40 CONTINUE * 99999 FORMAT (1X,A,I5) 99998 FORMAT (1X,5F12.1) 99997 FORMAT (1X,A,F13.1) 99996 FORMAT (1X,/1X,' ** G01AAF returned with IFAIL = ',I5) END