Calculates single-precision vector threshold to the specified range.
SDKs
- iOS 4.0+
- macOS 10.4+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Accelerate
Declaration
func vDSP_vthr(_ __A: Unsafe Pointer<Float>, _ __IA: v DSP _Stride, _ __B: Unsafe Pointer<Float>, _ __C: Unsafe Mutable Pointer<Float>, _ __IC: v DSP _Stride, _ __N: v DSP _Length)
Parameters
__A
Single-precision real input vector
__IA
Stride for
A
__B
Pointer to single-precision real input scalar: lower threshold
__C
Single-precision real output vector
__IC
Stride for
C
__N
The number of elements to process
Discussion
Performs the following operation:
for (n = 0; n < N; ++n){
if (A[n*IA] >= *B)
C[n*IC] = A[n*IA];
else
C[n*IC] = *B;
}
Creates vector C
by comparing each input from vector A
with scalar *B
. If an input value is less than *B
, *B
is copied to C
; otherwise, the input value from A
is copied to C
.