Function

# vDSP_distancesq(_:_:_:_:_:_:)

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

## 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 value, the square of the Euclidean distance between the two points

`__N`

The number of elements to process in both input vectors.

## Discussion

The `vDSP_distancesq(_:_:_:_:_:_:)` and `vDSP_distancesqD(_:_:_:_:_:_:)` functions interpret the first `N` elements of `A` and `B` as defining two points in `N`-dimensional space, and write the square of the Euclidean distance between the two points to `C`:

For example, the following code defines a and b as two points in four-dimensional space:

To calculate the square of the distance between the two points, pass them to `vDSP_distancesq(_:_:_:_:_:_:)`:

On return, the output scalar contains the distance squared, `50`.

### 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_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.