* G03EAF Example Program Text * Mark 16 Release. NAG Copyright 1992. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NMAX, MMAX PARAMETER (NMAX=10,MMAX=10) * .. Local Scalars .. INTEGER I, IFAIL, J, LDX, M, N CHARACTER DIST, SCAL, UPDATE * .. Local Arrays .. DOUBLE PRECISION D(NMAX*(NMAX-1)/2), S(MMAX), X(NMAX,MMAX) INTEGER ISX(MMAX) * .. External Subroutines .. EXTERNAL G03EAF * .. Executable Statements .. WRITE (NOUT,*) 'G03EAF Example Program Results' * Skip heading in data file READ (NIN,*) READ (NIN,*) N, M IF (N.LE.NMAX .AND. M.LE.MMAX) THEN READ (NIN,*) UPDATE, DIST, SCAL DO 20 J = 1, N READ (NIN,*) (X(J,I),I=1,M) 20 CONTINUE READ (NIN,*) (ISX(I),I=1,M) READ (NIN,*) (S(I),I=1,M) * * Compute the distance matrix * IFAIL = 1 LDX = NMAX * CALL G03EAF(UPDATE,DIST,SCAL,N,M,X,LDX,ISX,S,D,IFAIL) * IF (IFAIL.EQ.0) THEN * * Print the distance matrix * WRITE (NOUT,*) WRITE (NOUT,*) ' Distance Matrix' WRITE (NOUT,*) WRITE (NOUT,99999) ' 1 2 3 4' WRITE (NOUT,*) DO 40 I = 2, N WRITE (NOUT,99998) I, (D(J),J=(I-1)*(I-2)/2+1,I*(I-1)/2) 40 CONTINUE ELSE WRITE (NOUT,*) WRITE (NOUT,99997) ' ** G03EAF returned with IFAIL = ', + IFAIL END IF END IF * 99999 FORMAT (5X,A) 99998 FORMAT (1X,I2,2X,4(3X,F5.2)) 99997 FORMAT (1X,A,I5) END