* C06PJF Example Program Text * Mark 19 Release. NAG Copyright 1999. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NDIM, NMAX, LWORK PARAMETER (NDIM=2,NMAX=96,LWORK=4*NMAX+15) * .. Local Scalars .. INTEGER IFAIL, N * .. Local Arrays .. COMPLEX *16 WORK(LWORK), X(NMAX) INTEGER ND(NDIM) * .. External Subroutines .. EXTERNAL C06PJF, READX, WRITX * .. Executable Statements .. WRITE (NOUT,*) 'C06PJF Example Program Results' * Skip heading in data file READ (NIN,*) 20 CONTINUE READ (NIN,*,END=40) ND(1), ND(2) N = ND(1)*ND(2) IF (N.GE.1 .AND. N.LE.NMAX) THEN CALL READX(NIN,X,ND(1),ND(2)) WRITE (NOUT,*) WRITE (NOUT,*) 'Original data values' CALL WRITX(NOUT,X,ND(1),ND(2)) IFAIL = 0 * * Compute transform CALL C06PJF('F',NDIM,ND,N,X,WORK,LWORK,IFAIL) * WRITE (NOUT,*) WRITE (NOUT,*) 'Components of discrete Fourier transform' CALL WRITX(NOUT,X,ND(1),ND(2)) * * Compute inverse transform CALL C06PJF('B',NDIM,ND,N,X,WORK,LWORK,IFAIL) * WRITE (NOUT,*) WRITE (NOUT,*) + 'Original sequence as restored by inverse transform' CALL WRITX(NOUT,X,ND(1),ND(2)) GO TO 20 ELSE WRITE (NOUT,*) 'Invalid value of N' END IF 40 CONTINUE STOP END * SUBROUTINE READX(NIN,X,N1,N2) * Read 2-dimensional complex data * .. Scalar Arguments .. INTEGER N1, N2, NIN * .. Array Arguments .. COMPLEX *16 X(N1,N2) * .. Local Scalars .. INTEGER I, J * .. Executable Statements .. DO 20 I = 1, N1 READ (NIN,*) (X(I,J),J=1,N2) 20 CONTINUE RETURN END * SUBROUTINE WRITX(NOUT,X,N1,N2) * Print 2-dimensional complex data * .. Scalar Arguments .. INTEGER N1, N2, NOUT * .. Array Arguments .. COMPLEX *16 X(N1,N2) * .. Local Scalars .. INTEGER I, J * .. Executable Statements .. DO 20 I = 1, N1 WRITE (NOUT,*) WRITE (NOUT,99999) (X(I,J),J=1,N2) 20 CONTINUE RETURN * 99999 FORMAT (1X,7(:1X,'(',F6.3,',',F6.3,')')) END