Vector functions
VECTOR_EUCLIDEAN_DISTANCE
Reference material for VECTOR_EUCLIDEAN_DISTANCE function
VECTOR_EUCLIDEAN_DISTANCE
Returns the Euclidean distance, or L2 distance, between two vectors. The Euclidean distance measures the shortest distance between two points in space along a straight line. It is calculated by summing the squared distances of a pair of vector elements, and then taking the square root.
Syntax
Parameters
Parameter | Description | Supported input types |
---|---|---|
<array> | The first array used in the distance calculation. | Any array of numeric data types. |
<array> | The second array used in the distance calculation. | Any array of numeric data types. |
Notes
Both input array
arguments must have the same number of elements.
Return Type
DOUBLE
Examples
Example
The following code returns the Euclidean distance between two vectors:
Returns
distance (DOUBLE PRECISION) |
---|
2.8284271247461903 |