Skip to main content

L1Distance

Introduced in: v21.11.0 Calculates the distance between two points (the elements of the vectors are the coordinates) in L1 space (1-norm (taxicab geometry distance)). Syntax
Aliases: distanceL1 Arguments Returned value Returns the 1-norm distance. For Array inputs, returns Float32 if the least common supertype of the element types is Float32 or BFloat16, otherwise Float64. For Tuple inputs, the return type follows the arithmetic result type of the element-wise operations (integer types are preserved). (U)Int* or Float* Examples Basic usage
Query
Response

L1Norm

Introduced in: v21.11.0 Calculates the sum of absolute elements of a vector. Syntax
Aliases: normL1 Arguments Returned value Returns the L1-norm or taxicab geometry distance. UInt* or Float* or Decimal Examples Basic usage
Query
Response

L1Normalize

Introduced in: v21.11.0 Calculates the unit vector of a given vector (the elements of the tuple are the coordinates) in L1 space (taxicab geometry). Syntax
Aliases: normalizeL1 Arguments
  • tuple — A tuple of numeric values. Tuple(T)
Returned value Returns the unit vector. Tuple(Float64) Examples Basic usage
Query
Response

L2Distance

Introduced in: v21.11.0 Calculates the distance between two points (the elements of the vectors are the coordinates) in Euclidean space (Euclidean distance). Syntax
Aliases: distanceL2 Arguments Returned value Returns the 2-norm distance. For Array inputs, returns Float32 if the least common supertype of the element types is Float32 or BFloat16, otherwise Float64. For Tuple inputs, always returns Float64. Float* Examples Basic usage
Query
Response

L2DistanceTransposed

Introduced in: v25.10.0 Calculates the approximate distance between two points (the values of the vectors are the coordinates) in Euclidean space (Euclidean distance). Syntax
Aliases: distanceL2Transposed Arguments
  • vectors — Vectors. QBit(T, UInt64)
  • reference — Reference vector. Array(T)
  • p — Number of bits from each vector element to use in the distance calculation (1 to element bit-width). The quantization level controls the precision-speed trade-off. Using fewer bits results in faster I/O and calculations with reduced accuracy, while using more bits increases accuracy at the cost of performance. UInt
Returned value Returns the approximate 2-norm distance. Always returns Float64. Float64 Examples Basic usage
Query
Response

L2Norm

Introduced in: v21.11.0 Calculates the square root of the sum of the squares of the vector elements. Syntax
Aliases: normL2 Arguments Returned value Returns the L2-norm or Euclidean distance. UInt* or Float* Examples Basic usage
Query
Response

L2Normalize

Introduced in: v21.11.0 Calculates the unit vector of a given vector (the elements of the tuple are the coordinates) in Euclidean space (using Euclidean distance). Syntax
Aliases: normalizeL2 Arguments
  • tuple — A tuple of numeric values. Tuple(T)
Returned value Returns the unit vector. Tuple(Float64) Examples Basic usage
Query
Response

L2SquaredDistance

Introduced in: v22.7.0 Calculates the sum of the squares of the difference between the corresponding elements of two vectors. Syntax
Aliases: distanceL2Squared Arguments Returned value Returns the sum of the squares of the differences between the corresponding elements of two vectors. For Array inputs, returns Float32 if the least common supertype of the element types is Float32 or BFloat16, otherwise Float64. For Tuple inputs, the return type follows the arithmetic result type of the element-wise operations (integer types are preserved). (U)Int* or Float* Examples Basic usage
Query
Response

L2SquaredNorm

Introduced in: v22.7.0 Calculates the square root of the sum of the squares of the vector elements (the L2Norm) squared. Syntax
Aliases: normL2Squared Arguments Returned value Returns the L2-norm squared. UInt* or Float* or Decimal Examples Basic usage
Query
Response

LinfDistance

Introduced in: v21.11.0 Calculates the distance between two points (the elements of the vectors are the coordinates) in L_{inf} space (maximum norm). Syntax
Aliases: distanceLinf Arguments Returned value Returns the infinity-norm distance. For Array inputs, returns Float32 if the least common supertype of the element types is Float32 or BFloat16, otherwise Float64. For Tuple inputs, always returns Float64. Float* Examples Basic usage
Query
Response

LinfNorm

Introduced in: v21.11.0 Calculates the maximum of absolute elements of a vector. Syntax
Aliases: normLinf Arguments Returned value Returns the Linf-norm or the maximum absolute value. Float64 Examples Basic usage
Query
Response

LinfNormalize

Introduced in: v21.11.0 Calculates the unit vector of a given vector (the elements of the tuple are the coordinates) in L_{inf} space (using maximum norm). Syntax
Aliases: normalizeLinf Arguments
  • tuple — A tuple of numeric values. Tuple(T)
Returned value Returns the unit vector. Tuple(Float64) Examples Basic usage
Query
Response

LpDistance

Introduced in: v21.11.0 Calculates the distance between two points (the elements of the vectors are the coordinates) in Lp space (p-norm distance). Syntax
Aliases: distanceLp Arguments Returned value Returns the p-norm distance. For Array inputs, returns Float32 if the least common supertype of the element types is Float32 or BFloat16, otherwise Float64. For Tuple inputs, always returns Float64. Float* Examples Basic usage
Query
Response

LpNorm

Introduced in: v21.11.0 Calculates the p-norm of a vector, which is the p-th root of the sum of the p-th powers of the absolute elements of its elements. Special cases:
  • When p=1, it’s equivalent to L1Norm (Manhattan distance).
  • When p=2, it’s equivalent to L2Norm (Euclidean distance).
  • When p=∞, it’s equivalent to LinfNorm (maximum norm).
Syntax
Aliases: normLp Arguments
  • vector — Vector or tuple of numeric values. Tuple(T) or Array(T)
  • p — The power. Possible values are real numbers in the range [1; inf). UInt* or Float*
Returned value Returns the Lp-norm. Float64 Examples Basic usage
Query
Response

LpNormalize

Introduced in: v21.11.0 Calculates the unit vector of a given vector (the elements of the tuple are the coordinates) in Lp space (using p-norm). Syntax
Aliases: normalizeLp Arguments
  • tuple — A tuple of numeric values. Tuple(T)
  • p — The power. Possible values are any number in the range range from [1; inf). UInt* or Float*
Returned value Returns the unit vector. Tuple(Float64) Examples Usage example
Query
Response

cosineDistance

Introduced in: v21.11.0 Calculates the cosine distance between two vectors (the elements of the tuples are the coordinates). The smaller the returned value is, the more similar are the vectors. Syntax
Aliases: distanceCosine Arguments Returned value Returns the cosine distance (one minus the cosine similarity). For Array inputs, returns Float32 if the least common supertype of the element types is Float32 or BFloat16, otherwise Float64. For Tuple inputs, always returns Float64. Float* Examples Basic usage
Query
Response

cosineDistanceTransposed

Introduced in: v26.1.0 Calculates the approximate cosine distance between two points (the values of the vectors are the coordinates). The smaller the returned value is, the more similar are the vectors. Syntax
Aliases: distanceCosineTransposed Arguments
  • vectors — Vectors. QBit(T, UInt64)
  • reference — Reference vector. Array(T)
  • p — Number of bits from each vector element to use in the distance calculation (1 to element bit-width). The quantization level controls the precision-speed trade-off. Using fewer bits results in faster I/O and calculations with reduced accuracy, while using more bits increases accuracy at the cost of performance. UInt
Returned value Returns the approximate cosine distance (one minus the cosine similarity). Always returns Float64. Float64 Examples Basic usage
Query
Response
Last modified on June 19, 2026