pub fn calculate_distances(
embeddings: &Array2<f32>,
q: &Array1<f32>,
metric: &Metric,
is_normalized: bool,
) -> Result<Array1<f32>>Expand description
Scores every row of embeddings against the query q, as L2 distances or,
for IP, inner products. Set is_normalized only if every row is
unit-length, which lets L2 skip computing the rows’ norms.
L2 distance for unit-length rows = sqrt(1 − 2·e·q + ‖q‖²).