Function

# vDSP_vdist(_:_:_:_:_:_:_:)

Calculates the distance between corresponding elements of two single-precision vectors.

## Parameters

`__A`

Single-precision real input vector.

`__IA`

Stride for `A`.

`__B`

Single-precision real input vector.

`__IB`

Stride for `B`.

`__C`

Single-precision real output vector.

`__IC`

Stride for `C`.

`__N`

The number of elements to process.

## Discussion

The `vDSP_vdist(_:_:_:_:_:_:_:)` and `vDSP_vdistD(_:_:_:_:_:_:_:)` functions calculate the square roots of the sum of the squares of corresponding elements of vectors `A` and `B`, using the following operation:

For example, the following code calculates the hypotenuse of four Pythagorean triples:

On return, `c` contains `[5.0, 10.0, 13.0, 15.0]`.

### Vector-to-Vector Distance Computation

`static func distanceSquared<U, V>(U, V) -> Double`

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

`static func distanceSquared<U, V>(U, V) -> Float`

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

`func vDSP_distancesq(UnsafePointer<Float>, vDSP_Stride, UnsafePointer<Float>, vDSP_Stride, UnsafeMutablePointer<Float>, vDSP_Length)`

Calculates the distance squared between two single-precision points in n-dimensional space, using the specified strides.

`func vDSP_distancesqD(UnsafePointer<Double>, vDSP_Stride, UnsafePointer<Double>, vDSP_Stride, UnsafeMutablePointer<Double>, vDSP_Length)`

Calculates the distance squared between two double-precision points in n-dimensional space, using the specified strides.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.