Generic Type Method

indexOfMaximumMagnitude(_:)

Returns the maximum magnitude element, and its index, of a double-precision vector.

Declaration

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

Parameters

vector

The vector to query.

Discussion

This function calculates and returns the maximum magnitude, and its index, in a supplied vector.

The following is an example of using indexOfMaximum(_:).

let a: [Double] = [-1.5, 2.25, 3.6,
                   0.2, -0.1, -4.3]

let indexOfMaximumMagnitude = vDSP.indexOfMaximumMagnitude(a)
print("indexOfMaximumMagnitude", indexOfMaximumMagnitude) // Prints "indexOfMaximumMagnitude (5, 4.3)"

See Also

Maximum Calculation

static func maximum<U>(U) -> Double

Returns the maximum element of a double-precision vector.

static func maximum<U>(U) -> Float

Returns the maximum element of a single-precision vector.

static func maximumMagnitude<U>(U) -> Double

Returns the maximum magnitude element of a double-precision vector.

static func maximumMagnitude<U>(U) -> Float

Returns the maximum magnitude element of a single-precision vector.

static func indexOfMaximum<U>(U) -> (UInt, Double)

Returns the maximum element, and its index, of a double-precision vector.

static func indexOfMaximum<U>(U) -> (UInt, Float)

Returns the maximum element, and its index, of a signal-precision vector.

static func indexOfMaximumMagnitude<U>(U) -> (UInt, Float)

Returns the maximum magnitude element, and its index, of a single-precision vector.

func vDSP_maxmgv(UnsafePointer<Float>, vDSP_Stride, UnsafeMutablePointer<Float>, vDSP_Length)

Calculates the maximum magnitude in a single-precision vector.

func vDSP_maxmgvi(UnsafePointer<Float>, vDSP_Stride, UnsafeMutablePointer<Float>, UnsafeMutablePointer<vDSP_Length>, vDSP_Length)

Calculates the maximum magnitude and corresponding index in a single-precision vector.