c06eb calculates the discrete Fourier transform of a Hermitian sequence of $n$ complex data values. (No extra workspace required.)

# Syntax

C# |
---|

public static void c06eb( double[] x, int n, out int ifail ) |

Visual Basic |
---|

Public Shared Sub c06eb ( _ x As Double(), _ n As Integer, _ <OutAttribute> ByRef ifail As Integer _ ) |

Visual C++ |
---|

public: static void c06eb( array<double>^ x, int n, [OutAttribute] int% ifail ) |

F# |
---|

static member c06eb : x : float[] * n : int * ifail : int byref -> unit |

#### Parameters

- x
- Type: array<System..::..Double>[]()[][]An array of size [n]
*On entry*: the sequence to be transformed stored in Hermitian form. If the data values ${z}_{j}$ are written as ${x}_{j}+i{y}_{j}$, and if x is declared with bounds $\left(0:{\mathbf{n}}-1\right)$ in the method from which c06eb is called, then for $0\le j\le n/2$, ${x}_{j}$ is contained in ${\mathbf{x}}\left[j-1\right]$, and for $1\le j\le \left(n-1\right)/2$, ${y}_{j}$ is contained in ${\mathbf{x}}\left[n-j\right]$. (See also [] in the C06 class Chapter Introduction and [Example].)

- n
- Type: System..::..Int32
*On entry*: $n$, the number of data values. The largest prime factor of n must not exceed $19$, and the total number of prime factors of n, counting repetitions, must not exceed $20$.*Constraint*: ${\mathbf{n}}>1$.

- ifail
- Type: System..::..Int32%
*On exit*: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

Given a Hermitian sequence of $n$ complex data values ${z}_{\mathit{j}}$ (i.e., a sequence such that ${z}_{0}$ is real and ${z}_{n-\mathit{j}}$ is the complex conjugate of ${z}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,n-1$), c06eb calculates their discrete Fourier transform defined by

(Note the scale factor of $\frac{1}{\sqrt{n}}$ in this definition.) The transformed values ${\hat{x}}_{k}$ are purely real (see also the

$${\hat{x}}_{k}=\frac{1}{\sqrt{n}}\sum _{j=0}^{n-1}{z}_{j}\times \mathrm{exp}\left(-i\frac{2\pi jk}{n}\right)\text{, \hspace{1em}}k=0,1,\dots ,n-1\text{.}$$ |

**C06**class).To compute the inverse discrete Fourier transform defined by

this method should be preceded by a call of c06gb to form the complex conjugates of the ${z}_{j}$.

$${\hat{y}}_{k}=\frac{1}{\sqrt{n}}\sum _{j=0}^{n-1}{z}_{j}\times \mathrm{exp}\left(+i\frac{2\pi jk}{n}\right)\text{,}$$ |

c06eb uses the fast Fourier transform (FFT) algorithm (see Brigham (1974)). There are some restrictions on the value of $n$ (see [Parameters]).

# References

Brigham E O (1974)

*The Fast Fourier Transform*Prentice–Hall# Error Indicators and Warnings

Errors or warnings detected by the method:

- ${\mathbf{ifail}}=1$
- At least one of the prime factors of n is greater than $19$.

- ${\mathbf{ifail}}=2$
- n has more than $20$ prime factors.

- ${\mathbf{ifail}}=3$
On entry, ${\mathbf{n}}\le 1$.

- ${\mathbf{ifail}}=4$
- An unexpected error has occurred in an internal call. Check all method 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).

# Parallelism and Performance

None.

# Further Comments

The time taken is approximately proportional to $n\times \mathrm{log}\left(n\right)$, but also depends on the factorization of $n$. c06eb is faster if the only prime factors of $n$ are $2$, $3$ or $5$; and fastest of all if $n$ is a power of $2$.

On the other hand, c06eb is particularly slow if $n$ has several unpaired prime factors, i.e., if the ‘square-free’ part of $n$ has several factors.
For such values of $n$, (C06FBF not in this release) (which requires an additional $n$ elements of workspace) is considerably faster.