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

# vDSP_maxmgvD

Calculates the double-precision maximum magnitude of a vector.

```
extern void vDSP_maxmgvD(const double *__A, vDSP_Stride __IA, double *__C, vDSP_Length __N);
```

## Parameters

`__A`

The input vector, `A`.

`__IA`

The distance between the elements in the input vector.

`__C`

The output scalar value, `C`. If `N` is zero, the function sets `C` to `0`.

`__N`

The number of elements that the function processes.

## Discussion

This function calculates the maximum magnitude of the first `N` elements of input vector `A`, and writes the result to output scalar `C`.

![A diagram showing the operation of this function. There are three rows. The top row represents the input vector, A, with three boxes. The middle row represents the operation a boxes that contains the absolute-maximum function. The bottom row represents the output scalar value C as a  box. The diagram has connecting lines from the input vector to the operation, and from the operation to the output scalar value.](images/com.apple.accelerate/media-4465876@2x.png)

The following code shows an example of using this function:

```swift
    let stride = vDSP_Stride(1)
    
    let a: [Double] = [-1.5, 2.25, 3.6,
                        0.2, -0.1, -4.3]
    let n = vDSP_Length(a.count)
    
    var c = Double()
    
    vDSP_maxmgvD(a,
                 stride,
                 &c,
                 n)
    
    print("max magnitude", c) // Prints "max magnitude 4.3".
```

---

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)