1717#include < faiss/IndexIVFPQ.h>
1818#include < faiss/impl/AuxIndexStructures.h>
1919#include < faiss/impl/FaissAssert.h>
20- #include < faiss/impl/FastScanDistancePostProcessing.h>
21- #include < faiss/impl/LookupTableScaler.h>
2220#include < faiss/impl/RaBitQUtils.h>
23- #include < faiss/impl/pq4_fast_scan.h>
24- #include < faiss/impl/simd_result_handlers.h>
21+ #include < faiss/impl/fast_scan/FastScanDistancePostProcessing.h>
22+ #include < faiss/impl/fast_scan/pq4_fast_scan.h>
23+ #include < faiss/impl/fast_scan/simd_result_handlers.h>
2524#include < faiss/invlists/BlockInvertedLists.h>
2625#include < faiss/utils/hamming.h>
2726#include < faiss/utils/quantize_lut.h>
@@ -239,7 +238,7 @@ void estimators_from_tables_generic(
239238 int64_t * heap_ids,
240239 const FastScanDistancePostProcessing& context) {
241240 using accu_t = typename C::T;
242- size_t nscale = context.norm_scaler ? context. norm_scaler -> nscale : 0 ;
241+ size_t nscale = context.pq2x4_scale ? 2 : 0 ;
243242 for (size_t j = 0 ; j < ncodes; ++j) {
244243 BitstringReader bsr (codes + j * index.code_size , index.code_size );
245244 accu_t dis = bias;
@@ -251,10 +250,10 @@ void estimators_from_tables_generic(
251250 dt += index.ksub ;
252251 }
253252
254- if (context. norm_scaler ) {
253+ if (nscale ) {
255254 for (size_t m = 0 ; m < nscale; m++) {
256255 uint64_t c = bsr.read (index.nbits );
257- dis += context. norm_scaler -> scale_one ( dt[c]) ;
256+ dis += dt[c] * context. pq2x4_scale ;
258257 dt += index.ksub ;
259258 }
260259 }
@@ -1031,7 +1030,7 @@ void IndexIVFFastScan::search_implem_10(
10311030 codes.get (),
10321031 LUT,
10331032 handler,
1034- context.norm_scaler ,
1033+ context.pq2x4_scale ,
10351034 get_block_stride ());
10361035
10371036 ndis += ls;
@@ -1183,7 +1182,7 @@ void IndexIVFFastScan::search_implem_12(
11831182 codes.get (),
11841183 LUT.get (),
11851184 handler,
1186- context.norm_scaler ,
1185+ context.pq2x4_scale ,
11871186 get_block_stride ());
11881187 // prepare for next loop
11891188 i0 = i1;
@@ -1407,7 +1406,7 @@ void IndexIVFFastScan::search_implem_14(
14071406 codes.get (),
14081407 LUT.get (),
14091408 *handler.get (),
1410- context.norm_scaler ,
1409+ context.pq2x4_scale ,
14111410 get_block_stride ());
14121411 }
14131412
0 commit comments