<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vDSP/maximumMagnitude(_:)-19jre",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate4vDSPO16maximumMagnitudeySfxAA0A6BufferRzSf7ElementRtzlFZ"
  },
  "title" : "maximumMagnitude(_:)"
}
-->

# maximumMagnitude(_:)

Returns the single-precision maximum magnitude of a vector.

```
static func maximumMagnitude<U>(_ vector: U) -> Float where U : AccelerateBuffer, U.Element == Float
```

## Parameters

`vector`

The input vector.

## Return Value

The maximum magnitude of the vector.

## 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-4465953@2x.png)

The following code shows an example of using this function:

```swift
let a: [Float] = [-1.5, 2.25, 3.6,
                  0.2, -0.1, -4.3]

let maximumMagnitude = vDSP.maximumMagnitude(a)
print("maximumMagnitude", maximumMagnitude) // Prints "maximumMagnitude 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)