Function

# vDSP_DFT_Execute

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

## Parameters

__Setup

A DFT setup object returned by a call to vDSP_DFT_zop_CreateSetup or vDSP_DFT_zrop_CreateSetup.

__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 vDSP_DFT_zrop_CreateSetupvDSP_DFT_zrop_CreateSetup or vDSP_DFT_zop_CreateSetup.

For a complex DFT, the way the vDSP_DFT_Execute 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 vDSP_DFT_Execute function is called with a setup returned from the vDSP_DFT_zop_CreateSetup 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 vDSP_DFT_Execute function is called:

• H is the output array of complex numbers specified by Or and Oi when the vDSP_DFT_Execute function returns:

• S is -1 for a forward transform and +1 for an inverse transform.

When the vDSP_DFT_Execute function is called with a setup returned from the vDSP_DFT_zrop_CreateSetup 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 vDSP_DFT_Execute is called (see "Data Layout" below).

• H is the output array of numbers specified by Or and Oi when the vDSP_DFT_Execute function returns (see "Data Layout", below.)

• 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 vDSP_DFT_Execute 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.

### Discrete Fourier Transforms

vDSP_DFT_zop_CreateSetup

Creates a data structure for use with vDSP_DFT_Execute or vDSP_DCT_Execute to perform a complex-to-complex discrete Fourier transform, forward or inverse.

vDSP_DFT_zop_CreateSetupD

Creates a data structure for use with vDSP_DFT_ExecuteD to perform a double-precision, complex-to-complex discrete Fourier transform, forward or inverse.

vDSP_DFT_zrop_CreateSetup

Creates a data structure for use with vDSP_DFT_Execute to perform a single-precision discrete Fourier transform, forward (real to complex) or inverse (complex to real).

vDSP_DFT_zrop_CreateSetupD

Creates a data structure for use with vDSP_DFT_ExecuteD to perform a double-precision discrete Fourier transform, forward (real to complex) or inverse (complex to real).

vDSP_DFT_DestroySetup

Releases a single-precision setup object.

vDSP_DFT_DestroySetupD

Releases a double-precision setup object.

vDSP_DFT_ExecuteD

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