<!--
{
  "documentType" : "article",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vectorops",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "vectorOps"
}
-->

# vectorOps

Perform vector and matrix BLAS functions on arrays of 128-bit vectors.

## Discussion

vectorOps.h declares a set of vector and matrix BLAS functions on arrays of 128-bit vectors containing single-precision floating-point values. The arrays can be of any desired length, but the number of `float` elements must be a multiple of 4.

## Topics

### Vector-Scalar Linear Algebra Functions (from vectorOps.h)

[`func vIsamax(Int32, UnsafePointer<vFloat>) -> Int32`](/documentation/Accelerate/vIsamax(_:_:))

Finds the position of the first vector element having the largest absolute value.

[`func vIsamin(Int32, UnsafePointer<vFloat>) -> Int32`](/documentation/Accelerate/vIsamin(_:_:))

Finds the position of the first vector element having the smallest absolute value.

[`func vIsmax(Int32, UnsafePointer<vFloat>) -> Int32`](/documentation/Accelerate/vIsmax(_:_:))

Finds the position of the first vector element having the maximum value.

[`func vIsmin(Int32, UnsafePointer<vFloat>) -> Int32`](/documentation/Accelerate/vIsmin(_:_:))

Finds the position of the first vector element having the minimum value.

[`func vSasum(Int32, UnsafePointer<vFloat>) -> Float`](/documentation/Accelerate/vSasum(_:_:))

Finds the sum of the absolute values of the elements in a vector.

[`func vSsum(Int32, UnsafePointer<vFloat>) -> Float`](/documentation/Accelerate/vSsum(_:_:))

Finds the sum of the values of the elements in a vector.

[`func vSaxpy(Int32, Float, UnsafePointer<vFloat>, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSaxpy(_:_:_:_:))

Multiplies a vector by a scalar , adds it to a second vector , and stores the result in the second vector.

[`func vSnaxpy(Int32, Int32, UnsafePointer<vFloat>, UnsafePointer<vFloat>, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSnaxpy(_:_:_:_:_:))

Performs the computation of `vSaxpy` `n` times, using a different multiplier each time.

[`func vScopy(Int32, UnsafePointer<vFloat>, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vScopy(_:_:_:))

Copies one vector to another.

[`func vSdot(Int32, UnsafePointer<vFloat>, UnsafePointer<vFloat>) -> Float`](/documentation/Accelerate/vSdot(_:_:_:))

Computes the dot product of two vectors.

[`func vSndot(Int32, Int32, UnsafeMutablePointer<Float>, Int32, UnsafePointer<vFloat>, UnsafePointer<vFloat>)`](/documentation/Accelerate/vSndot(_:_:_:_:_:_:))

Computes the dot products of n pairs of vectors, accumulating or storing the results in an array of `n` `float` values.

[`func vSnrm2(Int32, UnsafePointer<vFloat>) -> Float`](/documentation/Accelerate/vSnrm2(_:_:))

Finds the Euclidean length of a vector.

[`func vSnorm2(Int32, UnsafePointer<vFloat>) -> Float`](/documentation/Accelerate/vSnorm2(_:_:))

Finds the Euclidean length of a vector.

[`func vSrot(Int32, UnsafeMutablePointer<vFloat>, UnsafeMutablePointer<vFloat>, Float, Float)`](/documentation/Accelerate/vSrot(_:_:_:_:_:))

Applies planar rotation to a set of n points whose x and y coordinates are contained in two arrays of vectors.

[`func vSscal(Int32, Float, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSscal(_:_:_:))

Scales a vector in place.

[`func vSswap(Int32, UnsafeMutablePointer<vFloat>, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSswap(_:_:_:))

Interchanges the elements of two vectors.

[`func vSyax(Int32, Float, UnsafePointer<vFloat>, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSyax(_:_:_:_:))

Multiplies each element of a vector and stores the results in a second vector.

[`func vSzaxpy(Int32, Float, UnsafePointer<vFloat>, UnsafePointer<vFloat>, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSzaxpy(_:_:_:_:_:))

Multiplies a vector by a scalar, adds it to a second vector, and stores the result in a third vector.

### Matrix-Vector Linear Algebra Functions (from vectorOps.h)

[`func vSgemv(CChar, Int32, Int32, Float, UnsafePointer<vFloat>, UnsafePointer<vFloat>, Float, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSgemv(_:_:_:_:_:_:_:_:))

Multiplies a vector by a scalar. Multiplies a matrix by another scalar, then by a second vector, and adds the resulting vector to the first vector. This function can also perform the calculation with the transpose of the original matrix instead of the matrix itself. A selector parameter determines whether the transpose is used.

[`func vSgemx(Int32, Int32, Float, UnsafePointer<vFloat>, UnsafePointer<vFloat>, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSgemx(_:_:_:_:_:_:))

Multiplies a matrix by a scalar and then by a vector, and adds the resulting vector to a second vector.

[`func vSgemtx(Int32, Int32, Float, UnsafePointer<vFloat>, UnsafePointer<vFloat>, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSgemtx(_:_:_:_:_:_:))

Forms the transpose of a matrix, multiplies it by a scalar and then by a vector, and adds the resulting vector to a second vector.

### Matrix Operations (from vectorOps.h)

[`func vSgeadd(Int32, Int32, UnsafePointer<vFloat>, CChar, UnsafePointer<vFloat>, CChar, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSgeadd(_:_:_:_:_:_:_:))

Adds two general matrices or their transposes.

[`func vSgesub(Int32, Int32, UnsafePointer<vFloat>, CChar, UnsafePointer<vFloat>, CChar, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSgesub(_:_:_:_:_:_:_:))

Subtracts two general matrices or their transposes.

[`func vSgemul(Int32, Int32, Int32, UnsafePointer<vFloat>, CChar, UnsafePointer<vFloat>, CChar, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSgemul(_:_:_:_:_:_:_:_:))

Multiplies two general matrices or their transposes.

[`func vSgemm(Int32, Int32, Int32, UnsafePointer<vFloat>, CChar, UnsafePointer<vFloat>, CChar, UnsafeMutablePointer<vFloat>, Float, Float, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSgemm(_:_:_:_:_:_:_:_:_:_:_:))

Multiples two general matrices or their transposes, then scales and adds a third.

[`func vSgetmi(Int32, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSgetmi(_:_:))

Transposes a matrix in place.

[`func vSgetmo(Int32, Int32, UnsafePointer<vFloat>, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSgetmo(_:_:_:_:))

Transposes a matrix out of place.

[`func vSgevv(Int32, Int32, UnsafePointer<vFloat>, UnsafePointer<vFloat>, UnsafeMutablePointer<vFloat>)`](/documentation/Accelerate/vSgevv(_:_:_:_:_:))

Produces the outer product of two vectors and places the results into a matrix.



---

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)