naginterfaces.library.sum.fft_cosine¶
- naginterfaces.library.sum.fft_cosine(x)[source]¶
fft_cosine
computes the discrete 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 c06rf
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/c06/c06rff.html
- Parameters
- 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 Fourier 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 )
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_cosine
simultaneously calculates the Fourier cosine transforms of all the sequences defined by(Note the scale factor in this definition.)
This transform is also known as type-I DCT.
Since the Fourier cosine transform defined above is its own inverse, two consecutive calls of
fft_cosine
will restore the original data.The transform calculated by this function can be used to solve Poisson’s equation when the derivative of the solution is specified at both left and right boundaries (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