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

# Vector-vector real arithmetic functions

Perform element-wise operations on vectors of real 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

### Binary addition operations

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

Returns the single-precision element-wise sum of two vectors.

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

Returns the double-precision element-wise sum of two vectors.

[`static func add<T, U, V>(T, U, result: inout V)`](/documentation/Accelerate/vDSP/add(_:_:result:)-3vzwi)

Calculates the single-precision element-wise sum of two vectors.

[`static func add<T, U, V>(T, U, result: inout V)`](/documentation/Accelerate/vDSP/add(_:_:result:)-338hl)

Calculates the double-precision element-wise sum of two vectors.

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

Calculates the single-precision element-wise sum of two vectors, using the specified stride.

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

Calculates the double-precision element-wise sum of two vectors, using the specified stride.

### Binary subtraction operations

[`static func subtract<T, U>(U, T) -> [Float]`](/documentation/Accelerate/vDSP/subtract(_:_:)-9xmo8)

Returns the single-precision element-wise subtraction of two vectors.

[`static func subtract<T, U>(U, T) -> [Double]`](/documentation/Accelerate/vDSP/subtract(_:_:)-8o5ai)

Returns the double-precision element-wise subtraction of two vectors.

[`static func subtract<T, U, V>(U, T, result: inout V)`](/documentation/Accelerate/vDSP/subtract(_:_:result:)-2p3fa)

Calculates the single-precision element-wise subtraction of two vectors.

[`static func subtract<T, U, V>(U, T, result: inout V)`](/documentation/Accelerate/vDSP/subtract(_:_:result:)-1ianx)

Calculates the double-precision element-wise subtraction of two vectors.

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

Calculates the single-precision element-wise subtraction of two vectors, using the specified stride.

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

Calculates the double-precision element-wise subtraction of two vectors, using the specified stride.

### Binary multiplication operations

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

Returns the single-precision element-wise product of two vectors.

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

Returns the double-precision element-wise product of two vectors.

[`static func multiply<T, U, V>(T, U, result: inout V)`](/documentation/Accelerate/vDSP/multiply(_:_:result:)-155f3)

Calculates the single-precision element-wise product of two vectors.

[`static func multiply<T, U, V>(T, U, result: inout V)`](/documentation/Accelerate/vDSP/multiply(_:_:result:)-3ptjl)

Calculates the double-precision element-wise product of two vectors.

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

Calculates the single-precision element-wise product of two vectors, using the specified stride.

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

Calculates the double-precision element-wise product of two vectors, using the specified stride.

### Binary division operations

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

Returns the single-precision element-wise division of two vectors.

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

Returns the double-precision element-wise division of two vectors.

[`static func divide<T, U, V>(T, U, result: inout V)`](/documentation/Accelerate/vDSP/divide(_:_:result:)-7ejy9)

Calculates the single-precision element-wise division of two vectors.

[`static func divide<T, U, V>(T, U, result: inout V)`](/documentation/Accelerate/vDSP/divide(_:_:result:)-6gtmm)

Calculates the double-precision element-wise division of two vectors.

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

Calculates the single-precision element-wise division of two vectors, using the specified stride.

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

Calculates the double-precision element-wise division of two vectors, using the specified stride.

### Binary addition and subtraction operations

[`static func addSubtract<S, T, U, V>(S, T, addResult: inout U, subtractResult: inout V)`](/documentation/Accelerate/vDSP/addSubtract(_:_:addResult:subtractResult:)-6qxwa)

Calculates the single-precision element-wise sum and subtraction of two vectors.

[`static func addSubtract<S, T, U, V>(S, T, addResult: inout U, subtractResult: inout V)`](/documentation/Accelerate/vDSP/addSubtract(_:_:addResult:subtractResult:)-avzd)

Calculates the double-precision element-wise sum and subtraction of two vectors.

