* C06HBF Example Program Text * Mark 14 Revised. NAG Copyright 1989. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER MMAX, NMAX PARAMETER (MMAX=5,NMAX=20) * .. Local Scalars .. INTEGER I, IFAIL, J, M, N * .. Local Arrays .. DOUBLE PRECISION TRIG(2*NMAX), WORK(MMAX*NMAX), X((NMAX+1)*MMAX) * .. External Subroutines .. EXTERNAL C06HBF * .. Executable Statements .. WRITE (NOUT,*) 'C06HBF Example Program Results' * Skip heading in data file READ (NIN,*) 20 READ (NIN,*,END=120) M, N IF (M.LE.MMAX .AND. N.LE.NMAX) THEN DO 40 J = 1, M READ (NIN,*) (X(I*M+J),I=0,N) 40 CONTINUE WRITE (NOUT,*) WRITE (NOUT,*) 'Original data values' WRITE (NOUT,*) DO 60 J = 1, M WRITE (NOUT,99999) (X(I*M+J),I=0,N) 60 CONTINUE IFAIL = 0 * * -- Compute transform CALL C06HBF(M,N,X,'Initial',TRIG,WORK,IFAIL) * WRITE (NOUT,*) WRITE (NOUT,*) 'Discrete Fourier cosine transforms' WRITE (NOUT,*) DO 80 J = 1, M WRITE (NOUT,99999) (X(I*M+J),I=0,N) 80 CONTINUE * * -- Compute inverse transform CALL C06HBF(M,N,X,'Subsequent',TRIG,WORK,IFAIL) * WRITE (NOUT,*) WRITE (NOUT,*) 'Original data as restored by inverse transform' WRITE (NOUT,*) DO 100 J = 1, M WRITE (NOUT,99999) (X(I*M+J),I=0,N) 100 CONTINUE GO TO 20 ELSE WRITE (NOUT,*) 'Invalid value of M or N' END IF 120 STOP * 99999 FORMAT (6X,7F10.4) END