<!--
{
  "documentType" : "article",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/1d-correlation-and-convolution",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "1D correlation and convolution"
}
-->

# 1D correlation and convolution

Use correlation to compare and convolution to combine vectors of real or complex data.

## Discussion

The vDSP library provides functions that calculate the convolution and correlation of a signal and a filter. Both operations compute the sliding dot product of the filter and the section of the input signal that the filter is over. What the operation produced depends on whether the stride is positive or negative:

- With a positive stride through the filter, the correlation operation computes the similarity between the signal and the filter.
- With a negative stride through the filter, the convolution operation computes the effect of the filter on the signal. For example, to apply a low-pass filter to a signal.

## Topics

### Real Vectors

[`static func convolve<T, U>(T, withKernel: U) -> [Double]`](/documentation/Accelerate/vDSP/convolve(_:withKernel:)-1nv65)

Returns the 1D convolution of a double-precision vector.

[`static func convolve<T, U>(T, withKernel: U) -> [Float]`](/documentation/Accelerate/vDSP/convolve(_:withKernel:)-4p0rt)

Returns the 1D convolution of a single-precision vector.

[`static func convolve<T, U, V>(T, withKernel: U, result: inout V)`](/documentation/Accelerate/vDSP/convolve(_:withKernel:result:)-8j76l)

Calculates the 1D convolution of a double-precision vector.

[`static func convolve<T, U, V>(T, withKernel: U, result: inout V)`](/documentation/Accelerate/vDSP/convolve(_:withKernel:result:)-2z66w)

Calculates the 1D convolution of a single-precision vector.

[`static func correlate<T, U>(T, withKernel: U) -> [Double]`](/documentation/Accelerate/vDSP/correlate(_:withKernel:)-7f6o0)

Returns the correlation of a double-precision signal vector and a filter vector.

[`static func correlate<T, U>(T, withKernel: U) -> [Float]`](/documentation/Accelerate/vDSP/correlate(_:withKernel:)-9sol8)

Returns the correlation of a single-precision signal vector and a filter vector.

[`static func correlate<T, U, V>(T, withKernel: U, result: inout V)`](/documentation/Accelerate/vDSP/correlate(_:withKernel:result:)-1lb82)

Calculates the correlation of a double-precision signal vector and a filter vector.

[`static func correlate<T, U, V>(T, withKernel: U, result: inout V)`](/documentation/Accelerate/vDSP/correlate(_:withKernel:result:)-377zj)

Calculates the correlation of a single-precision signal vector and a filter vector.

[`extern void vDSP_conv(const float *__A, vDSP_Stride __IA, const float *__F, vDSP_Stride __IF, float *__C, vDSP_Stride __IC, vDSP_Length __N, vDSP_Length __P);`](/documentation/Accelerate/vDSP_conv)

Performs either correlation or convolution on two real single-precision vectors.

[`extern void vDSP_convD(const double *__A, vDSP_Stride __IA, const double *__F, vDSP_Stride __IF, double *__C, vDSP_Stride __IC, vDSP_Length __N, vDSP_Length __P);`](/documentation/Accelerate/vDSP_convD)

Performs either correlation or convolution on two real double-precision vectors.

### Complex Vectors

[`extern void vDSP_zconv(const DSPSplitComplex *__A, vDSP_Stride __IA, const DSPSplitComplex *__F, vDSP_Stride __IF, const DSPSplitComplex *__C, vDSP_Stride __IC, vDSP_Length __N, vDSP_Length __P);`](/documentation/Accelerate/vDSP_zconv)

Performs either correlation or convolution on two complex single-precision vectors.

[`extern void vDSP_zconvD(const DSPDoubleSplitComplex *__A, vDSP_Stride __IA, const DSPDoubleSplitComplex *__F, vDSP_Stride __IF, const DSPDoubleSplitComplex *__C, vDSP_Stride __IC, vDSP_Length __N, vDSP_Length __P);`](/documentation/Accelerate/vDSP_zconvD)

Performs either correlation or convolution on two complex double-precision vectors.



---

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)