PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_sum_fft_complex_1d_sep (c06fc)
Purpose
nag_sum_fft_complex_1d_sep (c06fc) calculates the discrete Fourier transform of a sequence of complex data values (using a work array for extra speed).
Syntax
[
x,
y,
ifail] = nag_sum_fft_complex_1d_sep(
x,
y, 'n',
n)
Description
Given a sequence of
complex data values
, for
,
nag_sum_fft_complex_1d_sep (c06fc) calculates their discrete Fourier transform defined by
(Note the scale factor of
in this definition.)
To compute the inverse discrete Fourier transform defined by
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
).
nag_sum_fft_complex_1d_sep (c06fc) uses the fast Fourier transform (FFT) algorithm (see
Brigham (1974)). There are some restrictions on the value of
(see
Arguments).
References
Brigham E O (1974) The Fast Fourier Transform Prentice–Hall
Parameters
Compulsory Input Parameters
- 1:
– double array
-
If
x is declared with bounds
in the function from which
nag_sum_fft_complex_1d_sep (c06fc) is called, then
must contain
, the real part of
, for
.
- 2:
– double array
-
If
y is declared with bounds
in the function from which
nag_sum_fft_complex_1d_sep (c06fc) is called, then
must contain
, the imaginary part of
, for
.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
x,
y. (An error is raised if these dimensions are not equal.)
, the number of data values. The largest prime factor of
n must not exceed
, and the total number of prime factors of
n, counting repetitions, must not exceed
.
Constraint:
.
Output Parameters
- 1:
– double array
-
The real parts
of the components of the discrete Fourier transform. If
x is declared with bounds
in the function from which
nag_sum_fft_complex_1d_sep (c06fc) is called, then for
,
is contained in
.
- 2:
– double array
-
The imaginary parts
of the components of the discrete Fourier transform. If
y is declared with bounds
in the function from which
nag_sum_fft_complex_1d_sep (c06fc) is called, then for
,
is contained in
.
- 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:
-
-
At least one of the prime factors of
n is greater than
.
-
-
n has more than
prime factors.
-
-
-
-
An unexpected error has occurred in an internal call. Check all function calls and array dimensions. Seek expert help.
-
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 . nag_sum_fft_complex_1d_sep (c06fc) is faster if the only prime factors of are , or ; and fastest of all if is a power of .
Example
This example reads in a sequence of complex data values and prints their discrete Fourier transform (as computed by nag_sum_fft_complex_1d_sep (c06fc)). It then performs an inverse transform using nag_sum_fft_complex_1d_sep (c06fc), and prints the sequence so obtained alongside the original data values.
Open in the MATLAB editor:
c06fc_example
function c06fc_example
fprintf('c06fc example results\n\n');
z = [0.34907 - 0.37168*i;
0.54890 - 0.35669*i;
0.74776 - 0.31175*i;
0.94459 - 0.23702*i;
1.13850 - 0.13274*i;
1.32850 + 0.00074*i;
1.51370 + 0.16298*i];
x = real(z);
y = imag(z);
[ztr, zti, ifail] = c06fc(x, y);
ztrans = ztr + i*zti;
disp('Components of discrete Fourier transform')
disp(ztrans);
[xres, yres, ifail] = c06fc(ztr, -zti);
zres = xres-i*yres;
zout = [z zres];
fprintf('Original sequence as restored by inverse transform\n');
fprintf(' Original Restored\n')
disp(zout);
c06fc example results
Components of discrete Fourier transform
2.4836 - 0.4710i
-0.5518 + 0.4968i
-0.3671 + 0.0976i
-0.2877 - 0.0586i
-0.2251 - 0.1748i
-0.1483 - 0.3084i
0.0198 - 0.5650i
Original sequence as restored by inverse transform
Original Restored
0.3491 - 0.3717i 0.3491 - 0.3717i
0.5489 - 0.3567i 0.5489 - 0.3567i
0.7478 - 0.3118i 0.7478 - 0.3117i
0.9446 - 0.2370i 0.9446 - 0.2370i
1.1385 - 0.1327i 1.1385 - 0.1327i
1.3285 + 0.0007i 1.3285 + 0.0007i
1.5137 + 0.1630i 1.5137 + 0.1630i
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015