Generic Type Method

meanSquare(_:)

Returns the double-precision vector mean square.

Declaration

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

Parameters

vector

The vector to calculate.

Discussion

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

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

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

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

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

Returns the double-precision vector mean magnitude.

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

Returns the single-precision vector mean magnitude.

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.