<!--
{
  "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_dotpr",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@vDSP_dotpr"
  },
  "title" : "vDSP_dotpr"
}
-->

# vDSP_dotpr

Calculates the dot product of two single-precision vectors.

```
extern void vDSP_dotpr(const float *__A, vDSP_Stride __IA, const float *__B, vDSP_Stride __IB, float *__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 a: [Float] = [1.0, 2.0, 3.0]
    let b: [Float] = [4.0, 5.0, 6.0]
    
    var c = Float()
    
    vDSP_dotpr(a, stride,
               b, stride, 
               &c,
               vDSP_Length(n))
    
    // Prints "32.0".
    print(c)
```

---

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)