If you choose not to modify your application to use FFTPACK data format throughout, you can instead do all the conversions just before (and after) calling the FFTPACK routines. So, if your application supplied frequency domain data in NAG format, first convert it to FFTPACK format using the PDA_DNAG2C routine:
DOUBLE PRECISION X(N), Y(N), C(2*N)
CALL PDA_DNAG2C( N, X, Y, C )
where C is an additional work array used to hold the FFTPACK format data, ready for use by PDA_DCFFTB. X and Y are the supplied frequency domain data in NAG format. If this call to PDA_DC2NAG is made, the values returned by PDA_DCFFTB will have the same normalisation as the original data supplied to PDA_DCFFTF.
The work array passed to the FFT routine needs to be increased in size from N elements (for NAG) to 4*N+15 (for FFTPACK).
Using NAG, the inverse transform is usually done by the three calls:
CALL C06GCF( Y, N, IFAIL )
CALL C06FCF( X, Y, N, WORK, IFAIL )
CALL C06GCF( Y, N, IFAIL )
These three calls should be replaced by the single call:
CALL PDA_DCFFTB( N, C, WORK )
where C is the array into which the X and Y arrays have been converted using the method of the previous section.
The WORK array passed to PDA_DCFFTB should be initialised using PDA_DCFFTI before calling PDA_DCFFTB. Once the array has been initialised it can be used in multiple calls to PDA_DCFFTF and PDA_DCFFTB so long as they all have the same value for N.
NAG puts the spatial domain results into two arrays (one real, one imaginary), whereas FFTPACK puts them into one. You can either modify your application to use the FFTPACK format or convert the FFTPACK results into NAG-style results using code such as:
DOUBLE PRECISION X( N ), Y( N ), C( 2*N )
DO J = 1, N
I = 2*J
X( J ) = C( I - 1 )
Y( J ) = C( I )
END DO
or
DOUBLE PRECISION X( N ), Y( N ), C( 2, N )
DO J = 1, N
X( J ) = C( 1, J )
Y( J ) = C( 2, J )
END DO
PDA [1ex