The relevant NAG routines are C06FAF and C06FBF (the ``Hermitian'' routines), and the FFTPACK routines are PDA_DRFFTI, PDA_DRFFTF and PDA_DRFFTB. These routines take advantage of the symmetries present in the Fourier transform of a purely real sequence. Only half of the real (A) and imaginary (B) terms need to be calculated and stored because the other halves are just the same. This means that only half the space is required to store the Fourier transform (i.e. N elements rather than 2*N), and it takes roughly half the time to evaluate. The disadvantage is that the resulting Fourier transform array can be rather more difficult to use than if all the real and imaginary parts are stored explicitly. There are routines PDA_DNAG2R and PDA_DR2NAG to do in-situ conversions between NAG and FFTPACK format. Note, each of these routines divides the supplied values by SQRT(N), so successive calls to PDA_DR2NAG and PDA_DNAG2R do not leave the original data unaffected (they are divided by N). This is done to cancel the effect of successive calls of PDA_DRFFTF and PDA_DRFFTB which multiplies the original data by N.
The real and imaginary coefficients produced by PDA_DRFFTF are numerically larger than the corresponding C06FAF coefficients by a factor of SQRT(N), and are ordered differently in the returned arrays. Both routines return A0 (i.e. the DC level in the array) in element 1. PDA_DRFFTF then has corresponding real and imaginary terms in adjacent elements, whereas C06FAF has all the real terms together, followed by all the imaginary terms (in reverse order):
PDA_DRFFTF: A0, A1, B1, A2, B2, A3, B3, ... C06FAF: A0, A1, A2, A3, ..., ..., B3, B2, B1
The zeroth imaginary term (B0) always has the value zero and so is not stored in the array. Care has to be taken about the parity of the array size. If it is even, then there is one more real term than there are imaginary terms (excluding A0), i.e. if N = 10, then the coefficients are stored as follows:
PDA_DRFFTF: A0, A1, B1, A2, B2, A3, B3, A4, B4, A5 C06FAF: A0, A1, A2, A3, A4, A5, B4, B3, B2, B1
If N = 9, then the coefficients are stored as follows:
PDA_DRFFTF: A0, A1, B1, A2, B2, A3, B3, A4, B4 C06FAF: A0, A1, A2, A3, A4, B4, B3, B2, B1
PDA [1ex