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_3d (c06px)

Purpose

nag_sum_fft_complex_3d (c06px) computes the three-dimensional discrete Fourier transform of a trivariate sequence of complex data values (using complex data type).

Syntax

[x, ifail] = c06px(direct, n1, n2, n3, x)
[x, ifail] = nag_sum_fft_complex_3d(direct, n1, n2, n3, x)

Description

nag_sum_fft_complex_3d (c06px) computes the three-dimensional discrete Fourier transform of a trivariate sequence of complex data values z j1 j2 j3 z j1 j2 j3 , for j1 = 0,1,,n11j1=0,1,,n1-1, j2 = 0,1,,n21j2=0,1,,n2-1 and j3 = 0,1,,n31j3=0,1,,n3-1.
The discrete Fourier transform is here defined by
n11n21n31
k1 k2 k3 = 1/(sqrt( n1 n2 n3 ))z j1 j2 j3 × exp( ± 2πi(( j1 k1 )/(n1) + ( j2 k2 )/(n2) + ( j3 k3 )/(n3))),
j1 = 0j2 = 0j3 = 0
z^ k1 k2 k3 = 1 n1 n2 n3 j1=0 n1-1 j2=0 n2-1 j3=0 n3-1 z j1 j2 j3 × exp( ±2πi ( j1 k1 n1 + j2 k2 n2 + j3 k3 n3 ) ) ,
where k1 = 0,1,,n11 k1=0,1,,n1-1 , k2 = 0,1,,n21 k2=0,1,,n2-1  and k3 = 0,1,,n31 k3=0,1,,n3-1 .
(Note the scale factor of 1/(sqrt( n1 n2 n3 )) 1 n1 n2 n3  in this definition.) The minus sign is taken in the argument of the exponential within the summation when the forward transform is required, and the plus sign is taken when the backward transform is required.
A call of nag_sum_fft_complex_3d (c06px) with direct = 'F'direct='F' followed by a call with direct = 'B'direct='B' will restore the original data.
This function performs multiple one-dimensional discrete Fourier transforms by the fast Fourier transform (FFT) algorithm (see Brigham (1974)).

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:     direct – string (length ≥ 1)
If the forward transform as defined in Section [Description] is to be computed, then direct must be set equal to 'F'.
If the backward transform is to be computed then direct must be set equal to 'B'.
Constraint: direct = 'F'direct='F' or 'B''B'.
2:     n1 – int64int32nag_int scalar
n1n1, the first dimension of the transform.
Constraint: n11n11.
3:     n2 – int64int32nag_int scalar
n2n2, the second dimension of the transform.
Constraint: n21n21.
4:     n3 – int64int32nag_int scalar
n3n3, the third dimension of the transform.
Constraint: n31n31.
5:     x( n1 × n2 × n3 n1×n2×n3 ) – complex array
The complex data values. Data values are stored in x using column-major ordering for storing multidimensional arrays; that is, z j1 j2 j3 z j1 j2 j3  is stored in x( 1 + j1 + n1 j2 + n1 n2 j3 )x 1 + j1 + n1 j2 + n1 n2 j3 .

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

work

Output Parameters

1:     x( n1 × n2 × n3 n1×n2×n3 ) – complex array
The corresponding elements of the computed transform.
2:     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,n1 < 1n1<1.
  ifail = 2ifail=2
On entry,n2 < 1n2<1.
  ifail = 3ifail=3
On entry,n3 < 1n3<1.
  ifail = 4ifail=4
On entry,direct'F'direct'F' or 'B''B'.
  ifail = 5ifail=5
On entry,n1 has more than 3030 prime factors.
  ifail = 6ifail=6
On entry,n2 has more than 3030 prime factors.
  ifail = 7ifail=7
