<!--
{
  "documentType" : "article",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vector-distance-and-pythagorean-computation",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Vector distance and Pythagorean computation"
}
-->

# Vector distance and Pythagorean computation

Calculate distance and hypotenuse of vectors.

## Topics

### Vector hypotenuse computation

[`static func hypot<U, V>(U, V) -> [Float]`](/documentation/Accelerate/vDSP/hypot(_:_:)-5grex)

Returns the single-precision hypotenuses of right triangles with legs that are the lengths of corresponding elements of the two input vectors.

[`static func hypot<U, V>(U, V) -> [Double]`](/documentation/Accelerate/vDSP/hypot(_:_:)-7ku7m)

Returns the double-precision hypotenuses of right triangles with legs that are the lengths of corresponding elements of the two input vectors.

[`static func hypot<T, U, V>(T, U, result: inout V)`](/documentation/Accelerate/vDSP/hypot(_:_:result:)-5d8pw)

Calculates the single-precision hypotenuses of right triangles with legs that are the lengths of corresponding elements of the two input vectors.

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

Calculates the double-precision hypotenuses of right triangles with legs that are the lengths of corresponding elements of the two input vectors.

[`static func hypot<R, S, T, U>(x0: R, x1: S, y0: T, y1: U) -> [Float]`](/documentation/Accelerate/vDSP/hypot(x0:x1:y0:y1:)-15wy5)

Returns the single-precision hypotenuses of right triangles with legs that are the differences of corresponding elements of two pairs of vectors.

[`static func hypot<R, S, T, U>(x0: R, x1: S, y0: T, y1: U) -> [Double]`](/documentation/Accelerate/vDSP/hypot(x0:x1:y0:y1:)-12d4r)

Returns the double-precision hypotenuses of right triangles with legs that are the differences of corresponding elements of two pairs of vectors.

[`static func hypot<R, S, T, U, V>(x0: R, x1: S, y0: T, y1: U, result: inout V)`](/documentation/Accelerate/vDSP/hypot(x0:x1:y0:y1:result:)-7ksm)

Calculates the single-precision hypotenuses of right triangles with legs that are the differences of corresponding elements of two pairs of vectors.

[`static func hypot<R, S, T, U, V>(x0: R, x1: S, y0: T, y1: U, result: inout V)`](/documentation/Accelerate/vDSP/hypot(x0:x1:y0:y1:result:)-4pizr)

Calculates the double-precision hypotenuses of right triangles with legs that are the differences of corresponding elements of two pairs of vectors.

### Vector Pythagorean computation

[`extern void vDSP_vpythg(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_vpythg)

Calculates the single-precision hypotenuses of right triangles with legs that are the differences of corresponding elements of two pairs of vectors.

[`extern void vDSP_vpythgD(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_vpythgD)

Calculates the double-precision hypotenuses of right triangles with legs that are the differences of corresponding elements of two pairs of vectors.

### Vector distance computation

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

Calculates the single-precision hypotenuses of right triangles with legs that are the lengths of corresponding elements of two pairs of vectors.

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

Calculates the double-precision hypotenuses of right triangles with legs that are the lengths of corresponding elements of two pairs of vectors.

[`static func distanceSquared<U, V>(U, V) -> Float`](/documentation/Accelerate/vDSP/distanceSquared(_:_:)-2dvb6)

Returns the single-precision distance squared between two points in n-dimensional space.

[`static func distanceSquared<U, V>(U, V) -> Double`](/documentation/Accelerate/vDSP/distanceSquared(_:_:)-3oub3)

Returns the double-precision distance squared between two points in n-dimensional space.

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

Calculates the single-precision distance squared between two points in n-dimensional space.

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

Calculates the double-precision distance squared between two points in n-dimensional space.



---

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)