Generic Type Method

rootMeanSquare(_:)

Returns double-precision vector root mean square.

Declaration

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

Parameters

vector

The vector to calculate.

Discussion

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

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

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

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

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