hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_sum_fft_complex_2d_sep (c06fu)

Purpose

nag_sum_fft_complex_2d_sep (c06fu) computes the two-dimensional discrete Fourier transform of a bivariate sequence of complex data values. This function is designed to be particularly efficient on vector processors.
Note: this function is scheduled to be withdrawn, please see c06fu in Advice on Replacement Calls for Withdrawn/Superseded Routines..

Syntax

[x, y, trigm, trign, ifail] = c06fu(m, n, x, y, init, trigm, trign)
[x, y, trigm, trign, ifail] = nag_sum_fft_complex_2d_sep(m, n, x, y, init, trigm, trign)

Description

nag_sum_fft_complex_2d_sep (c06fu) computes the two-dimensional discrete Fourier transform of a bivariate sequence of complex data values z j1 j2 z j1 j2 , for j1 = 0,1,,m1j1=0,1,,m-1 and j2 = 0,1,,n1j2=0,1,,n-1.
The discrete Fourier transform is here defined by
m1n1
k1k2 = 1/(sqrt(mn))z j1 j2 × exp(2πi(( j1 k1 )/m + ( j2 k2 )/n)),
j1 = 0j2 = 0
z^ k1k2 = 1mn j1=0 m-1 j2=0 n-1 z j1 j2 × exp( -2πi ( j1 k1 m + j2 k2 n ) ) ,
where k1 = 0,1,,m1 k1=0,1,,m-1 , k2 = 0,1,,n1 k2=0,1,,n-1 .
(Note the scale factor of 1/(sqrt(mn)) 1mn  in this definition.)
To compute the inverse discrete Fourier transform, defined with exp( + 2πi()) exp( +2πi () )  in the above formula instead of exp(2πi()) exp( -2πi () ) , this function should be preceded and followed by calls of nag_sum_conjugate_complex_sep (c06gc) to form the complex conjugates of the data values and the transform.
This function calls nag_sum_fft_complex_1d_multi_rfmt (c06fr) to perform multiple one-dimensional discrete Fourier transforms by the fast Fourier transform (FFT) algorithm in Brigham (1974). It is designed to be particularly efficient on vector processors.

References

Brigham E O (1974) The Fast Fourier Transform Prentice–Hall
Temperton C (1983) Self-sorting mixed-radix fast Fourier transforms J. Comput. Phys. 52 1–23

Parameters

Compulsory Input Parameters

1:     m – int64int32nag_int scalar
mm, the length of the first dimension of ZZ. Consider the matrix ZZ with elements Zij = zi + 1j + 1Zij = zi+1j+1, where zz is the bivariate sequence defined in Section [Description], then mm is the number of rows of ZZ.
Constraint: m1m1.
2:     n – int64int32nag_int scalar
nn, the length of the second dimension of ZZ. Consider the matrix ZZ with elements Zij = zi + 1j + 1Zij = zi+1j+1, where zz is the bivariate sequence defined in Section [Description], then nn is the number of columns of ZZ.
Constraint: n1n1.
3:     x( m × n m×n ) – double array
4:     y( m × n m×n ) – double array
The real and imaginary parts of the complex data values must be stored in arrays x and y respectively. If x and y are regarded as two-dimensional arrays of dimension (0 : m1,0 : n1)(0:m-1,0:n-1), then x(j1,j2)xj1j2 and y(j1,j2)yj1j2 must contain the real and imaginary parts of z j1 j2 z j1 j2 .
5:     init – string (length ≥ 1)
Indicates whether trigonometric coefficients are to be calculated.
init = 'I'init='I'
Calculate the required trigonometric coefficients for the given values of mm and nn, and store in the corresponding arrays trigm and trign.
init = 'S'init='S' or 'R''R'
The required trigonometric coefficients are assumed to have been calculated and stored in the arrays trigm and trign in a prior call to nag_sum_fft_complex_2d_sep (c06fu). The function performs a simple check that the current values of mm and nn are consistent with the corresponding values stored in trigm and trign.
Constraint: init = 'I'init='I', 'S''S' or 'R''R'.
6:     trigm( 2 × m 2×m ) – double array
7:     trign( 2 × n 2×n ) – double array
If init = 'S'init='S' or 'R''R', trigm and trign must contain the required coefficients calculated in a previous call of the function. Otherwise trigm and trign need not be set.
If m = nm=n the same array may be supplied for trigm and trign.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

