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

# vDSP_meamgv

Calculates the mean of magnitudes of a single-precision vector.

```
extern void vDSP_meamgv(const float *__A, vDSP_Stride __IA, float *__C, vDSP_Length __N);
```

## Parameters

`__A`

The input vector.

`__IA`

The distance between the elements in the input vector.

`__C`

On output, the mean of magnitudes of the elements in the input vector.

`__N`

The number of elements that the function processes.

## Discussion

This function calculates the mean of magnitudes of the first `N` elements of the input vector and writes the result to the output scalar parameter, `C`.

The following code shows an example of using [`vDSP_meamgv`](/documentation/Accelerate/vDSP_meamgv):

```swift
    let stride = vDSP_Stride(1)

    let a: [Float] = [-8, -4, -2, 0, 2, 4, 8]
    let n = vDSP_Length(a.count)

    var c = Float()

    vDSP_meamgv(a,
               stride,
               &c,
               n)

    print(c) // Prints "4.0".
```

---

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)