Generic Type Method

meanMagnitude(_:)

Returns the double-precision vector mean magnitude.

Declaration

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

Parameters

vector

The vector to calculate.

Discussion

This function calculates and returns the mean magnitude of a supplied vector.

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

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

let meanMagnitude = vDSP.meanMagnitude(a)
print(String(format: "meanMagnitude %.4f", meanMagnitude)) // Prints "meanMagnitude 1.9917"

See Also

Mean Calculation

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

Returns the double-precision vector mean.

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

Returns the single-precision vector mean.

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

Returns the single-precision vector mean magnitude.

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

Returns the double-precision vector mean square.

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

Returns the single-precision vector mean square.

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

Returns double-precision vector root mean square.

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

Returns single-precision vector root mean square.

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

Calculates the mean of magnitudes in a single-precision vector.

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

Calculates the mean of signed squares in a single-precision vector.

func vDSP_mvessqD(UnsafePointer<Double>, vDSP_Stride, UnsafeMutablePointer<Double>, vDSP_Length)

Calculates the mean of signed squares in a double-precision vector.