work

Output Parameters

1:     x( m × n m×n ) – double array
2:     y( m × n m×n ) – double array
The real and imaginary parts respectively of the corresponding elements of the computed transform.
3:     trigm( 2 × m 2×m ) – double array
4:     trign( 2 × n 2×n ) – double array
trigm and trign contain the required coefficients (computed by the function if init = 'I'init='I').
5:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,m < 1m<1.
  ifail = 2ifail=2
On entry,n < 1n<1.
  ifail = 3ifail=3
On entry,init'I'init'I', 'S''S' or 'R''R'.
  ifail = 4ifail=4
Not used at this Mark.
  ifail = 5ifail=5
On entry,init = 'S'init='S' or 'R''R', but at least one of the arrays trigm and trign is inconsistent with the current value of m or n.
  ifail = 6ifail=6
An unexpected error has occurred in an internal call. Check all function calls and array dimensions. Seek expert help.

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 mn × log(mn) mn × log(mn) , but also depends on the factorization of the individual dimensions mm and nn. nag_sum_fft_complex_2d_sep (c06fu) is faster if the only prime factors are 22, 33 or 55; and fastest of all if they are powers of 22.

Example

function nag_sum_fft_complex_2d_sep_example
m = int64(3);
n = int64(5);
x = [1;
     0.994;
     0.903;
     0.999;
     0.989;
     0.885;
     0.987;
     0.963;
     0.823;
     0.936;
     0.891;
     0.694;
     0.802;
     0.731;
     0.467];
y = [0;
     -0.111;
     -0.43;
     -0.04;
     -0.151;
     -0.466;
     -0.159;
     -0.268;
     -0.568;
     -0.352;
     -0.454;
     -0.72;
     -0.597;
     -0.682;
     -0.884];
init = 'Initial';
trigm = zeros(6,1);
trign = zeros(10,1);
[xOut, yOut, trigmOut, trignOut, ifail] = ...
    nag_sum_fft_complex_2d_sep(m, n, x, y, init, trigm, trign)
 

xOut =

    3.3731
    0.4565
   -0.1705
    0.4814
    0.0549
   -0.0375
    0.2507
    0.0093
   -0.0423
    0.0543
   -0.0217
   -0.0377
   -0.4194
   -0.0759
   -0.0022


yOut =

   -1.5187
    0.1368
    0.4927
   -0.0907
    0.0317
    0.0584
    0.1776
    0.0389
    0.0082
    0.3188
    0.0356
   -0.0255
    0.4145
    0.0045
   -0.0829


trigmOut =

     1
     1
     3
     0
     0
     3


trignOut =

     1
     1
     1
     1
     5
     0
     0
     0
     0
     5


ifail =

                    0


function c06fu_example
m = int64(3);
n = int64(5);
x = [1;
     0.994;
     0.903;
     0.999;
     0.989;
     0.885;
     0.987;
     0.963;
     0.823;
     0.936;
     0.891;
     0.694;
     0.802;
     0.731;
     0.467];
y = [0;
     -0.111;
     -0.43;
     -0.04;
     -0.151;
     -0.466;
     -0.159;
     -0.268;
     -0.568;
     -0.352;
     -0.454;
     -0.72;
     -0.597;
     -0.682;
     -0.884];
init = 'Initial';
trigm = zeros(6,1);
trign = zeros(10,1);
[xOut, yOut, trigmOut, trignOut, ifail] = c06fu(m, n, x, y, init, trigm, trign)
 

xOut =

    3.3731
    0.4565
   -0.1705
    0.4814
    0.0549
   -0.0375
    0.2507
    0.0093
   -0.0423
    0.0543
   -0.0217
   -0.0377
   -0.4194
   -0.0759
   -0.0022


yOut =

   -1.5187
    0.1368
    0.4927
   -0.0907
    0.0317
    0.0584
    0.1776
    0.0389
    0.0082
    0.3188
    0.0356
   -0.0255
    0.4145
    0.0045
   -0.0829


trigmOut =

     1
     1
     3
     0
     0
     3


trignOut =

     1
     1
     1
     1
     5
     0
     0
     0
     0
     5


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013