Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_sum_fft_hermitian_1d_nowork (c06eb)

## Purpose

nag_sum_fft_hermitian_1d_nowork (c06eb) calculates the discrete Fourier transform of a Hermitian sequence of n$n$ complex data values. (No extra workspace required.)
Note: this function is scheduled to be withdrawn, please see c06eb in Advice on Replacement Calls for Withdrawn/Superseded Routines..

## Syntax

[x, ifail] = c06eb(x, 'n', n)
[x, ifail] = nag_sum_fft_hermitian_1d_nowork(x, 'n', n)

## Description

Given a Hermitian sequence of n$n$ complex data values zj ${z}_{\mathit{j}}$ (i.e., a sequence such that z0 ${z}_{0}$ is real and znj ${z}_{n-\mathit{j}}$ is the complex conjugate of zj ${z}_{\mathit{j}}$, for j = 1,2,,n1$\mathit{j}=1,2,\dots ,n-1$), nag_sum_fft_hermitian_1d_nowork (c06eb) calculates their discrete Fourier transform defined by
 n − 1 x̂k = 1/(sqrt(n)) ∑ zj × exp( − i(2πjk)/n),  k = 0,1, … ,n − 1. j = 0
$x^k = 1n ∑ j=0 n-1 zj × exp( -i 2πjk n ) , k= 0, 1, …, n-1 .$
(Note the scale factor of 1/(sqrt(n)) $\frac{1}{\sqrt{n}}$ in this definition.) The transformed values k ${\stackrel{^}{x}}_{k}$ are purely real (see also the C06 Chapter Introduction).
To compute the inverse discrete Fourier transform defined by
 n − 1 ŷk = 1/(sqrt(n)) ∑ zj × exp( + i(2πjk)/n), j = 0
$y^k = 1n ∑ j=0 n-1 zj × exp( +i 2πjk n ) ,$
this function should be preceded by a call of nag_sum_conjugate_hermitian_rfmt (c06gb) to form the complex conjugates of the zj ${z}_{j}$.
nag_sum_fft_hermitian_1d_nowork (c06eb) uses the fast Fourier transform (FFT) algorithm (see Brigham (1974)). There are some restrictions on the value of n$n$ (see Section [Parameters]).

## References

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

## Parameters

### Compulsory Input Parameters

1:     x(n) – double array
n, the dimension of the array, must satisfy the constraint n > 1${\mathbf{n}}>1$.
The sequence to be transformed stored in Hermitian form. If the data values zj${z}_{j}$ are written as xj + i yj${x}_{j}+i{y}_{j}$, and if x is declared with bounds (0 : n1)$\left(0:{\mathbf{n}}-1\right)$ in the function from which nag_sum_fft_hermitian_1d_nowork (c06eb) is called, then for 0 j n / 2$0\le j\le n/2$, xj${x}_{j}$ is contained in x(j)${\mathbf{x}}\left(j\right)$, and for 1 j (n1) / 2 $1\le j\le \left(n-1\right)/2$, yj${y}_{j}$ is contained in x(nj)${\mathbf{x}}\left(n-j\right)$. (See also Section [Real transforms] in the C06 Chapter Introduction and Section [Example].)

### Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The dimension of the array x.
n$n$, the number of data values. The largest prime factor of n must not exceed 19$19$, and the total number of prime factors of n, counting repetitions, must not exceed 20$20$.
Constraint: n > 1${\mathbf{n}}>1$.

None.

### Output Parameters

1:     x(n) – double array
The components of the discrete Fourier transform k${\stackrel{^}{x}}_{k}$. If x is declared with bounds (0 : n1)$\left(0:{\mathbf{n}}-1\right)$ in the function from which nag_sum_fft_hermitian_1d_nowork (c06eb) is called, then k${\stackrel{^}{x}}_{\mathit{k}}$ is stored in x(k)${\mathbf{x}}\left(\mathit{k}\right)$, for k = 0,1,,n1$\mathit{k}=0,1,\dots ,n-1$.
2:     ifail – int64int32nag_int scalar
${\mathrm{ifail}}={\mathbf{0}}$ unless the function detects an error (see [Error Indicators and Warnings]).

## Error Indicators and Warnings

Errors or warnings detected by the function:
ifail = 1${\mathbf{ifail}}=1$
At least one of the prime factors of n is greater than 19$19$.
ifail = 2${\mathbf{ifail}}=2$
n has more than 20$20$ prime factors.
ifail = 3${\mathbf{ifail}}=3$
 On entry, n ≤ 1${\mathbf{n}}\le 1$.
ifail = 4${\mathbf{ifail}}=4$
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).

The time taken is approximately proportional to n × log(n)$n×\mathrm{log}\left(n\right)$, but also depends on the factorization of n$n$. nag_sum_fft_hermitian_1d_nowork (c06eb) is faster if the only prime factors of n$n$ are 2$2$, 3$3$ or 5$5$; and fastest of all if n$n$ is a power of 2$2$.
On the other hand, nag_sum_fft_hermitian_1d_nowork (c06eb) is particularly slow if n$n$ has several unpaired prime factors, i.e., if the ‘square-free’ part of n$n$ has several factors. For such values of n$n$, nag_sum_fft_hermitian_1d_rfmt (c06fb) (which requires an additional n$n$ elements of workspace) is considerably faster.

## Example

function nag_sum_fft_hermitian_1d_nowork_example
x = [0.34907;
0.5489;
0.74776;
0.94459;
1.1385;
1.3285;
1.5137];
[xOut, ifail] = nag_sum_fft_hermitian_1d_nowork(x)

xOut =

1.8262
1.8686
-0.0175
0.5020
-0.5987
-0.0314
-2.6256

ifail =

0

function c06eb_example
x = [0.34907;
0.5489;
0.74776;
0.94459;
1.1385;
1.3285;
1.5137];
[xOut, ifail] = c06eb(x)

xOut =

1.8262
1.8686
-0.0175
0.5020
-0.5987
-0.0314
-2.6256

ifail =

0