<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vDSP_DFT_zop_CreateSetupD",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@vDSP_DFT_zop_CreateSetupD"
  },
  "title" : "vDSP_DFT_zop_CreateSetupD"
}
-->

# vDSP_DFT_zop_CreateSetupD

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

```
vDSP_DFT_SetupDvDSP_DFT_zop_CreateSetupD(vDSP_DFT_SetupD __Previous, vDSP_Length __Length, vDSP_DFT_Direction __Direction);
```

## Parameters

`__Previous`

An existing [`vDSP_DFT_SetupD`](/documentation/Accelerate/vDSP_DFT_SetupD) 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 [`vDSP_DFT_Direction.FORWARD`](/documentation/Accelerate/vDSP_DFT_Direction/FORWARD) to transform from the time domain to the frequency domain. Pass [`vDSP_DFT_Direction.INVERSE`](/documentation/Accelerate/vDSP_DFT_Direction/INVERSE) to transform from the frequency domain to the time domain.

## Return Value

Returns a [`vDSP_DFT_SetupD`](/documentation/Accelerate/vDSP_DFT_SetupD) object, or `nil` if the function fails, either from insufficient memory or because `Length` doesn’t satisfy the requirements given above.

## 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_DestroySetupD`](/documentation/Accelerate/vDSP_DFT_DestroySetupD).

### 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:

```swift
double* reals = (double*)aligned_alloc(64, length*sizeof(double));
double* imaginaries = (double*)aligned_alloc(64, length*sizeof(double));
```

## See Also

  <doc://com.apple.accelerate/documentation/Accelerate/understanding-data-packing-for-fourier-transforms>

  <doc://com.apple.accelerate/documentation/Accelerate/reducing-spectral-leakage-with-windowing>



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)