Generic Type Method

indexOfMinimum(_:)

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

Declaration

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

Parameters

vector

The vector to query.

Discussion

This function calculates and returns the minimum value, and its index, in a supplied vector.

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

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

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

See Also

Minimum Calculation

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

Returns the minimum element of a double-precision vector.

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

Returns the minimum element of a single-precision vector.

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

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

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

Calculates the minimum magnitude in a single-precision vector.

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

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