PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_sum_fft_real_3d (c06py)
Purpose
nag_sum_fft_real_3d (c06py) computes the three-dimensional discrete Fourier transform of a trivariate sequence of real data values.
Syntax
Description
nag_sum_fft_real_3d (c06py) computes the three-dimensional discrete Fourier transform of a trivariate sequence of real data values , for , and .
The discrete Fourier transform is here defined by
where
,
and
. (Note the scale factor of
in this definition.)
The transformed values are complex. Because of conjugate symmetry (i.e., is the complex conjugate of ), only slightly more than half of the Fourier coefficients need to be stored in the output.
A call of
nag_sum_fft_real_3d (c06py) followed by a call of
nag_sum_fft_hermitian_3d (c06pz) will restore the original data.
This function calls
nag_sum_fft_realherm_1d_multi_col (c06pq) and
nag_sum_fft_complex_1d_multi_row (c06pr) to perform multiple one-dimensional discrete Fourier transforms by the fast Fourier transform (FFT) algorithm in
Brigham (1974) and
Temperton (1983).
References
Brigham E O (1974) The Fast Fourier Transform Prentice–Hall
Temperton C (1983) Fast mixed-radix real Fourier transforms J. Comput. Phys. 52 340–350
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
, the first dimension of the transform.
Constraint:
.
- 2:
– int64int32nag_int scalar
-
, the second dimension of the transform.
Constraint:
.
- 3:
– int64int32nag_int scalar
-
, the third dimension of the transform.
Constraint:
.
- 4:
– double array
-
The real input dataset
, where
is stored in
, for
,
and
.
That is, if
x is regarded as a three-dimensional array of dimension
, then
must contain
.
Optional Input Parameters
None.
Output Parameters
- 1:
– complex array
-
The complex output dataset
, where
is stored in
, for
,
and
.
That is, if
y is regarded as a three-dimensional array of dimension
, then
contains
.
Note the first dimension is cut roughly by half to remove the redundant information due to conjugate symmetry.
- 2:
– 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:
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
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.
-
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 forward transform using
nag_sum_fft_real_3d (c06py) and a backward transform using
nag_sum_fft_hermitian_3d (c06pz), and comparing the results with the original sequence (in exact arithmetic they would be identical).
Further Comments
The time taken by nag_sum_fft_real_3d (c06py) is approximately proportional to , but also depends on the factors of , and . nag_sum_fft_real_3d (c06py) is fastest if the only prime factors of , and are , and , and is particularly slow if one of the dimensions is a large prime, or has large prime factors.
Workspace is internally allocated by nag_sum_fft_real_3d (c06py). The total size of these arrays is approximately proportional to .
Example
This example reads in a trivariate sequence of real data values and prints their discrete Fourier transforms as computed by
nag_sum_fft_real_3d (c06py). Inverse transforms are then calculated by calling
nag_sum_fft_hermitian_3d (c06pz) showing that the original sequences are restored.
Open in the MATLAB editor:
c06py_example
function c06py_example
fprintf('c06py example results\n\n');
n1 = int64(3);
n2 = int64(3);
n3 = int64(4);
x = zeros(n1, n2, n3);
x(1, :, :) = [1.541, 0.161, 1.989, 0.037;
0.346, 1.907, 0.001, 1.915;
1.754, 0.042, 1.991, 0.151];
x(2, :, :) = [0.584, 1.004, 1.408, 0.252;
1.284, 1.137, 0.467, 1.834;
0.855, 0.725, 1.647, 0.096];
x(3, :, :) = [0.010, 1.844, 0.452, 1.154;
1.960, 0.240, 1.424, 0.987;
0.089, 1.660, 0.708, 0.872];
[y, ifail] = c06py(n1, n2, n3, reshape(x,n1*n2*n3,1));
fprintf('\nComponents of discrete Fourier transform:\n');
reshape(y,n1/2,n2,n3)
[x1, ifail] = c06pz(n1, n2, n3, y) ;
fprintf('Original sequence as restored by inverse transform:\n');
reshape(x1, n1, n2, n3)
c06py example results
Components of discrete Fourier transform:
ans(:,:,1) =
5.7547 + 0.0000i -0.2683 - 0.4203i -0.2683 + 0.4203i
0.0814 + 0.0154i 0.0382 + 0.1983i 0.0674 - 0.1220i
ans(:,:,2) =
-0.2773 - 0.2370i 0.1085 - 0.7560i -0.6882 + 0.2100i
0.0605 + 0.1563i -0.2752 + 0.2954i 0.2804 + 0.0122i
ans(:,:,3) =
0.4153 + 0.0000i 0.1753 + 0.8712i 0.1753 - 0.8712i
0.6446 - 0.4779i 1.5848 + 0.6163i -0.1134 - 1.5552i
ans(:,:,4) =
-0.2773 + 0.2370i -0.6882 - 0.2100i 0.1085 + 0.7560i
0.0469 - 0.0772i 0.2005 + 0.0614i -0.1281 - 0.1173i
Original sequence as restored by inverse transform:
ans(:,:,1) =
1.5410 0.3460 1.7540
0.5840 1.2840 0.8550
0.0100 1.9600 0.0890
ans(:,:,2) =
0.1610 1.9070 0.0420
1.0040 1.1370 0.7250
1.8440 0.2400 1.6600
ans(:,:,3) =
1.9890 0.0010 1.9910
1.4080 0.4670 1.6470
0.4520 1.4240 0.7080
ans(:,:,4) =
0.0370 1.9150 0.1510
0.2520 1.8340 0.0960
1.1540 0.9870 0.8720
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015