Function

vDSP_vclipc(_:_:_:_:_:_:_:_:_:)

Calculates and counts the elements of a single-precision vector clipped to the specified range.

Declaration

func vDSP_vclipc(_ __A: UnsafePointer<Float>, _ __IA: vDSP_Stride, _ __B: UnsafePointer<Float>, _ __C: UnsafePointer<Float>, _ __D: UnsafeMutablePointer<Float>, _ __ID: vDSP_Stride, _ __N: vDSP_Length, _ __NLow: UnsafeMutablePointer<vDSP_Length>, _ __NHigh: UnsafeMutablePointer<vDSP_Length>)

Parameters

__A

Single-precision real input vector

__IA

Stride for A

__B

Pointer to single-precision real input scalar: low clipping threshold

__C

Pointer to single-precision real input scalar: high clipping threshold

__D

Single-precision real output vector

__ID

Stride for D

__vDSP_N

Number of elements in A and D

__NLow

Pointer to integer: number of elements that were clipped to *B

__NHigh

Pointer to integer: number of elements that were clipped to *C

Discussion

This performs the following operation:

for (n = 0; n < N; ++n) {
    if (A[n*IA] < *B)
        D[n*ID] = *B;
    else if (A[n*IA] > *C)
        D[n*ID] = *C;
    else
        D[n*ID] = A[n*IA];
}

Elements of A are copied to D, while clipping elements that are outside the interval [*B, *C] to the endpoints of the interval.

The count of elements clipped to *B is returned in *NLow, and the count of elements clipped to *C is returned in *NHigh

See Also

Clipping Operations

static func clip<U>(U, to: ClosedRange<Double>) -> [Double]

Returns the elements of a double-precision vector clipped to the specified range.

static func clip<U>(U, to: ClosedRange<Float>) -> [Float]

Returns the elements of a single-precision vector clipped to the specified range.

static func clip<U, V>(U, to: ClosedRange<Double>, result: inout V)

Calculates the elements of a double-precision vector clipped to the specified range.

static func clip<U, V>(U, to: ClosedRange<Float>, result: inout V)

Calculates the elements of a single-precision vector clipped to the specified range.

static func invertedClip<U>(U, to: ClosedRange<Double>) -> [Double]

Returns a double-precision vector that’s inverted-clipped to the specified range.

static func invertedClip<U>(U, to: ClosedRange<Float>) -> [Float]

Returns a single-precision vector that’s inverted-clipped to the specified range.

static func invertedClip<U, V>(U, to: ClosedRange<Double>, result: inout V)

Calculates a double-precision vector that’s inverted-clipped to the specified range.

static func invertedClip<U, V>(U, to: ClosedRange<Float>, result: inout V)

Calculates a single-precision vector that’s inverted-clipped to the specified range.

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

Calculates the elements of a single-precision vector clipped to the specified range using the specified stride.

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

Calculates the elements of a double-precision vector clipped to the specified range using the specified stride.

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

Calculates the elements of a single-precision vector inverted-clipped to the specified range using the specified stride.

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

Calculates the elements of a double-precision vector inverted-clipped to the specified range using the specified stride.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software