naginterfaces.library.sum.fft_​qtrcosine¶

naginterfaces.library.sum.fft_qtrcosine(idir, x)[source]

fft_qtrcosine computes the discrete quarter-wave Fourier cosine transforms of sequences of real data values. The elements of each sequence and its transform are stored contiguously.

For full information please refer to the NAG Library document for c06rh

https://www.nag.com/numeric/nl/nagdoc_27.3/flhtml/c06/c06rhf.html

Parameters
idirint

Indicates the transform, as defined in Notes, to be computed.

Forward transform.

Inverse transform.

xfloat, array-like, shape

The data values of the th sequence to be transformed, denoted by , for , for , must be stored in .

Returns
xfloat, ndarray, shape

The components of the th quarter-wave cosine transform, denoted by , for , for , are stored in , overwriting the corresponding original values.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: or .

(errno )

An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.

Notes

Given sequences of real data values , for , for , fft_qtrcosine simultaneously calculates the quarter-wave Fourier cosine transforms of all the sequences defined by

or its inverse

where and .

(Note the scale factor in this definition.)

A call of fft_qtrcosine with followed by a call with will restore the original data.

The two transforms are also known as type-III DCT and type-II DCT, respectively.

The transform calculated by this function can be used to solve Poisson’s equation when the derivative of the solution is specified at the left boundary, and the solution is specified at the right boundary (see Swarztrauber (1977)).

The function uses a variant of the fast Fourier transform (FFT) algorithm (see Brigham (1974)) known as the Stockham self-sorting algorithm, described in Temperton (1983), together with pre - and post-processing stages described in Swarztrauber (1982). Special coding is provided for the factors , , and .

References

Brigham, E O, 1974, The Fast Fourier Transform, Prentice–Hall

Swarztrauber, P N, 1977, The methods of cyclic reduction, Fourier analysis and the FACR algorithm for the discrete solution of Poisson’s equation on a rectangle, SIAM Rev. (19(3)), 490–501

Swarztrauber, P N, 1982, Vectorizing the FFT’s, Parallel Computation, (ed G Rodrique), 51–83, Academic Press

Temperton, C, 1983, Fast mixed-radix real Fourier transforms, J. Comput. Phys. (52), 340–350