From e7c690f13b2575eac0ad0546eae6a2f00655a799 Mon Sep 17 00:00:00 2001 From: jean-pierreBoth Date: Mon, 20 Jan 2025 10:15:10 +0100 Subject: [PATCH] better control of scale modification --- src/hnsw.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hnsw.rs b/src/hnsw.rs index cc8277b..bc7b8f1 100644 --- a/src/hnsw.rs +++ b/src/hnsw.rs @@ -876,9 +876,9 @@ impl<'b, T: Clone + Send + Sync, D: Distance + Send + Sync> Hnsw<'b, T, D> { println!("\n Current scale value : {:.2e}, Scale modification factor asked : {:.2e},(modification factor must be between {:.2e} and 1.)", self.layer_indexed_points.layer_g.scale, scale_modification, min_factor); // - if scale_modification >= 1. { + if scale_modification > 1. { println!( - "\n Scale modification arg {:.2e} not valid , factor must be less than 1.)", + "\n Scale modification not applied, modification arg {:.2e} not valid , factor must be less than 1.)", scale_modification ); } else if scale_modification < min_factor { @@ -890,7 +890,7 @@ impl<'b, T: Clone + Send + Sync, D: Distance + Send + Sync> Hnsw<'b, T, D> { // self.layer_indexed_points .layer_g - .set_scale_modification(scale_modification.max(min_factor)); + .set_scale_modification(scale_modification.max(min_factor).min(1.)); } // end of set_scale_modification // here we could pass a point_id_with_order instead of entry_point_id: PointId