---
title: "indexOfMaximumMagnitude(_:)"
framework: accelerate
role: symbol
role_heading: Type Method
path: "accelerate/vdsp/indexofmaximummagnitude(_:)-6847f"
---

# indexOfMaximumMagnitude(_:)

Returns the maximum magnitude and corresponding index in a double-precision vector.

## Declaration

```swift
static func indexOfMaximumMagnitude<U>(_ vector: U) -> (UInt, Double) where U : AccelerateBuffer, U.Element == Double
```

## Parameters

- `vector`: The input vector.

## Return Value

Return Value A tuple that contains the maximum magnitude and corresponding index.

## Discussion

Discussion This function calculates the maximum magnitude and its corresponding index of the first N elements of the input vector and writes the results to the output scalar parameters, C and I, respectively.

The following code shows an example of using this function: let a: [Double] = [-1.5, 2.25, 3.6,                    0.2, -0.1, -4.3]

let indexOfMaximumMagnitude = vDSP.indexOfMaximumMagnitude(a)

// Prints "indexOfMaximumMagnitude (5, 4.3)". print("indexOfMaximumMagnitude", indexOfMaximumMagnitude)

## See Also

### Type Methods

- [absolute(_:)](accelerate/vdsp/absolute(_:)-9c3ge.md)
- [absolute(_:)](accelerate/vdsp/absolute(_:)-5ehc1.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-9x5jn.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-1wu9x.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-657bd.md)
- [absolute(_:result:)](accelerate/vdsp/absolute(_:result:)-4pigo.md)
- [add(_:_:)](accelerate/vdsp/add(_:_:)-9mv1a.md)
- [add(_:_:)](accelerate/vdsp/add(_:_:)-2ftxc.md)
- [add(_:_:)](accelerate/vdsp/add(_:_:)-53nh9.md)
- [add(_:_:)](accelerate/vdsp/add(_:_:)-7swvf.md)
- [add(_:_:result:)](accelerate/vdsp/add(_:_:result:)-2531u.md)
- [add(_:_:result:)](accelerate/vdsp/add(_:_:result:)-2w0o9.md)
- [add(_:_:result:)](accelerate/vdsp/add(_:_:result:)-338hl.md)
- [add(_:_:result:)](accelerate/vdsp/add(_:_:result:)-3vzwi.md)
- [add(_:to:count:result:)](accelerate/vdsp/add(_:to:count:result:)-g1dk.md)
