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

# vDSP_zdotpr

Calculates the dot product of two single-precision complex vectors.

```
extern void vDSP_zdotpr(const DSPSplitComplex *__A, vDSP_Stride __IA, const DSPSplitComplex *__B, vDSP_Stride __IB, const DSPSplitComplex *__C, vDSP_Length __N);
```

## Parameters

`__A`

The input vector `A`.

`__IA`

The distance between the elements in the input vector `A`.

`__B`

The input vector `B`.

`__IB`

The distance between the elements in the input vector `B`.

`__C`

On output, the dot product of the two vectors.

`__N`

The number of elements to process.

## Discussion

This function calculates the dot product of two vectors, using the following operation:

```objc
C[0] = sum(A[n] * B[n], 0 <= n < N);
```

For example, the following code calculates the dot product of the two vectors `[1, 2, 3]` and `[4, 5, 6]` as `(1*4)+(2*5)+(3*6)=32`:

```swift
    let stride = 1
    let n = 3
    
    let aReal = UnsafeMutableBufferPointer<Float>.allocate(capacity: n)
    _ = aReal.initialize(from: [ 1.0, 2.0, 3.0 ])
    
    let aImag = UnsafeMutableBufferPointer<Float>.allocate(capacity: n)
    _ = aImag.initialize(from: [ 0.0, 0.0, 0.0 ])
    
    var a = DSPSplitComplex(realp: aReal.baseAddress!,
                            imagp: aImag.baseAddress!)
    
    let bReal = UnsafeMutableBufferPointer<Float>.allocate(capacity: n)
    _ = bReal.initialize(from: [ 4.0, 5.0, 6.0 ])
    
    let bImag = UnsafeMutableBufferPointer<Float>.allocate(capacity: n)
    _ = bImag.initialize(from: [ 0.0, 0.0, 0.0 ])
    
    var b = DSPSplitComplex(realp: bReal.baseAddress!,
                            imagp: bImag.baseAddress!)
    
    let cReal = UnsafeMutablePointer<Float>.allocate(capacity: 1)
    let cImag = UnsafeMutablePointer<Float>.allocate(capacity: 1)
    var c = DSPSplitComplex(realp: cReal,
                            imagp: cImag)
    
    
    vDSP_zdotpr(&a, stride,
                &b, stride,
                &c, 
                vDSP_Length(n))
    
    // Prints "32.0 0.0".
    print(cReal.pointee, cImag.pointee)
```

---

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)