Function

vDSP_viclip(_:_:_:_:_:_:_:)

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

Declaration

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

Parameters

__A

Single-precision real input vector

__IA

Stride for A

__B

Pointer to single-precision real input scalar: lower threshold

__C

Pointer to single-precision real input scalar: upper threshold

__D

Single-precision real output vector

__ID

Stride for D

__N

The number of elements to process

Discussion

Performs the following operation:

for (int n = 0; n < N; ++n) {
    if (A[nIA] <= *B || A[nIA] >= *C)
        D[nID] = A[nIA];
    else if (A[nIA] < 0)
        D[nID] = *B;
    else
        D[nID] = *C;
 
}

Performs an inverted clip of vector A using lower-threshold and upper-threshold input scalars *B and *C. Note that negative values in A are clipped to *B.

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