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

# Vector squaring functions

Compute the square, signed square, or squared magnitude of the elements in a vector.

## Topics

### Single-Vector Squaring

The functions in this group compute the square of each element in a vector or the square of the magnitude of each element in a complex vector.

[`static func square<U>(U) -> [Double]`](/documentation/Accelerate/vDSP/square(_:)-1dz7)

Returns a double-precision array containing the square of each element in the supplied vector.

[`static func square<U>(U) -> [Float]`](/documentation/Accelerate/vDSP/square(_:)-30jok)

Returns a single-precision array containing the square of each element in the supplied vector.

[`static func square<U, V>(U, result: inout V)`](/documentation/Accelerate/vDSP/square(_:result:)-9e5hu)

Calculates the square of each element in the supplied double-precision vector.

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

Calculates the square of each element in the supplied single-precision vector.

[`static func signedSquare<U>(U) -> [Double]`](/documentation/Accelerate/vDSP/signedSquare(_:)-8y09t)

Returns a double-precision array containing the signed square of each element in the supplied vector.

[`static func signedSquare<U>(U) -> [Float]`](/documentation/Accelerate/vDSP/signedSquare(_:)-9v7ec)

Returns a single-precision array containing the signed square of each element in the supplied vector.

[`static func signedSquare<U, V>(U, result: inout V)`](/documentation/Accelerate/vDSP/signedSquare(_:result:)-56omf)

Calculates the signed square of each element in the supplied double-precision vector.

[`static func signedSquare<U, V>(U, result: inout V)`](/documentation/Accelerate/vDSP/signedSquare(_:result:)-2771f)

Calculates the signed square of each element in the supplied single-precision vector.

[`static func squareMagnitudes<V>(DSPSplitComplex, result: inout V)`](/documentation/Accelerate/vDSP/squareMagnitudes(_:result:)-22k5h)

Calculates the square magnitude of each element in the supplied single-precision complex vector.

[`static func squareMagnitudes<V>(DSPDoubleSplitComplex, result: inout V)`](/documentation/Accelerate/vDSP/squareMagnitudes(_:result:)-14oiw)

Calculates the square magnitude of each element in the supplied double-precision complex vector.

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

Computes the squared value of each element in the supplied single-precision vector.

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

Computes the squared value of each element in the supplied double-precision vector.

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

Computes the signed squared value of each element in the supplied single-precision vector.

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

Computes the signed squared value of each element in the supplied double-precision vector.

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

Computes the squared magnitude value of each element in the supplied complex single-precision vector.

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

Computes the squared magnitude value of each element in the supplied complex double-precision vector.

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

Complex vector magnitudes square and add; single precision.

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

Complex vector magnitudes square and add; double precision.



---

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)