Calculates the discrete single-precision Fourier transform for a vector.

SDKs

- iOS 4.0+
- macOS 10.7+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+

Framework

- Accelerate

## Declaration

## Parameters

`__Setup`

A DFT setup object returned by a call to

`v`

orDSP _DFT _zop _Create Setup `v`

.DSP _DFT _zrop _Create Setup `__Ir`

A single-precision vector containing the real parts of the input values.

`__Ii`

A single-precision vector containing the imaginary parts of the input values.

`__Or`

A single-precision vector where the real parts of the results are stored on return.

`__Oi`

A single-precision vector where the imaginary parts of the results are stored on return.

## Discussion

This function calculates either a real or complex discrete Fourier transform, depending on whether the setup object was created with a call to `v`

`v`

or `v`

.

Important

For best performance, make sure the four vector addresses passed to this function are 16-byte-aligned.

For a complex DFT, the way the `v`

function works is fairly straightforward: it works on real/imaginary inputs specified by `Ir`

and `Ii`

, and leaves real/imaginary outputs specified by `Or`

and `Oi`

; the transform is either forward or inverse according to the `Direction`

flag specified in the setup. Given `Length`

as the length specified in the setup, each array should contain `Length`

elements

For a real-to-complex DFT, there are some complications: forward means real-to-complex, inverse is complex-to-real. In either direction, the data for the real side of the transform is stored alternately in the real and imaginary arrays (even-indexed elements in the real array, odd-indexed in the imaginary array). Given `Length`

as the length specified in the setup, each array should contain `Length`

/2 elements

When the `v`

function is called with a setup returned from the `v`

function, it performs a complex-to-complex transform on inputs specified by `Ir`

and `Ii`

and stores results in `Or`

and `Oi`

. The transform is forward or inverse according to the `Direction`

flag specified in the setup. Given `Length`

as the length specified in the setup, each array should contain `Length`

elements:

where:

`Length`

is the length given in the setup.`h`

is the input array of complex numbers specified by`Ir`

and`Ii`

when the`v`

function is called:DSP _DFT _Execute `H`

is the output array of complex numbers specified by`Or`

and`Oi`

when the`v`

function returns:DSP _DFT _Execute *S*is -1 for a forward transform and +1 for an inverse transform.

Note

The notation `1**x`

is an abbreviation for `e**(2*pi*i*x)`

.

When the `v`

function is called with a setup returned from the `v`

function, it performs a real-to-complex transform if the direction specified in the setup is forward and a complex-to-real transform if the direction is inverse. In either direction, the data for the real side is stored alternately in the real and imaginary arrays (even-indexed elements in the real array, odd-indexed elements in the imaginary array). Given `Length`

as the length specified in the setup, each array should contain `Length`

/2 elements:

where:

`Length`

is the length given in the setup.*h*is the input array of numbers specified by`Ir`

and`Ii`

when the`v`

is called (see "Data Layout" below).DSP _DFT _Execute *H*is the output array of numbers specified by`Or`

and`Oi`

when the`v`

function returns (see "Data Layout", below.)DSP _DFT _Execute *S*is -1 for a forward transform and +1 for an inverse transform.

Data Layout for Real-to-Complex and Complex-to-Real Transforms:

For a forward transform:

*h*is an array of real numbers, with its even-index elements stored in`Ir`

and its odd-index elements stored in`Ii`

:*H*is an array of complex numbers, stored in`Or`

and`Oi`

:For

`Length`

/2 <*k*<`Length`

,*H[k]*is not explicitly stored in memory but is known because it necessarily equals the conjugate of*H[*`Length`

*-k]*, which is stored as described above.

For an inverse transformation, the layouts of the input and output arrays are swapped. `Ir`

and `Ii`

describe an input array with complex elements laid out as for `Or`

and `Oi`

. When the `v`

function returns, `Or`

and `Oi`

contain a pure real array, with its even-indexed elements stored in `Or`

and its odd-indexed elements in `Oi`

.