# naginterfaces.library.sum.fft_​real_​cosine_​simple¶

naginterfaces.library.sum.fft_real_cosine_simple(m, n, x)[source]

fft_real_cosine_simple computes the discrete Fourier cosine transforms of sequences of real data values.

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

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

Parameters
mint

, the number of sequences to be transformed.

nint

One less than the number of real values in each sequence, i.e., the number of values in each sequence is .

xfloat, array-like, shape

The data must be stored in as if in a two-dimensional array of dimension ; each of the sequences is stored in a row of the array. In other words, if the data values of the th sequence to be transformed are denoted by , for , for , the first elements of the array must contain the values

The th and th elements of each row , for , are required as workspace. These elements may contain arbitrary values as they are set to zero by the function.

Returns
xfloat, ndarray, shape

The Fourier cosine transforms stored as if in a two-dimensional array of dimension . Each of the transforms is stored in a row of the array, overwriting the corresponding original data. If the components of the th Fourier cosine transform are denoted by , for , for , the elements of the array contain the 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

No equivalent traditional C interface for this routine exists in the NAG Library.

Given sequences of real data values , for , for , fft_real_cosine_simple simultaneously calculates the Fourier cosine transforms of all the sequences defined by

(Note the scale factor in this definition.)

Since the Fourier cosine transform is its own inverse, two consecutive calls of fft_real_cosine_simple 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