Generic Type Method

maximumMagnitude(_:)

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

Declaration

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

Parameters

vector

The vector to query.

Discussion

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

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

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"

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 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, Double)

Returns the maximum magnitude element, and its index, of a double-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.