[`void vDSP_vaddsub(const float *__I0, vDSP_Stride __I0S, const float *__I1, vDSP_Stride __I1S, float *__O0, vDSP_Stride __O0S, float *__O1, vDSP_Stride __O1S, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vaddsub)

Calculates the single-precision element-wise sum and subtraction of two vectors, using the specified stride.

[`void vDSP_vaddsubD(const double *__I0, vDSP_Stride __I0S, const double *__I1, vDSP_Stride __I1S, double *__O0, vDSP_Stride __O0S, double *__O1, vDSP_Stride __O1S, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vaddsubD)

Calculates the double-precision element-wise sum and subtraction of two vectors, using the specified stride.

### Ternary add-multiply operations

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

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

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

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

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

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

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

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

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

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

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

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

### Ternary multiply-add operations

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

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

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

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

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

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

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

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

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

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

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

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

### Ternary multiply-subtract operations

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

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

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

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

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

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

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

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

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

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

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

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

### Ternary subtract-multiply operations

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

Returns the single-precision element-wise product of a vector and the differences of two vectors.

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

Returns the double-precision element-wise product of a vector and the differences of two vectors.

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

Calculates the single-precision element-wise product of a vector and the differences of two vectors.

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

Calculates the double-precision element-wise product of a vector and the differences of two vectors.

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

Calculates the single-precision element-wise product of a vector and the differences of two vectors, using the specified stride.

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

Calculates the double-precision element-wise product of a vector and the differences of two vectors, using the specified stride.

### Quaternary multiply-multiply-add operations

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

Calculates the single-precision element-wise sum of the products of two pairs of vectors, using the specified stride.

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

Calculates the double-precision element-wise sum of the products of two pairs of vectors, using the specified stride.

### Quaternary multiply-multiply-subtract operations

[`static func subtract<R, S, T, U>(multiplication: (a: T, b: U), multiplication: (c: R, d: S)) -> [Float]`](/documentation/Accelerate/vDSP/subtract(multiplication:multiplication:)-1ghyu)

Returns the single-precision element-wise difference of the products of two pairs of vectors.

[`static func subtract<R, S, T, U>(multiplication: (a: T, b: U), multiplication: (c: R, d: S)) -> [Double]`](/documentation/Accelerate/vDSP/subtract(multiplication:multiplication:)-22a4b)

Returns the double-precision element-wise difference of the products of two pairs of vectors.

[`static func subtract<R, S, T, U, V>(multiplication: (a: T, b: U), multiplication: (c: R, d: S), result: inout V)`](/documentation/Accelerate/vDSP/subtract(multiplication:multiplication:result:)-8ofjj)

Calculates the single-precision element-wise difference of the products of two pairs of vectors.

[`static func subtract<R, S, T, U, V>(multiplication: (a: T, b: U), multiplication: (c: R, d: S), result: inout V)`](/documentation/Accelerate/vDSP/subtract(multiplication:multiplication:result:)-48y6i)

Calculates the double-precision element-wise difference of the products of two pairs of vectors.

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

Calculates the single-precision element-wise difference of the products of two pairs of vectors, using the specified stride.

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

Calculates the double-precision element-wise difference of the products of two pairs of vectors, using the specified stride.

### Quaternary add-add-multiply operations

[`static func multiply<S, T, U>(addition: (a: S, b: T), addition: (c: U, d: U)) -> [Float]`](/documentation/Accelerate/vDSP/multiply(addition:addition:)-1voy8)

Returns the single-precision element-wise product of the sums of two pairs of vectors.

[`static func multiply<S, T, U>(addition: (a: S, b: T), addition: (c: U, d: U)) -> [Double]`](/documentation/Accelerate/vDSP/multiply(addition:addition:)-7rs)

Returns the double-precision element-wise product of the sums of two pairs of vectors.

[`static func multiply<S, T, U, V>(addition: (a: S, b: T), addition: (c: U, d: U), result: inout V)`](/documentation/Accelerate/vDSP/multiply(addition:addition:result:)-7p21q)

Calculates the single-precision element-wise product of the sums of two pairs of vectors.

[`static func multiply<S, T, U, V>(addition: (a: S, b: T), addition: (c: U, d: U), result: inout V)`](/documentation/Accelerate/vDSP/multiply(addition:addition:result:)-89hgk)

Calculates the double-precision element-wise product of the sums of two pairs of vectors.

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

Calculates the single-precision element-wise product of the sums of two pairs of vectors, using the specified stride.

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

Calculates the double-precision element-wise product of the sums of two pairs of vectors, using the specified stride.

### Quaternary subtract-subtract-multiply operations

[`static func multiply<R, S, T, U>(subtraction: (a: R, b: S), subtraction: (c: T, d: U)) -> [Float]`](/documentation/Accelerate/vDSP/multiply(subtraction:subtraction:)-1rnom)

Returns the single-precision element-wise product of the differences of two pairs of vectors.

[`static func multiply<R, S, T, U>(subtraction: (a: R, b: S), subtraction: (c: T, d: U)) -> [Double]`](/documentation/Accelerate/vDSP/multiply(subtraction:subtraction:)-5pv8p)

Returns the double-precision element-wise product of the differences of two pairs of vectors.

[`static func multiply<R, S, T, U, V>(subtraction: (a: R, b: S), subtraction: (c: T, d: U), result: inout V)`](/documentation/Accelerate/vDSP/multiply(subtraction:subtraction:result:)-rubk)

Calculates the single-precision element-wise product of the differences of two pairs of vectors.

[`static func multiply<R, S, T, U, V>(subtraction: (a: R, b: S), subtraction: (c: T, d: U), result: inout V)`](/documentation/Accelerate/vDSP/multiply(subtraction:subtraction:result:)-4jjy5)

Calculates the double-precision element-wise product of the differences of two pairs of vectors.

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

Calculates the single-precision element-wise product of the differences of two pairs of vectors, using the specified stride.

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

Calculates the double-precision element-wise product of the differences of two pairs of vectors, using the specified stride.

### Quaternary add-subtract-multiply operations

[`static func multiply<R, S, T, U>(addition: (a: R, b: S), subtraction: (c: T, d: U)) -> [Float]`](/documentation/Accelerate/vDSP/multiply(addition:subtraction:)-6h89l)

Returns the single-precision element-wise product of the sum of two vectors and the difference of two vectors.

[`static func multiply<R, S, T, U>(addition: (a: R, b: S), subtraction: (c: T, d: U)) -> [Double]`](/documentation/Accelerate/vDSP/multiply(addition:subtraction:)-7qfik)

Returns the double-precision element-wise product of the sum of two vectors and the difference of two vectors.

[`static func multiply<R, S, T, U, V>(addition: (a: R, b: S), subtraction: (c: T, d: U), result: inout V)`](/documentation/Accelerate/vDSP/multiply(addition:subtraction:result:)-j688)

Calculates the double-precision element-wise product of the sum of two vectors and the difference of two vectors.

[`static func multiply<R, S, T, U, V>(addition: (a: R, b: S), subtraction: (c: T, d: U), result: inout V)`](/documentation/Accelerate/vDSP/multiply(addition:subtraction:result:)-2rldl)

Calculates the double-precision element-wise product of the sum of two vectors and the difference of two vectors.

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

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

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

Calculates the double-precision element-wise product of the sum of two vectors and the difference of two vectors, 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)