* G01AEF Example Program Text * Mark 14 Revised. NAG Copyright 1989. * .. Parameters .. INTEGER NMAX, K2MAX PARAMETER (NMAX=71,K2MAX=10) INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) * .. Local Scalars .. DOUBLE PRECISION XMAX, XMIN INTEGER I, ICLASS, IFAIL, J, K, N, NPROB * .. Local Arrays .. DOUBLE PRECISION CB(K2MAX), X(NMAX) INTEGER IFREQ(K2MAX) * .. External Subroutines .. EXTERNAL G01AEF * .. Executable Statements .. WRITE (NOUT,*) 'G01AEF Example Program Results' * Skip heading in data file READ (NIN,*) READ (NIN,*) NPROB DO 20 I = 1, NPROB READ (NIN,*) N, ICLASS, K IF (N.GE.1 .AND. N.LE.NMAX .AND. K.GE.0 .AND. K.LE.K2MAX-2) + THEN READ (NIN,*) (X(J),J=1,N) WRITE (NOUT,*) WRITE (NOUT,99997) 'Problem ', I WRITE (NOUT,99997) 'Number of cases', N WRITE (NOUT,99997) 'Number of classes', K K = K + 1 IF (ICLASS.NE.1) THEN WRITE (NOUT,*) 'Routine-supplied class boundaries' ELSE READ (NIN,*) (CB(J),J=1,K) WRITE (NOUT,*) 'User-supplied class boundaries' END IF K = K + 1 IFAIL = 1 * CALL G01AEF(N,K,X,ICLASS,CB,IFREQ,XMIN,XMAX,IFAIL) * WRITE (NOUT,*) IF (IFAIL.EQ.0) THEN WRITE (NOUT,*) 'Successful call of G01AEF' WRITE (NOUT,*) WRITE (NOUT,*) '*** Frequency distribution ***' WRITE (NOUT,*) WRITE (NOUT,*) ' Class Frequency' WRITE (NOUT,*) WRITE (NOUT,99999) ' Up to ', CB(1), IFREQ(1) K = K - 1 IF (K.GT.1) WRITE (NOUT,99998) (CB(J-1),' to ',CB(J), + IFREQ(J),J=2,K) WRITE (NOUT,99996) CB(K), ' and over ', IFREQ(K+1) WRITE (NOUT,*) WRITE (NOUT,99995) 'Total frequency = ', N WRITE (NOUT,99994) 'Minimum = ', XMIN WRITE (NOUT,99994) 'Maximum = ', XMAX ELSE WRITE (NOUT,99993) IFAIL GO TO 40 END IF ELSE GO TO 40 END IF 20 CONTINUE 40 CONTINUE * 99999 FORMAT (1X,A,F8.2,I11) 99998 FORMAT (1X,F8.2,A,F8.2,I11) 99997 FORMAT (1X,A,I4) 99996 FORMAT (1X,F8.2,A,I9) 99995 FORMAT (1X,A,I6) 99994 FORMAT (1X,A,F9.2) 99993 FORMAT (1X,/1X,' ** G01AEF returned with IFAIL = ',I5) END