KPG1_R2NAG

Converts an FFTPACK Hermitian Fourier transform array into the equivalent NAG array

Description:

This subroutine re-orders and normalises the supplied array of Fourier co-efficients (as produced by FFTPACK subroutine KPG1_RFFTF) so that the returned array looks like the equivalent array returned by NAG routine C06FAE.

This function is equivalent to PDA_R2NAG except that it uses work space for greater speed.

The real and imaginary co-efficients produced by KPG1_RFFTF are numerically larger than the corresponding C06FAE co-efficients by a factor of SQRT( NP ), and are ordered differently. Both routines return A0 (the zeroth real term, i.e. the DC level in the array) in element 1. KPG1_RFFTF then has corresponding real and imaginary terms in adjacent elements, whereas C06FAE has all the real terms together, followed by all the imaginary terms (in reverse order):

KPG1_RFFTF : A0, A1, B1, A2, B2, A3, B3, ... C06FAE: 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 is imaginary terms (excluding A0), i.e. if NP = 10, then the co-efficients are stored as follows:

KPG1_RFFTF : A0, A1, B1, A2, B2, A3, B3, A4, B4, A5 C06FAE: A0, A1, A2, A3, A4, A5, B4, B3, B2, B1

If NP = 9, then the co-efficients are stored as follows:

KPG1_RFFTF : A0, A1, B1, A2, B2, A3, B3, A4, B4 C06FAE: A0, A1, A2, A3, A4, B4, B3, B2, B1

Invocation

CALL KPG1_R2NAG( NP, R, WORK )

Arguments

NP = INTEGER (Given)
The size of the array.
R( NP ) = REAL (Given and Returned)
The array holding the Fourier co-efficients. Supplied in FFTPACK format, returned in NAG format.
WORK( NP ) = REAL (Given and Returned)
Work space.