VECTOR_L1_DISTANCE

functionsupportedAI & ML

docs.snowflake.com ↗

Vector functions

Computes the L1 distance between two vectors. L1 distance, also known as the Taxicab or Manhattan distance, is a measure of the distance between two points in a vector space. The distance is calculated by taking the sum of the absolute value of the differences of vector elements. The result is a value of zero or higher. If the distance is zero, the vectors are identical. The larger the distance, the farther apart the vectors are.

Syntax

VECTOR_L1_DISTANCE( <vector>, <vector> )

Parameters

NameRequiredDescription
vectorrequiredThe VECTOR value to calculate the distance from.
vectorrequiredThe VECTOR value to calculate the distance to.

Returns

Returns the L1 distance between the two input vectors as a FLOAT value.

Usage notes

See also

Referenced by