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

# vDSP_dotpr2

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

```
void vDSP_dotpr2(const float *__A0, vDSP_Stride __IA0, const float *__A1, vDSP_Stride __IA1, const float *__B, vDSP_Stride __IB, float *__C0, float *__C1, vDSP_Length __N);
```

## Parameters

`__A0`

The input vector `A` for the first channel.

`__IA0`

The distance between the elements in the input vector `A` for the first channel.

`__A1`

The input vector `A` for the second channel.

`__IA1`

The distance between the elements in the input vector `A` for the first channel.

`__B`

The input vector `B` for both channels.

`__IB`

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

`__C0`

On output, the dot product of the input vector `A` for the first channel and the input vector `B`.

`__C1`

On output, the dot product of the input vector `A` for the second channel and the input vector `B`.

`__N`

The number of elements to process.

## Discussion

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

```objc
    sum0 = 0;
    sum1 = 0;
    for (i = 0; i < Length; ++i)
    {
        sum0 += A0[i*A0Stride] * B[i*BStride];
        sum1 += A1[i*A1Stride] * B[i*BStride];
    }
    *C0 = sum0;
    *C1 = sum1;
```

For example, the following code calculates the dot products:

```swift
    let stride = 1
    let n = 3
    
    let a0: [Float] = [ 1.0,  2.0,  3.0]
    let a1: [Float] = [10.0, 20.0, 30.0]
    let b: [Float] = [  4.0,  5.0,  6.0]
    
    var c0 = Float()
    var c1 = Float()
    
    vDSP_dotpr2(a0, stride,
                a1, stride,
                b, stride,
                &c0,
                &c1,
                vDSP_Length(n))
    
    // Prints "32.0 320.0".
    print(c0, c1)
```

---

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)