Remove the useless euclidean distance implementation

This commit is contained in:
Clément Renault 2023-06-27 12:29:40 +02:00
parent 29d8268c94
commit ebad1f396f
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
2 changed files with 5 additions and 24 deletions

View file

@ -32,7 +32,7 @@ use std::convert::{TryFrom, TryInto};
use std::hash::BuildHasherDefault;
use charabia::normalizer::{CharNormalizer, CompatibilityDecompositionNormalizer};
pub use distance::{dot_product_similarity, euclidean_squared_distance};
pub use distance::dot_product_similarity;
pub use filter_parser::{Condition, FilterCondition, Span, Token};
use fxhash::{FxHasher32, FxHasher64};
pub use grenad::CompressionType;
@ -304,7 +304,7 @@ impl VectorOrArrayOfVectors {
}
}
/// Normalize a vector by dividing the dimensions by the lenght of it.
/// Normalize a vector by dividing the dimensions by the length of it.
pub fn normalize_vector(mut vector: Vec<f32>) -> Vec<f32> {
let squared: f32 = vector.iter().map(|x| x * x).sum();
let length = squared.sqrt();