---
title: vDSP.DiscreteFourierTransform
framework: accelerate
role: symbol
role_heading: Class
path: accelerate/vdsp/discretefouriertransform
---

# vDSP.DiscreteFourierTransform

An object that provides forward and inverse discrete Fourier transforms on single- or double-precision collections of interleaved or split-complex data.

## Declaration

```swift
class DiscreteFourierTransform<T> where T : vDSP_DiscreteFourierTransformable
```

## Overview

Overview Use a vDSP.DiscreteFourierTransform to perform discrete Fourier transforms (DFTs) on split-complex or interleaved data. To learn more about working with split-complex and interleaved data, see Performing Fourier transforms on interleaved-complex data. To create a vDSP.DiscreteFourierTransform instance to work with interleaved data, pass either DSPComplex or DSPDoubleComplex to init(previous:count:direction:transformType:ofType:). The following code shows how to perform a forward complex-to-complex DFT on the interleaved single-precision values in the interleavedInput array: // The `interleavedInput` array contains `complexValuesCount` `DSPComplex` elements. let interleavedInput: [DSPComplex] = [ ... ]

let interleavedDFT = try? vDSP.DiscreteFourierTransform(previous: nil,                                                         count: complexValuesCount,                                                         direction: .forward,                                                         transformType: .complexComplex,                                                         ofType: DSPComplex.self)

// On return, the `interleavedOutput` array contains an array of `DSPComplex` // structures. let interleavedOutput = interleavedDFT?.transform(input: interleavedInput) To create a vDSP.DiscreteFourierTransform instance to work with split-complex data, pass either Float or Double to init(previous:count:direction:transformType:ofType:). Split-complex data stores the real and imaginary parts of each complex value in separate arrays. The following code shows how to perform forward complex-to-complex DFT on the split-complex single-precision values in the splitComplexRealInput and splitComplexImaginaryInput arrays: var splitComplexRealInput: [Float] = [ ... ] var splitComplexImaginaryInput: [Float] = [ ... ]

let splitComplexDFT = try? vDSP.DiscreteFourierTransform(previous: nil,                                                          count: complexValuesCount,                                                          direction: .forward,                                                          transformType: .complexComplex,                                                          ofType: Float.self)

// The `splitComplexOutput` tuple contains two arrays that represent the // real and imaginary parts of the output. let splitComplexOutput = splitComplexDFT?.transform(real: splitComplexRealInput,                                                     imaginary: splitComplexImaginaryInput) If the underlying data in both the interleavedInput array and the split-complex input arrays is the same, for each i in 0 ..< complexValuesCount, the following is true: interleavedOutput[i].real ≈ splitComplexOutput.real[i] interleavedOutput[i].imag ≈ splitComplexOutput.imaginary[i] ``

## Topics

### Creating a Discrete Fourier Transform Instance

- [init(previous:count:direction:transformType:ofType:)](accelerate/vdsp/discretefouriertransform/init(previous:count:direction:transformtype:oftype:).md)

### Performing Split-Complex Discrete Fourier Transforms

- [transform(real:imaginary:)](accelerate/vdsp/discretefouriertransform/transform(real:imaginary:)-4nwy9.md)
- [transform(real:imaginary:)](accelerate/vdsp/discretefouriertransform/transform(real:imaginary:)-82jag.md)
- [transform(inputReal:inputImaginary:outputReal:outputImaginary:)](accelerate/vdsp/discretefouriertransform/transform(inputreal:inputimaginary:outputreal:outputimaginary:)-sihh.md)
- [transform(inputReal:inputImaginary:outputReal:outputImaginary:)](accelerate/vdsp/discretefouriertransform/transform(inputreal:inputimaginary:outputreal:outputimaginary:)-7115x.md)

### Performing Interleaved Discrete Fourier Transforms

- [transform(input:)](accelerate/vdsp/discretefouriertransform/transform(input:)-92b3l.md)
- [transform(input:)](accelerate/vdsp/discretefouriertransform/transform(input:)-5si4h.md)
- [transform(input:output:)](accelerate/vdsp/discretefouriertransform/transform(input:output:)-1k3hd.md)
- [transform(input:output:)](accelerate/vdsp/discretefouriertransform/transform(input:output:)-1tsod.md)

### Initializers

- [init(previousDFT:count:direction:transformType:ofType:)](accelerate/vdsp/discretefouriertransform/init(previousdft:count:direction:transformtype:oftype:).md)

## See Also

### Objects that simplify discrete Fourier transforms

- [vDSP.DFTTransformType](accelerate/vdsp/dfttransformtype.md)
- [vDSP.DFT](accelerate/vdsp/dft.md)
