---
title: vDSP_DFT_zop_CreateSetup
framework: accelerate
role: symbol
role_heading: Function
path: accelerate/vdsp_dft_zop_createsetup
---

# vDSP_DFT_zop_CreateSetup

Returns a setup structure that contains precalculated data for forward and inverse, complex, single-precision DFT functions.

## Declaration

```occ
vDSP_DFT_SetupvDSP_DFT_zop_CreateSetup(vDSP_DFT_Setup __Previous, vDSP_Length __Length, vDSP_DFT_Direction __Direction);
```

## Parameters

- `__Previous`: An existing doc://com.apple.accelerate/documentation/Accelerate/vDSP_DFT_Setup structure that shares memory with the returned setup structure. Pass nil to create an object with newly initialized and allocated memory.
- `__Length`: The number of complex elements to process. The supported values are f * 2**n, where f is 1, 3, 5, or 15 and n is at least 3.
- `__Direction`: A flag that specifies the transform direction. Pass doc://com.apple.accelerate/documentation/Accelerate/vDSP_DFT_Direction/FORWARD to transform from the time domain to the frequency domain. Pass doc://com.apple.accelerate/documentation/Accelerate/vDSP_DFT_Direction/INVERSE to transform from the frequency domain to the time domain.

## Mentioned in

Performing Fourier transforms on interleaved-complex data Understanding data packing for Fourier transforms

## Return Value

Return Value Returns a vDSP_DFT_Setup object, or nil if the function fails, either from insufficient memory or because Length doesn’t satisfy the requirements given above.

## Discussion

Discussion important: To prevent potential memory leaks, if the Previous parameter is not nil, the return value and the Previous value must be different variables. Discussion This function shares memory between data structures where possible. If you have an existing setup object, you should pass that object as Previous. By doing so, the returned setup object can share underlying data storage with that object. Note that this function may allocate memory; you can free any allocated memory by calling vDSP_DFT_DestroySetup. Using shared setup objects If you’re using a shared setup object, the subsequent execute function requires that the input and output pointers are 64-byte aligned. The following code shows how to create the correctly aligned vectors: float* reals = (float*)aligned_alloc(64, length*sizeof(float)); float* imaginaries = (float*)aligned_alloc(64, length*sizeof(float));

## See Also

### Related Documentation

- [Understanding data packing for Fourier transforms](accelerate/understanding-data-packing-for-fourier-transforms.md)
- [Reducing spectral leakage with windowing](accelerate/reducing-spectral-leakage-with-windowing.md)

### Complex discrete Fourier transform setup

- [vDSP_DFT_zop_CreateSetupD](accelerate/vdsp_dft_zop_createsetupd.md)
