1+ #![ allow( clippy:: type_complexity) ]
2+
13mod arroy_bench;
24mod dataset;
35mod qdrant;
@@ -17,11 +19,7 @@ use crate::qdrant::measure_qdrant_distance;
1719pub const RECALL_TESTED : [ usize ; 6 ] = [ 1 , 10 , 20 , 50 , 100 , 500 ] ;
1820pub const RNG_SEED : u64 = 38 ;
1921
20- pub fn bench_over_all_distances (
21- dimensions : usize ,
22- require_normalization : bool ,
23- vectors : & [ ( u32 , & [ f32 ] ) ] ,
24- ) {
22+ pub fn bench_over_all_distances ( dimensions : usize , vectors : & [ ( u32 , & [ f32 ] ) ] ) {
2523 println ! ( "\x1b [1m{}\x1b [0m vectors are used for this measure" , vectors. len( ) ) ;
2624 let mut recall_tested = String :: new ( ) ;
2725 RECALL_TESTED . iter ( ) . for_each ( |recall| write ! ( & mut recall_tested, "{recall:4}, " ) . unwrap ( ) ) ;
@@ -73,7 +71,7 @@ pub fn bench_over_all_distances(
7371 // bench_qdrant_distance::<DotProduct, false>(),
7472 // bench_arroy_distance::<DotProduct, 1>(),
7573 ] {
76- ( func) ( dimensions, require_normalization , vectors) ;
74+ ( func) ( dimensions, vectors) ;
7775 }
7876}
7977
@@ -122,20 +120,15 @@ fn bench_arroy_distance<
122120 D : Distance ,
123121 const OVERSAMPLING : usize ,
124122 const FILTER_SUBSET_PERCENT : usize ,
125- > ( ) -> fn ( usize , bool , & [ ( u32 , & [ f32 ] ) ] ) {
123+ > ( ) -> fn ( usize , & [ ( u32 , & [ f32 ] ) ] ) {
126124 measure_arroy_distance :: < D , D :: RealDistance , OVERSAMPLING , FILTER_SUBSET_PERCENT >
127125}
128126
129127fn bench_qdrant_distance < D : Distance , const EXACT : bool , const FILTER_SUBSET_PERCENT : usize > (
130- ) -> fn ( usize , bool , & [ ( u32 , & [ f32 ] ) ] ) {
128+ ) -> fn ( usize , & [ ( u32 , & [ f32 ] ) ] ) {
131129 measure_qdrant_distance :: < D , EXACT , FILTER_SUBSET_PERCENT >
132130}
133131
134- fn normalize_vector ( input : & [ f32 ] ) -> Vec < f32 > {
135- let norm: f32 = input. iter ( ) . map ( |& x| x * x) . sum :: < f32 > ( ) . sqrt ( ) ;
136- input. iter ( ) . map ( |& x| x / norm) . collect ( )
137- }
138-
139132fn partial_sort_by < ' a , D : arroy:: Distance > (
140133 mut vectors : impl Iterator < Item = ( ItemId , & ' a [ f32 ] ) > ,
141134 sort_by : & [ f32 ] ,
0 commit comments