Contents

mean(_:)

Returns the mean value of a double-precision vector.

Declaration

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

Parameters

  • vector:

    The source vector.

Discussion

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

The following is an example of using mean(_:):

    let a: [Double] = [-8, -4, -2, 0, 2, 4, 8]

    let mean = vDSP.mean(a)
    
    print(mean) // Prints "0.0".

See Also

Type Methods