Multiplies the product of a single-precision vector and a single-precision scalar value by a single-precision scalar value.
SDKs
- iOS 4.0+
- macOS 10.4+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Accelerate
Declaration
func vDSP_vsmsa(_ __A: Unsafe Pointer<Float>, _ __IA: v DSP _Stride, _ __B: Unsafe Pointer<Float>, _ __C: Unsafe Pointer<Float>, _ __D: Unsafe Mutable Pointer<Float>, _ __ID: 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.
__C
Pointer to single-precision real input scalar.
__D
Single-precision real output vector.
__ID
Stride for
D
.__N
The number of elements to process.
Discussion
This function calculates the products of the first N
elements of A
and the scalar value B
, adds each product to the scalar value C
, and writes the result to D
:

The operation is:
for (n = 0; n < N; ++n)
D[n] = A[n]*B + C;
The following code shows an example of using v
:
let a: [Float] = [1, 2, 4, 5]
var b: Float = 2
var c: Float = 100
var d = [Float](repeating: 0,
count: a.count)
let stride = vDSP_Stride(1)
let n = vDSP_Length(a.count)
vDSP_vsmsa(a, stride,
&b,
&c,
&d, stride,
n)
// Prints "[102.0, 104.0, 108.0, 110.0]"
print(d)