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_multid_1d_sep (c06ff)

Purpose

nag_sum_fft_complex_multid_1d_sep (c06ff) computes the discrete Fourier transform of one variable in a multivariate sequence of complex data values.

Syntax

[x, y, ifail] = c06ff(l, nd, x, y, 'ndim', ndim, 'n', n)
[x, y, ifail] = nag_sum_fft_complex_multid_1d_sep(l, nd, x, y, 'ndim', ndim, 'n', n)

Description

nag_sum_fft_complex_multid_1d_sep (c06ff) computes the discrete Fourier transform of one variable (the llth say) in a multivariate sequence of complex data values z j1 j2 jm z j1 j2 jm , for j1 = 0,1,,n11j1=0,1,,n1-1 and j2 = 0,1,,n21j2=0,1,,n2-1, and so on. Thus the individual dimensions are n1, n2, , nm n1, n2, , nm , and the total number of data values is n = n1 × n2 × × nm n = n1 × n2 ×× nm .
The function computes n / nl n/nl  one-dimensional transforms defined by
nl1
j1 kl jm = 1/(sqrt(nl))z j1 jl jm × exp(( 2 π i jl kl )/(nl)),
jl = 0
z^ j1 kl jm = 1nl jl=0 nl-1 z j1 jl jm × exp( - 2 π i jl kl nl ) ,
where kl = 0 , 1 ,, nl1 kl = 0 , 1 ,, nl-1 .
(Note the scale factor of 1/(sqrt(nl)) 1nl  in this definition.)
To compute the inverse discrete Fourier transforms, defined with exp( + ( 2 π i jl kl )/(nl)) exp( + 2 π i jl kl nl )  in the above formula instead of exp(( 2 π i jl kl )/(nl)) exp( - 2 π i jl kl nl ) , 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 yy).
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 j1 j1  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 nl nl  (see Section [Parameters]).

References

Brigham E O (1974) The Fast Fourier Transform Prentice–Hall

Parameters

Compulsory Input Parameters

1:     l – int64int32nag_int scalar
ll, the index of the variable (or dimension) on which the discrete Fourier transform is to be performed.
Constraint: 1 l ndim1 l ndim.
2:     nd(ndim) – int64int32nag_int array
ndim, the dimension of the array, must satisfy the constraint ndim1ndim1.
nd(i)ndi must contain nini (the dimension of the iith variable) , for i = 1,2,,mi=1,2,,m. The largest prime factor of nd(l)ndl must not exceed 1919, and the total number of prime factors of nd(l)ndl, counting repetitions, must not exceed 2020.
Constraint: nd(i)1ndi1, for i = 1,2,,ndimi=1,2,,ndim.
3:     x(n) – double array
n, the dimension of the array, must satisfy the constraint n = nd(1) × nd(2) × × nd(ndim)n = nd1 × nd2 ×× ndndim.
x( 1 + j1 + n1 j2 + n1 n2 j3 + )x 1 + j1 + n1 j2 + n1 n2 j3 +  must contain the real part of the complex data value z j1 j2 jm z j1 j2 jm , for 0 j1 n1 1 , 0 j2 n21 , 0 j1 n1 -1 , 0 j2 n2-1 , ; i.e., the values are stored in consecutive elements of the array according to the Fortran convention for storing multidimensional arrays.
4:     y(n) – double array
n, the dimension of the array, must satisfy the constraint n = nd(1) × nd(2) × × nd(ndim)n = nd1 × nd2 ×× ndndim.
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:     ndim – int64int32nag_int scalar
Default: The dimension of the array nd.
mm, the number of dimensions (or variables) in the multivariate data.
Constraint: ndim1ndim1.
2:     n – int64int32nag_int scalar
Default: The dimension of the arrays x, y. (An error is raised if these dimensions are not equal.)
nn, the total number of data values.
Constraint: n = nd(1) × nd(2) × × nd(ndim)n = nd1 × nd2 ×× ndndim.

Input Parameters Omitted from the MATLAB Interface

work lwork

Output Parameters

1:     x(n) – double array
The real parts of the corresponding elements of the computed transform.
2:     y(n) – double array
The imaginary parts of the corresponding elements of the computed transform.
3:     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,ndim < 1ndim<1.
  ifail = 2ifail=2
On entry,n nd(1) × nd(2) × × nd(ndim)n nd1× nd2×× ndndim.
  ifail = 3ifail=3
On entry,l < 1l<1 or l > ndiml>ndim.
   ifail = 10 × l + 1 ifail=10×l+1
At least one of the prime factors of nd(l)ndl is greater than 1919.
   ifail = 10 × l + 2 ifail=10×l+2
nd(l)ndl has more than 2020 prime factors.
   ifail = 10 × l + 3 ifail=10×l+3
On entry,nd(l) < 1ndl<1.
   ifail = 10 × l + 4 ifail=10×l+4
On entry,lwork < 3 × nd(l)lwork<3×ndl.

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 n × lognl n×lognl , but also depends on the factorization of nl nl . nag_sum_fft_complex_multid_1d_sep (c06ff) is faster if the only prime factors of nl nl  are 22, 33 or 55; and fastest of all if nl nl  is a power of 22.

Example

function nag_sum_fft_complex_multid_1d_sep_example
l = int64(2);
nd = [int64(3);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];
[xOut, yOut, ifail] = nag_sum_fft_complex_multid_1d_sep(l, nd, x, y)
 

xOut =

    2.1126
    2.0429
    1.6869
    0.2880
    0.2862
    0.2596
    0.1257
    0.1389
    0.1695
   -0.0030
    0.0180
    0.0791
   -0.2873
   -0.2633
   -0.1759


yOut =

   -0.5134
   -0.7451
   -1.3721
   -0.0003
   -0.0322
   -0.1246
    0.1298
    0.1148
    0.0631
    0.1899
    0.1892
    0.1731
    0.1940
    0.2251
    0.2988


ifail =

                    0


function c06ff_example
l = int64(2);
nd = [int64(3);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];
[xOut, yOut, ifail] = c06ff(l, nd, x, y)
 

xOut =

    2.1126
    2.0429
    1.6869
    0.2880
    0.2862
    0.2596
    0.1257
    0.1389
    0.1695
   -0.0030
    0.0180
    0.0791
   -0.2873
   -0.2633
   -0.1759


yOut =

   -0.5134
   -0.7451
   -1.3721
   -0.0003
   -0.0322
   -0.1246
    0.1298
    0.1148
    0.0631
    0.1899
    0.1892
    0.1731
    0.1940
    0.2251
    0.2988


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