<!--
{
  "documentType" : "article",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vector-scalar-real-arithmetic-functions",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Vector-scalar real arithmetic functions"
}
-->

# Vector-scalar real arithmetic functions

Perform element-wise operations on combinations of vectors of real values and scalar values.

## Discussion

The vDSP library provides a suite of general-purpose, high-performance arithmetic functions that are alternatives to `for` loops and `map` when you apply operations on collections of floating-point values.

See <doc://com.apple.documentation/documentation/Accelerate/using-vdsp-for-vector-based-arithmetic> for a summary of available operations.

## Topics

### Vector-scalar addition operations

[`static func add<U>(Float, U) -> [Float]`](/documentation/Accelerate/vDSP/add(_:_:)-53nh9)

Returns the single-precision element-wise sum of a vector and a scalar value.

[`static func add<U>(Double, U) -> [Double]`](/documentation/Accelerate/vDSP/add(_:_:)-9mv1a)

Returns the double-precision element-wise sum of a vector and a scalar value.

[`static func add<U, V>(Float, U, result: inout V)`](/documentation/Accelerate/vDSP/add(_:_:result:)-2w0o9)

Calculates the single-precision element-wise sum of a vector and a scalar value.

[`static func add<U, V>(Double, U, result: inout V)`](/documentation/Accelerate/vDSP/add(_:_:result:)-2531u)

Calculates the single-precision element-wise sum of a vector and a scalar value.

