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