On entry,n3 has more than 3030 prime factors.
  ifail = 8ifail=8
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 n1 n2 n3 × log(n1n2n3) n1 n2 n3 × log( n1 n2 n3 ) , but also depends on the factorization of the individual dimensions n1 n1 , n2 n2  and n3 n3 . nag_sum_fft_complex_3d (c06px) 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_3d_example
direct = 'F';
n1 = int64(2);
n2 = int64(3);
n3 = int64(4);
x = [1;
      0.5 + 0.5i;
      0.994 - 0.111i;
      0.494 + 0.111i;
      0.903 - 0.43i;
      0.403 + 0.43i;
      0.999 - 0.04i;
      0.499 + 0.04i;
      0.989 - 0.151i;
      0.489 + 0.151i;
      0.885 - 0.466i;
      0.385 + 0.466i;
      0.987 - 0.159i;
      0.487 + 0.159i;
      0.963 - 0.268i;
      0.463 + 0.268i;
      0.823 - 0.568i;
      0.323 + 0.568i;
      0.936 - 0.352i;
      0.436 + 0.352i;
      0.891 - 0.454i;
      0.391 + 0.454i;
      0.694 - 0.72i;
      0.194 + 0.72i];
[xOut, ifail] = nag_sum_fft_complex_3d(direct, n1, n2, n3, x)
 

xOut =

   3.2921 + 0.1021i
   1.2247 - 1.6203i
   0.1433 - 0.0860i
   0.4243 + 0.3197i
   0.1433 + 0.2902i
  -0.4243 + 0.3197i
   0.0506 - 0.0416i
   0.3548 + 0.0833i
   0.0155 + 0.1527i
   0.0204 - 0.1147i
  -0.0502 + 0.1180i
   0.0070 - 0.0800i
   0.1127 + 0.1021i
   0.0000 + 0.1621i
  -0.0245 + 0.1268i
   0.0134 - 0.0914i
  -0.0245 + 0.0773i
  -0.0134 - 0.0914i
   0.0506 + 0.2458i
  -0.3548 + 0.0833i
  -0.0502 + 0.0861i
  -0.0070 - 0.0800i
   0.0155 + 0.0515i
  -0.0204 - 0.1147i


ifail =

                    0


function c06px_example
direct = 'F';
n1 = int64(2);
n2 = int64(3);
n3 = int64(4);
x = [1;
      0.5 + 0.5i;
      0.994 - 0.111i;
      0.494 + 0.111i;
      0.903 - 0.43i;
      0.403 + 0.43i;
      0.999 - 0.04i;
      0.499 + 0.04i;
      0.989 - 0.151i;
      0.489 + 0.151i;
      0.885 - 0.466i;
      0.385 + 0.466i;
      0.987 - 0.159i;
      0.487 + 0.159i;
      0.963 - 0.268i;
      0.463 + 0.268i;
      0.823 - 0.568i;
      0.323 + 0.568i;
      0.936 - 0.352i;
      0.436 + 0.352i;
      0.891 - 0.454i;
      0.391 + 0.454i;
      0.694 - 0.72i;
      0.194 + 0.72i];
[xOut, ifail] = c06px(direct, n1, n2, n3, x)
 

xOut =

   3.2921 + 0.1021i
   1.2247 - 1.6203i
   0.1433 - 0.0860i
   0.4243 + 0.3197i
   0.1433 + 0.2902i
  -0.4243 + 0.3197i
   0.0506 - 0.0416i
   0.3548 + 0.0833i
   0.0155 + 0.1527i
   0.0204 - 0.1147i
  -0.0502 + 0.1180i
   0.0070 - 0.0800i
   0.1127 + 0.1021i
   0.0000 + 0.1621i
  -0.0245 + 0.1268i
   0.0134 - 0.0914i
  -0.0245 + 0.0773i
  -0.0134 - 0.0914i
   0.0506 + 0.2458i
  -0.3548 + 0.0833i
  -0.0502 + 0.0861i
  -0.0070 - 0.0800i
   0.0155 + 0.0515i
  -0.0204 - 0.1147i


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