[`extern void vDSP_vsaddi(const int *__A, vDSP_Stride __IA, const int *__B, int *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsaddi)

Calculates the integer element-wise sum of a vector and a scalar value, using the specified stride.

[`extern void vDSP_vsadd(const float *__A, vDSP_Stride __IA, const float *__B, float *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsadd)

Calculates the single-precision element-wise sum of a vector and a scalar value, using the specified stride.

[`extern void vDSP_vsaddD(const double *__A, vDSP_Stride __IA, const double *__B, double *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsaddD)

Calculates the double-precision element-wise sum of a vector and a scalar value, using the specified stride.

### Vector-scalar multiplication operations

[`static func multiply<U>(Float, U) -> [Float]`](/documentation/Accelerate/vDSP/multiply(_:_:)-993yp)

Returns the single-precision element-wise product of a vector and a scalar value.

[`static func multiply<U>(Double, U) -> [Double]`](/documentation/Accelerate/vDSP/multiply(_:_:)-9dxnc)

Returns the double-precision element-wise product of a vector and a scalar value.

[`static func multiply<U, V>(Float, U, result: inout V)`](/documentation/Accelerate/vDSP/multiply(_:_:result:)-358cn)

Calculates the single-precision element-wise product of a vector and a scalar value.

[`static func multiply<U, V>(Double, U, result: inout V)`](/documentation/Accelerate/vDSP/multiply(_:_:result:)-4xorc)

Calculates the double-precision element-wise product of a vector and a scalar value.

[`extern void vDSP_vsmul(const float *__A, vDSP_Stride __IA, const float *__B, float *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsmul)

Calculates the single-precision element-wise product of a vector and a scalar value, using the specified stride.

[`extern void vDSP_vsmulD(const double *__A, vDSP_Stride __IA, const double *__B, double *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsmulD)

Calculates the double-precision element-wise product of a vector and a scalar value, using the specified stride.

### Vector-scalar division operations

[`static func divide<U>(U, Float) -> [Float]`](/documentation/Accelerate/vDSP/divide(_:_:)-1uqmz)

Calculates the single-precision element-wise division of a vector and a scalar value.

[`static func divide<U>(U, Double) -> [Double]`](/documentation/Accelerate/vDSP/divide(_:_:)-9nb4j)

Calculates the double-precision element-wise division of a vector and a scalar value.

[`static func divide<U, V>(U, Float, result: inout V)`](/documentation/Accelerate/vDSP/divide(_:_:result:)-5hwb2)

Calculates the single-precision element-wise division of a vector and a scalar value.

[`static func divide<U, V>(U, Double, result: inout V)`](/documentation/Accelerate/vDSP/divide(_:_:result:)-44mff)

Calculates the double-precision element-wise division of a vector and a scalar value.

[`extern void vDSP_vsdivi(const int *__A, vDSP_Stride __IA, const int *__B, int *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsdivi)

Calculates the integer element-wise division of a vector and a scalar value, using the specified stride.

[`extern void vDSP_vsdiv(const float *__A, vDSP_Stride __IA, const float *__B, float *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsdiv)

Calculates the single-precision element-wise division of a vector and a scalar value, using the specified stride.

[`extern void vDSP_vsdivD(const double *__A, vDSP_Stride __IA, const double *__B, double *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsdivD)

Calculates the double-precision element-wise division of a vector and a scalar value, using the specified stride.

### Scalar-vector division operations

[`static func divide<U>(Float, U) -> [Float]`](/documentation/Accelerate/vDSP/divide(_:_:)-70npt)

Returns the single-precision element-wise division of a scalar value and a vector.

[`static func divide<U>(Double, U) -> [Double]`](/documentation/Accelerate/vDSP/divide(_:_:)-73m8v)

Returns the double-precision element-wise division of a scalar value and a vector.

[`static func divide<U, V>(Float, U, result: inout V)`](/documentation/Accelerate/vDSP/divide(_:_:result:)-3emlk)

Calculates the single-precision element-wise division of a scalar value and a vector.

[`static func divide<U, V>(Double, U, result: inout V)`](/documentation/Accelerate/vDSP/divide(_:_:result:)-18qa3)

Calculates the double-precision element-wise division of a scalar value and a vector.

[`extern void vDSP_svdiv(const float *__A, const float *__B, vDSP_Stride __IB, float *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_svdiv)

Calculates the single-precision element-wise division of a scalar value and a vector, using the specified stride.

[`extern void vDSP_svdivD(const double *__A, const double *__B, vDSP_Stride __IB, double *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_svdivD)

Calculates the double-precision element-wise division of a scalar value and a vector, using the specified stride.

### Vector-vector-scalar add-multiply operations

[`static func multiply<T, U>(addition: (a: T, b: U), Float) -> [Float]`](/documentation/Accelerate/vDSP/multiply(addition:_:)-4fnbx)

Returns the single-precision element-wise product of the sum of two vectors and a scalar value.

[`static func multiply<T, U>(addition: (a: T, b: U), Double) -> [Double]`](/documentation/Accelerate/vDSP/multiply(addition:_:)-4c9in)

Returns the double-precision element-wise product of the sum of two vectors and a scalar value.

[`static func multiply<T, U, V>(addition: (a: T, b: U), Float, result: inout V)`](/documentation/Accelerate/vDSP/multiply(addition:_:result:)-6x7xq)

Calculates the single-precision element-wise product of the sum of two vectors and a scalar value.

[`static func multiply<T, U, V>(addition: (a: T, b: U), Double, result: inout V)`](/documentation/Accelerate/vDSP/multiply(addition:_:result:)-7dujy)

Calculates the double-precision element-wise product of the sum of two vectors and a scalar value.

[`extern void vDSP_vasm(const float *__A, vDSP_Stride __IA, const float *__B, vDSP_Stride __IB, const float *__C, float *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vasm)

Calculates the single-precision element-wise product of the sum of two vectors and a scalar value, using the specified stride.

[`extern void vDSP_vasmD(const double *__A, vDSP_Stride __IA, const double *__B, vDSP_Stride __IB, const double *__C, double *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vasmD)

Calculates the double-precision element-wise product of the sum of two vectors and a scalar value, using the specified stride.

### Vector-vector-scalar subtract-multiply operations

[`static func multiply<T, U>(subtraction: (a: T, b: U), Float) -> [Float]`](/documentation/Accelerate/vDSP/multiply(subtraction:_:)-106pt)

Returns the single-precision element-wise product of the difference of two vectors and a scalar value.

[`static func multiply<T, U>(subtraction: (a: T, b: U), Double) -> [Double]`](/documentation/Accelerate/vDSP/multiply(subtraction:_:)-3gxn3)

Returns the double-precision element-wise product of the difference of two vectors and a scalar value.

[`static func multiply<T, U, V>(subtraction: (a: T, b: U), Float, result: inout V)`](/documentation/Accelerate/vDSP/multiply(subtraction:_:result:)-5l106)

Calculates the single-precision element-wise product of the difference of two vectors and a scalar value.

[`static func multiply<T, U, V>(subtraction: (a: T, b: U), Double, result: inout V)`](/documentation/Accelerate/vDSP/multiply(subtraction:_:result:)-lhn7)

Calculates the double-precision element-wise product of the difference of two vectors and a scalar value.

[`extern void vDSP_vsbsm(const float *__A, vDSP_Stride __IA, const float *__B, vDSP_Stride __IB, const float *__C, float *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsbsm)

Calculates the single-precision element-wise product of the difference of two vectors and a scalar value, using the specified stride.

[`extern void vDSP_vsbsmD(const double *__A, vDSP_Stride __IA, const double *__B, vDSP_Stride __IB, const double *__C, double *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsbsmD)

Calculates the double-precision element-wise product of the difference of two vectors and a scalar value, using the specified stride.

### Vector-scalar-vector multiply-subtract operations

[`static func subtract<T, U>(multiplication: (a: U, b: Float), T) -> [Float]`](/documentation/Accelerate/vDSP/subtract(multiplication:_:)-3zm6l)

Calculates the single-precision element-wise difference of the product of a vector and a scalar value, and a vector.

[`static func subtract<T, U>(multiplication: (a: U, b: Double), T) -> [Double]`](/documentation/Accelerate/vDSP/subtract(multiplication:_:)-2hhme)

Calculates the double-precision element-wise difference of the product of a vector and a scalar value, and a vector.

[`static func subtract<T, U, V>(multiplication: (a: U, b: Float), T, result: inout V)`](/documentation/Accelerate/vDSP/subtract(multiplication:_:result:)-86gx3)

Calculates the single-precision element-wise difference of the product of a vector and a scalar value, and a vector.

[`static func subtract<T, U, V>(multiplication: (a: U, b: Double), T, result: inout V)`](/documentation/Accelerate/vDSP/subtract(multiplication:_:result:)-9p12h)

Calculates the double-precision element-wise difference of the product of a vector and a scalar value, and a vector.

[`extern void vDSP_vsmsb(const float *__A, vDSP_Stride __IA, const float *__B, const float *__C, vDSP_Stride __IC, float *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsmsb)

Calculates the single-precision element-wise difference of the product of a vector and a scalar value, and a vector, using the specified stride.

[`extern void vDSP_vsmsbD(const double *__A, vDSP_Stride __IA, const double *__B, const double *__C, vDSP_Stride __IC, double *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsmsbD)

Calculates the double-precision element-wise difference of the product of a vector and a scalar value, and a vector, using the specified stride.

### Vector-vector-scalar multiply-add operations

[`static func add<T, U>(multiplication: (a: T, b: U), Float) -> [Float]`](/documentation/Accelerate/vDSP/add(multiplication:_:)-36vhq)

Returns the single-precision element-wise sum of the product of two vectors, and a scalar value.

[`static func add<T, U>(multiplication: (a: T, b: U), Double) -> [Double]`](/documentation/Accelerate/vDSP/add(multiplication:_:)-9dxlr)

Returns the double-precision element-wise sum of the product of two vectors, and a scalar value.

[`static func add<T, U, V>(multiplication: (a: T, b: U), Float, result: inout V)`](/documentation/Accelerate/vDSP/add(multiplication:_:result:)-8dau)

Calculates the single-precision element-wise sum of the product of two vectors, and a scalar value.

[`static func add<T, U, V>(multiplication: (a: T, b: U), Double, result: inout V)`](/documentation/Accelerate/vDSP/add(multiplication:_:result:)-2wpvw)

Calculates the double-precision element-wise sum of the product of two vectors, and a scalar value.

[`extern void vDSP_vmsa(const float *__A, vDSP_Stride __IA, const float *__B, vDSP_Stride __IB, const float *__C, float *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vmsa)

Calculates the single-precision element-wise sum of the product of two vectors, and a scalar value, using the specified stride.

[`extern void vDSP_vmsaD(const double *__A, vDSP_Stride __IA, const double *__B, vDSP_Stride __IB, const double *__C, double *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vmsaD)

Calculates the double-precision element-wise sum of the product of two vectors, and a scalar value, using the specified stride.

### Vector-scalar-vector multiply-add operations

[`static func add<T, U>(multiplication: (a: T, b: Float), U) -> [Float]`](/documentation/Accelerate/vDSP/add(multiplication:_:)-7aut1)

Returns the single-precision element-wise addition of the product of a vector and a scalar value, and a vector.

[`static func add<T, U>(multiplication: (a: T, b: Double), U) -> [Double]`](/documentation/Accelerate/vDSP/add(multiplication:_:)-1bsuq)

Returns the double-precision element-wise addition of the product of a vector and a scalar value, and a vector.

[`static func add<T, U, V>(multiplication: (a: T, b: Float), U, result: inout V)`](/documentation/Accelerate/vDSP/add(multiplication:_:result:)-6n4jf)

Calculates the single-precision element-wise addition of the product of a vector and a scalar value, and a vector.

[`static func add<T, U, V>(multiplication: (a: T, b: Double), U, result: inout V)`](/documentation/Accelerate/vDSP/add(multiplication:_:result:)-2i5om)

Calculates the double-precision element-wise addition of the product of a vector and a scalar value, and a vector.

[`extern void vDSP_vsma(const float *__A, vDSP_Stride __IA, const float *__B, const float *__C, vDSP_Stride __IC, float *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsma)

Calculates the single-precision element-wise addition of the product of a vector and a scalar value, and a vector, using the specified stride.

[`extern void vDSP_vsmaD(const double *__A, vDSP_Stride __IA, const double *__B, const double *__C, vDSP_Stride __IC, double *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsmaD)

Calculates the double-precision element-wise addition of the product of a vector and a scalar value, and a vector, using the specified stride.

### Vector-scalar-scalar multiply-add operations

[`static func add<U>(multiplication: (a: U, b: Float), Float) -> [Float]`](/documentation/Accelerate/vDSP/add(multiplication:_:)-3tw93)

Returns the single-precision element-wise addition of the product of a vector and a scalar value, and a vector.

[`static func add<U>(multiplication: (a: U, b: Double), Double) -> [Double]`](/documentation/Accelerate/vDSP/add(multiplication:_:)-4e3tj)

Returns the double-precision element-wise addition of the product of a vector and a scalar value, and a vector.

[`static func add<U, V>(multiplication: (a: U, b: Float), Float, result: inout V)`](/documentation/Accelerate/vDSP/add(multiplication:_:result:)-1rob9)

Calculates the single-precision element-wise addition of the product of a vector and a scalar value, and a scalar.

[`static func add<U, V>(multiplication: (a: U, b: Double), Double, result: inout V)`](/documentation/Accelerate/vDSP/add(multiplication:_:result:)-8ixx9)

Calculates the double-precision element-wise addition of the product of a vector and a scalar value, and a scalar.

[`extern void vDSP_vsmsa(const float *__A, vDSP_Stride __IA, const float *__B, const float *__C, float *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsmsa)

Calculates the single-precision element-wise addition of the product of a vector and a scalar value, and a scalar value, using the specified stride.

[`extern void vDSP_vsmsaD(const double *__A, vDSP_Stride __IA, const double *__B, const double *__C, double *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsmsaD)

Calculates the double-precision element-wise addition of the product of a vector and a scalar value, and a scalar value, using the specified stride.

### Vector-scalar-vector-scalar multiply-multiply-add operations

[`static func add<T, U>(multiplication: (a: T, b: Float), multiplication: (c: U, d: Float)) -> [Float]`](/documentation/Accelerate/vDSP/add(multiplication:multiplication:)-8rjh8)

Returns the single-precision element-wise addition of two vector-scalar products.

[`static func add<T, U>(multiplication: (a: T, b: Double), multiplication: (c: U, d: Double)) -> [Double]`](/documentation/Accelerate/vDSP/add(multiplication:multiplication:)-563ub)

Returns the double-precision element-wise addition of two vector-scalar products.

[`static func add<T, U, V>(multiplication: (a: T, b: Float), multiplication: (c: U, d: Float), result: inout V)`](/documentation/Accelerate/vDSP/add(multiplication:multiplication:result:)-663mk)

Calculates the single-precision element-wise addition of two vector-scalar products.

[`static func add<T, U, V>(multiplication: (a: T, b: Double), multiplication: (c: U, d: Double), result: inout V)`](/documentation/Accelerate/vDSP/add(multiplication:multiplication:result:)-9xe8k)

Calculates the double-precision element-wise addition of two vector-scalar products.

[`extern void vDSP_vsmsma(const float *__A, vDSP_Stride __IA, const float *__B, const float *__C, vDSP_Stride __IC, const float *__D, float *__E, vDSP_Stride __IE, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsmsma)

Calculates the single-precision element-wise addition of two vector-scalar products, using the specified stride.

[`extern void vDSP_vsmsmaD(const double *__A, vDSP_Stride __IA, const double *__B, const double *__C, vDSP_Stride __IC, const double *__D, double *__E, vDSP_Stride __IE, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vsmsmaD)

Calculates the double-precision element-wise addition of two vector-scalar products, using the specified stride.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)