Skip to main content

diskann_quantization/multi_vector/distance/
projected_eigen.rs

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license.
3
4//! Projected-eigen distance type for multi-vector representations.
5
6/////////////////////
7// ProjectedEigen //
8/////////////////////
9
10/// Projected-eigen distance for multi-vector similarity.
11///
12/// Computes the negated sum of squared inner products over *all*
13/// query/document vector pairs:
14///
15/// ```text
16/// ProjectedEigen(Q, D) = \sum_{i} \sum_{j} -IP(q_i, d_j)²
17/// ```
18///
19/// Unlike [`Chamfer`](super::Chamfer), which keeps only the best-matching
20/// document vector per query vector, this accumulates a contribution from
21/// every pair, so the score reflects the full query–document interaction. As
22/// with the other multi-vector distances, lower is better.
23///
24/// Implements [`PureDistanceFunction`](diskann_vector::PureDistanceFunction)
25/// for matrix view types.
26#[derive(Debug, Clone, Copy)]
27pub struct ProjectedEigen;