Increase the performance of common mathematical tasks with vDSP vector-vector and vector-scalar operations.
vDSP provides a suite of general-purpose, high-performance arithmetic functions that are alternatives to
for loops and
map when applying operations on arrays of floating-point values.
For example, the following code multiplies the elementwise sum of two arrays by a scalar value:
The vDSP version of the same operation runs significantly faster:
Many vDSP functions have a variant that returns the result, for example:
The following table summarizes the basic arithmetic functions available in vDSP. All functions are available in single- and double-precision variants.
In the Operation column, a subscript (for example,
a[i]) indicates a vector, and no subscript (for example,
a) indicates a scalar value.