PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_sum_fft_complex_multid_sep (c06fj)
Purpose
nag_sum_fft_complex_multid_sep (c06fj) computes the multidimensional discrete Fourier transform of a multivariate sequence of complex data values.
Syntax
Description
nag_sum_fft_complex_multid_sep (c06fj) computes the multidimensional discrete Fourier transform of a multidimensional sequence of complex data values , where , and so on. Thus the individual dimensions are , and the total number of data values is .
The discrete Fourier transform is here defined (e.g., for
) by:
where
,
.
The extension to higher dimensions is obvious. (Note the scale factor of in this definition.)
To compute the inverse discrete Fourier transform, defined with in the above formula instead of , this function should be preceded and followed by the complex conjugation of the data values and the transform (by negating the imaginary parts stored in ).
The data values must be supplied in a pair of one-dimensional arrays (real and imaginary parts separately), in accordance with the Fortran convention for storing multidimensional data (i.e., with the first subscript varying most rapidly).
This function calls
nag_sum_fft_complex_1d_sep (c06fc) to perform one-dimensional discrete Fourier transforms by the fast Fourier transform (FFT) algorithm in
Brigham (1974), and hence there are some restrictions on the values of the
(see
Arguments).
References
Brigham E O (1974) The Fast Fourier Transform Prentice–Hall
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int array
-
must contain (the dimension of the th variable) , for . The largest prime factor of each must not exceed , and the total number of prime factors of , counting repetitions, must not exceed .
Constraint:
, for .
- 2:
– double array
-
must contain the real part of the complex data value , for ; i.e., the values are stored in consecutive elements of the array according to the Fortran convention for storing multidimensional arrays.
- 3:
– double array
-
The imaginary parts of the complex data values, stored in the same way as the real parts in the array
x.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the array
nd.
, the number of dimensions (or variables) in the multivariate data.
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
x,
y. (An error is raised if these dimensions are not equal.)
, the total number of data values.
Constraint:
.
Output Parameters
- 1:
– double array
-
The real parts of the corresponding elements of the computed transform.
- 2:
– double array
-
The imaginary parts of the corresponding elements of the computed transform.
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
-
-
On entry, | . |
-
-
At least one of the prime factors of is greater than .
-
-
has more than prime factors.
-
-
-
-
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
Some indication of accuracy can be obtained by performing a subsequent inverse transform and comparing the results with the original sequence (in exact arithmetic they would be identical).
Further Comments
The time taken is approximately proportional to , but also depends on the factorization of the individual dimensions . nag_sum_fft_complex_multid_sep (c06fj) is faster if the only prime factors are , or ; and fastest of all if they are powers of .
Example
This example reads in a bivariate sequence of complex data values and prints the two-dimensional Fourier transform. It then performs an inverse transform and prints the sequence so obtained, which may be compared to the original data values.
Open in the MATLAB editor:
c06fj_example
function c06fj_example
fprintf('c06fj example results\n\n');
x = [ 1.000 0.999 0.987 0.936 0.802;
0.994 0.989 0.963 0.891 0.731;
0.903 0.885 0.823 0.694 0.467];
y = [ 0.000 -0.040 -0.159 -0.352 -0.597;
-0.111 -0.151 -0.268 -0.454 -0.682
-0.430 -0.466 -0.568 -0.720 -0.884];
nd = int64(size(x));
l = int64(2);
[xt, yt, ifail] = c06fj(nd, x, y);
[xr, yr, ifail] = c06fj(nd, xt, -yt);
z = x + i*y;
zt = reshape(xt+i*yt,nd);
zr = reshape(xr-i*yr,nd);
matrix = 'general';
diag = ' ';
usefrm = 'Above';
format = 'F9.3';
labrow = 'None';
labcol = 'None';
ncols = int64(80);
indent = int64(0);
title = 'Original data:';
[ifail] = x04db(...
matrix, diag, z, usefrm, format, title, labrow, labcol, ncols, indent);
disp(' ');
title = 'Discrete Fourier transform of data:';
[ifail] = x04db(...
matrix, diag, zt, usefrm, format, title, labrow, labcol, ncols, indent);
disp(' ');
title = 'Original sequence as restored by inverse transform:';
[ifail] = x04db(...
matrix, diag, zr, usefrm, format, title, labrow, labcol, ncols, indent);
c06fj example results
Original data:
1.000 0.999 0.987 0.936 0.802
0.000 -0.040 -0.159 -0.352 -0.597
0.994 0.989 0.963 0.891 0.731
-0.111 -0.151 -0.268 -0.454 -0.682
0.903 0.885 0.823 0.694 0.467
-0.430 -0.466 -0.568 -0.720 -0.884
Discrete Fourier transform of data:
3.373 0.481 0.251 0.054 -0.419
-1.519 -0.091 0.178 0.319 0.415
0.457 0.055 0.009 -0.022 -0.076
0.137 0.032 0.039 0.036 0.004
-0.170 -0.037 -0.042 -0.038 -0.002
0.493 0.058 0.008 -0.025 -0.083
Original sequence as restored by inverse transform:
1.000 0.999 0.987 0.936 0.802
0.000 -0.040 -0.159 -0.352 -0.597
0.994 0.989 0.963 0.891 0.731
-0.111 -0.151 -0.268 -0.454 -0.682
0.903 0.885 0.823 0.694 0.467
-0.430 -0.466 -0.568 -0.720 -0.884
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015