Skip to main content

inner_product

Function inner_product 

Source
pub fn inner_product<const N: usize, L, R>(
    left: impl IntoExpr<L>,
    right: impl IntoExpr<R>,
) -> Expr<f32>
where L: VectorExpr<N>, R: VectorExpr<N>,
Expand description

True inner product as a function expression (INNER_PRODUCT(a, b)).

Higher is more similar (for normalized embeddings, identical vectors are 1.0).

ANN warning:

  • This is intentionally a function call to preserve true inner-product semantics, but function expressions are generally not pgvector ANN index-compatible for ORDER BY ... LIMIT.
  • For ANN-indexed retrieval, use inner_product_distance with ORDER BY ASC.