faiss 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/ext/faiss/index.cpp +25 -6
  4. data/ext/faiss/index_binary.cpp +17 -4
  5. data/ext/faiss/kmeans.cpp +6 -6
  6. data/lib/faiss/version.rb +1 -1
  7. data/vendor/faiss/faiss/AutoTune.cpp +2 -3
  8. data/vendor/faiss/faiss/AutoTune.h +1 -1
  9. data/vendor/faiss/faiss/Clustering.cpp +2 -2
  10. data/vendor/faiss/faiss/Clustering.h +2 -2
  11. data/vendor/faiss/faiss/IVFlib.cpp +1 -2
  12. data/vendor/faiss/faiss/IVFlib.h +1 -1
  13. data/vendor/faiss/faiss/Index.h +10 -10
  14. data/vendor/faiss/faiss/Index2Layer.cpp +1 -1
  15. data/vendor/faiss/faiss/Index2Layer.h +2 -2
  16. data/vendor/faiss/faiss/IndexAdditiveQuantizerFastScan.cpp +9 -4
  17. data/vendor/faiss/faiss/IndexAdditiveQuantizerFastScan.h +5 -1
  18. data/vendor/faiss/faiss/IndexBinary.h +7 -7
  19. data/vendor/faiss/faiss/IndexBinaryFromFloat.h +1 -1
  20. data/vendor/faiss/faiss/IndexBinaryHNSW.cpp +3 -1
  21. data/vendor/faiss/faiss/IndexBinaryHNSW.h +1 -1
  22. data/vendor/faiss/faiss/IndexBinaryHash.cpp +3 -3
  23. data/vendor/faiss/faiss/IndexBinaryHash.h +5 -5
  24. data/vendor/faiss/faiss/IndexBinaryIVF.cpp +7 -6
  25. data/vendor/faiss/faiss/IndexFastScan.cpp +125 -49
  26. data/vendor/faiss/faiss/IndexFastScan.h +107 -7
  27. data/vendor/faiss/faiss/IndexFlat.h +1 -1
  28. data/vendor/faiss/faiss/IndexHNSW.cpp +3 -1
  29. data/vendor/faiss/faiss/IndexHNSW.h +1 -1
  30. data/vendor/faiss/faiss/IndexIDMap.cpp +14 -13
  31. data/vendor/faiss/faiss/IndexIDMap.h +6 -6
  32. data/vendor/faiss/faiss/IndexIVF.cpp +1 -1
  33. data/vendor/faiss/faiss/IndexIVF.h +5 -5
  34. data/vendor/faiss/faiss/IndexIVFAdditiveQuantizer.cpp +1 -1
  35. data/vendor/faiss/faiss/IndexIVFAdditiveQuantizerFastScan.cpp +9 -3
  36. data/vendor/faiss/faiss/IndexIVFAdditiveQuantizerFastScan.h +3 -1
  37. data/vendor/faiss/faiss/IndexIVFFastScan.cpp +176 -90
  38. data/vendor/faiss/faiss/IndexIVFFastScan.h +173 -18
  39. data/vendor/faiss/faiss/IndexIVFFlat.cpp +1 -0
  40. data/vendor/faiss/faiss/IndexIVFFlatPanorama.cpp +366 -0
  41. data/vendor/faiss/faiss/IndexIVFFlatPanorama.h +64 -0
  42. data/vendor/faiss/faiss/IndexIVFPQ.cpp +3 -1
  43. data/vendor/faiss/faiss/IndexIVFPQ.h +1 -1
  44. data/vendor/faiss/faiss/IndexIVFPQFastScan.cpp +134 -2
  45. data/vendor/faiss/faiss/IndexIVFPQFastScan.h +7 -1
  46. data/vendor/faiss/faiss/IndexIVFRaBitQ.cpp +13 -6
  47. data/vendor/faiss/faiss/IndexIVFRaBitQ.h +1 -0
  48. data/vendor/faiss/faiss/IndexIVFRaBitQFastScan.cpp +650 -0
  49. data/vendor/faiss/faiss/IndexIVFRaBitQFastScan.h +216 -0
  50. data/vendor/faiss/faiss/IndexIVFSpectralHash.cpp +1 -1
  51. data/vendor/faiss/faiss/IndexIVFSpectralHash.h +1 -1
  52. data/vendor/faiss/faiss/IndexNNDescent.cpp +1 -1
  53. data/vendor/faiss/faiss/IndexNSG.cpp +1 -1
  54. data/vendor/faiss/faiss/IndexNeuralNetCodec.h +1 -1
  55. data/vendor/faiss/faiss/IndexPQ.h +1 -1
  56. data/vendor/faiss/faiss/IndexPQFastScan.cpp +6 -2
  57. data/vendor/faiss/faiss/IndexPQFastScan.h +5 -1
  58. data/vendor/faiss/faiss/IndexRaBitQ.cpp +13 -10
  59. data/vendor/faiss/faiss/IndexRaBitQ.h +7 -2
  60. data/vendor/faiss/faiss/IndexRaBitQFastScan.cpp +586 -0
  61. data/vendor/faiss/faiss/IndexRaBitQFastScan.h +149 -0
  62. data/vendor/faiss/faiss/IndexShards.cpp +1 -1
  63. data/vendor/faiss/faiss/MatrixStats.cpp +3 -3
  64. data/vendor/faiss/faiss/MetricType.h +1 -1
  65. data/vendor/faiss/faiss/VectorTransform.h +2 -2
  66. data/vendor/faiss/faiss/clone_index.cpp +3 -1
  67. data/vendor/faiss/faiss/gpu/GpuCloner.cpp +1 -1
  68. data/vendor/faiss/faiss/gpu/GpuIndex.h +11 -11
  69. data/vendor/faiss/faiss/gpu/GpuIndexBinaryCagra.h +1 -1
  70. data/vendor/faiss/faiss/gpu/GpuIndexBinaryFlat.h +1 -1
  71. data/vendor/faiss/faiss/gpu/GpuIndexCagra.h +10 -6
  72. data/vendor/faiss/faiss/gpu/perf/IndexWrapper-inl.h +2 -0
  73. data/vendor/faiss/faiss/gpu/test/TestGpuIcmEncoder.cpp +7 -0
  74. data/vendor/faiss/faiss/gpu/test/TestGpuIndexIVFFlat.cpp +1 -1
  75. data/vendor/faiss/faiss/impl/AdditiveQuantizer.cpp +1 -1
  76. data/vendor/faiss/faiss/impl/AdditiveQuantizer.h +1 -1
  77. data/vendor/faiss/faiss/impl/AuxIndexStructures.cpp +2 -2
  78. data/vendor/faiss/faiss/impl/AuxIndexStructures.h +1 -1
  79. data/vendor/faiss/faiss/impl/CodePacker.h +2 -2
  80. data/vendor/faiss/faiss/impl/DistanceComputer.h +3 -3
  81. data/vendor/faiss/faiss/impl/FastScanDistancePostProcessing.h +53 -0
  82. data/vendor/faiss/faiss/impl/HNSW.cpp +1 -1
  83. data/vendor/faiss/faiss/impl/HNSW.h +4 -4
  84. data/vendor/faiss/faiss/impl/IDSelector.cpp +2 -2
  85. data/vendor/faiss/faiss/impl/IDSelector.h +1 -1
  86. data/vendor/faiss/faiss/impl/LocalSearchQuantizer.cpp +4 -4
  87. data/vendor/faiss/faiss/impl/LocalSearchQuantizer.h +1 -1
  88. data/vendor/faiss/faiss/impl/LookupTableScaler.h +1 -1
  89. data/vendor/faiss/faiss/impl/NNDescent.cpp +1 -1
  90. data/vendor/faiss/faiss/impl/NNDescent.h +2 -2
  91. data/vendor/faiss/faiss/impl/NSG.cpp +1 -1
  92. data/vendor/faiss/faiss/impl/PanoramaStats.cpp +33 -0
  93. data/vendor/faiss/faiss/impl/PanoramaStats.h +38 -0
  94. data/vendor/faiss/faiss/impl/PolysemousTraining.cpp +5 -5
  95. data/vendor/faiss/faiss/impl/ProductAdditiveQuantizer.cpp +1 -1
  96. data/vendor/faiss/faiss/impl/ProductAdditiveQuantizer.h +1 -1
  97. data/vendor/faiss/faiss/impl/ProductQuantizer-inl.h +2 -0
  98. data/vendor/faiss/faiss/impl/ProductQuantizer.h +1 -1
  99. data/vendor/faiss/faiss/impl/RaBitQUtils.cpp +246 -0
  100. data/vendor/faiss/faiss/impl/RaBitQUtils.h +153 -0
  101. data/vendor/faiss/faiss/impl/RaBitQuantizer.cpp +54 -158
  102. data/vendor/faiss/faiss/impl/RaBitQuantizer.h +2 -1
  103. data/vendor/faiss/faiss/impl/ResidualQuantizer.h +1 -1
  104. data/vendor/faiss/faiss/impl/ResultHandler.h +4 -4
  105. data/vendor/faiss/faiss/impl/ScalarQuantizer.cpp +1 -1
  106. data/vendor/faiss/faiss/impl/ScalarQuantizer.h +1 -1
  107. data/vendor/faiss/faiss/impl/ThreadedIndex-inl.h +7 -4
  108. data/vendor/faiss/faiss/impl/index_read.cpp +87 -3
  109. data/vendor/faiss/faiss/impl/index_write.cpp +73 -3
  110. data/vendor/faiss/faiss/impl/io.cpp +2 -2
  111. data/vendor/faiss/faiss/impl/io.h +4 -4
  112. data/vendor/faiss/faiss/impl/kmeans1d.cpp +1 -1
  113. data/vendor/faiss/faiss/impl/kmeans1d.h +1 -1
  114. data/vendor/faiss/faiss/impl/lattice_Zn.h +2 -2
  115. data/vendor/faiss/faiss/impl/mapped_io.cpp +2 -2
  116. data/vendor/faiss/faiss/impl/mapped_io.h +4 -3
  117. data/vendor/faiss/faiss/impl/maybe_owned_vector.h +8 -1
  118. data/vendor/faiss/faiss/impl/pq4_fast_scan.cpp +30 -4
  119. data/vendor/faiss/faiss/impl/pq4_fast_scan.h +14 -8
  120. data/vendor/faiss/faiss/impl/pq4_fast_scan_search_qbs.cpp +5 -6
  121. data/vendor/faiss/faiss/impl/simd_result_handlers.h +55 -11
  122. data/vendor/faiss/faiss/impl/zerocopy_io.h +1 -1
  123. data/vendor/faiss/faiss/index_factory.cpp +43 -1
  124. data/vendor/faiss/faiss/index_factory.h +1 -1
  125. data/vendor/faiss/faiss/index_io.h +1 -1
  126. data/vendor/faiss/faiss/invlists/InvertedLists.cpp +205 -0
  127. data/vendor/faiss/faiss/invlists/InvertedLists.h +62 -0
  128. data/vendor/faiss/faiss/utils/AlignedTable.h +1 -1
  129. data/vendor/faiss/faiss/utils/Heap.cpp +2 -2
  130. data/vendor/faiss/faiss/utils/Heap.h +3 -3
  131. data/vendor/faiss/faiss/utils/NeuralNet.cpp +1 -1
  132. data/vendor/faiss/faiss/utils/NeuralNet.h +3 -3
  133. data/vendor/faiss/faiss/utils/approx_topk/approx_topk.h +2 -2
  134. data/vendor/faiss/faiss/utils/approx_topk/avx2-inl.h +2 -2
  135. data/vendor/faiss/faiss/utils/approx_topk/mode.h +1 -1
  136. data/vendor/faiss/faiss/utils/distances.h +2 -2
  137. data/vendor/faiss/faiss/utils/extra_distances-inl.h +3 -1
  138. data/vendor/faiss/faiss/utils/hamming-inl.h +2 -0
  139. data/vendor/faiss/faiss/utils/hamming.cpp +7 -6
  140. data/vendor/faiss/faiss/utils/hamming.h +1 -1
  141. data/vendor/faiss/faiss/utils/hamming_distance/common.h +1 -2
  142. data/vendor/faiss/faiss/utils/partitioning.cpp +5 -5
  143. data/vendor/faiss/faiss/utils/partitioning.h +2 -2
  144. data/vendor/faiss/faiss/utils/rabitq_simd.h +222 -336
  145. data/vendor/faiss/faiss/utils/random.cpp +1 -1
  146. data/vendor/faiss/faiss/utils/simdlib_avx2.h +1 -1
  147. data/vendor/faiss/faiss/utils/simdlib_avx512.h +1 -1
  148. data/vendor/faiss/faiss/utils/simdlib_neon.h +2 -2
  149. data/vendor/faiss/faiss/utils/transpose/transpose-avx512-inl.h +1 -1
  150. data/vendor/faiss/faiss/utils/utils.cpp +5 -2
  151. data/vendor/faiss/faiss/utils/utils.h +2 -2
  152. metadata +12 -1
@@ -59,7 +59,7 @@ IndexIDMapTemplate<IndexT>::IndexIDMapTemplate(IndexT* index) : index(index) {
59
59
  }
60
60
 
61
61
  template <typename IndexT>
62
- void IndexIDMapTemplate<IndexT>::addEx(
62
+ void IndexIDMapTemplate<IndexT>::add_ex(
63
63
  idx_t,
64
64
  const void*,
65
65
  NumericType numeric_type) {
@@ -78,11 +78,11 @@ void IndexIDMapTemplate<IndexT>::add(
78
78
  }
79
79
 
80
80
  template <typename IndexT>
81
- void IndexIDMapTemplate<IndexT>::trainEx(
81
+ void IndexIDMapTemplate<IndexT>::train_ex(
82
82
  idx_t n,
83
83
  const void* x,
84
84
  NumericType numeric_type) {
85
- index->trainEx(n, x, numeric_type);
85
+ index->train_ex(n, x, numeric_type);
86
86
  this->is_trained = index->is_trained;
87
87
  }
88
88
 
@@ -90,7 +90,8 @@ template <typename IndexT>
90
90
  void IndexIDMapTemplate<IndexT>::train(
91
91
  idx_t n,
92
92
  const typename IndexT::component_t* x) {
93
- trainEx(n,
93
+ train_ex(
94
+ n,
94
95
  static_cast<const void*>(x),
95
96
  component_t_to_numeric<typename IndexT::component_t>());
96
97
  }
@@ -103,12 +104,12 @@ void IndexIDMapTemplate<IndexT>::reset() {
103
104
  }
104
105
 
105
106
  template <typename IndexT>
106
- void IndexIDMapTemplate<IndexT>::add_with_idsEx(
107
+ void IndexIDMapTemplate<IndexT>::add_with_ids_ex(
107
108
  idx_t n,
108
109
  const void* x,
109
110
  NumericType numeric_type,
110
111
  const idx_t* xids) {
111
- index->addEx(n, x, numeric_type);
112
+ index->add_ex(n, x, numeric_type);
112
113
  for (idx_t i = 0; i < n; i++) {
113
114
  id_map.push_back(xids[i]);
114
115
  }
@@ -120,7 +121,7 @@ void IndexIDMapTemplate<IndexT>::add_with_ids(
120
121
  idx_t n,
121
122
  const typename IndexT::component_t* x,
122
123
  const idx_t* xids) {
123
- add_with_idsEx(
124
+ add_with_ids_ex(
124
125
  n,
125
126
  static_cast<const void*>(x),
126
127
  component_t_to_numeric<typename IndexT::component_t>(),
@@ -166,7 +167,7 @@ struct ScopedSelChange {
166
167
  } // namespace
167
168
 
168
169
  template <typename IndexT>
169
- void IndexIDMapTemplate<IndexT>::searchEx(
170
+ void IndexIDMapTemplate<IndexT>::search_ex(
170
171
  idx_t n,
171
172
  const void* x,
172
173
  NumericType numeric_type,
@@ -193,7 +194,7 @@ void IndexIDMapTemplate<IndexT>::searchEx(
193
194
  sel_change.set(params_non_const, &this_idtrans);
194
195
  }
195
196
  }
196
- index->searchEx(n, x, numeric_type, k, distances, labels, params);
197
+ index->search_ex(n, x, numeric_type, k, distances, labels, params);
197
198
  idx_t* li = labels;
198
199
  #pragma omp parallel for
199
200
  for (idx_t i = 0; i < n * k; i++) {
@@ -209,7 +210,7 @@ void IndexIDMapTemplate<IndexT>::search(
209
210
  typename IndexT::distance_t* distances,
210
211
  idx_t* labels,
211
212
  const SearchParameters* params) const {
212
- searchEx(
213
+ search_ex(
213
214
  n,
214
215
  static_cast<const void*>(x),
215
216
  component_t_to_numeric<typename IndexT::component_t>(),
@@ -301,13 +302,13 @@ IndexIDMap2Template<IndexT>::IndexIDMap2Template(IndexT* index)
301
302
  : IndexIDMapTemplate<IndexT>(index) {}
302
303
 
303
304
  template <typename IndexT>
304
- void IndexIDMap2Template<IndexT>::add_with_idsEx(
305
+ void IndexIDMap2Template<IndexT>::add_with_ids_ex(
305
306
  idx_t n,
306
307
  const void* x,
307
308
  NumericType numeric_type,
308
309
  const idx_t* xids) {
309
310
  size_t prev_ntotal = this->ntotal;
310
- IndexIDMapTemplate<IndexT>::add_with_idsEx(n, x, numeric_type, xids);
311
+ IndexIDMapTemplate<IndexT>::add_with_ids_ex(n, x, numeric_type, xids);
311
312
  for (size_t i = prev_ntotal; i < this->ntotal; i++) {
312
313
  rev_map[this->id_map[i]] = i;
313
314
  }
@@ -318,7 +319,7 @@ void IndexIDMap2Template<IndexT>::add_with_ids(
318
319
  idx_t n,
319
320
  const typename IndexT::component_t* x,
320
321
  const idx_t* xids) {
321
- add_with_idsEx(
322
+ add_with_ids_ex(
322
323
  n,
323
324
  static_cast<const void*>(x),
324
325
  component_t_to_numeric<typename IndexT::component_t>(),
@@ -23,7 +23,7 @@ struct IndexIDMapTemplate : IndexT {
23
23
  using distance_t = typename IndexT::distance_t;
24
24
 
25
25
  IndexT* index = nullptr; ///! the sub-index
26
- bool own_fields = false; ///! whether pointers are deleted in destructo
26
+ bool own_fields = false; ///! whether pointers are deleted in destructor
27
27
  std::vector<idx_t> id_map;
28
28
 
29
29
  explicit IndexIDMapTemplate(IndexT* index);
@@ -31,7 +31,7 @@ struct IndexIDMapTemplate : IndexT {
31
31
  /// @param xids if non-null, ids to store for the vectors (size n)
32
32
  void add_with_ids(idx_t n, const component_t* x, const idx_t* xids)
33
33
  override;
34
- void add_with_idsEx(
34
+ void add_with_ids_ex(
35
35
  idx_t n,
36
36
  const void* x,
37
37
  NumericType numeric_type,
@@ -39,7 +39,7 @@ struct IndexIDMapTemplate : IndexT {
39
39
 
40
40
  /// this will fail. Use add_with_ids
41
41
  void add(idx_t n, const component_t* x) override;
42
- void addEx(idx_t n, const void* x, NumericType numeric_type) override;
42
+ void add_ex(idx_t n, const void* x, NumericType numeric_type) override;
43
43
 
44
44
  void search(
45
45
  idx_t n,
@@ -48,7 +48,7 @@ struct IndexIDMapTemplate : IndexT {
48
48
  distance_t* distances,
49
49
  idx_t* labels,
50
50
  const SearchParameters* params = nullptr) const override;
51
- void searchEx(
51
+ void search_ex(
52
52
  idx_t n,
53
53
  const void* x,
54
54
  NumericType numeric_type,
@@ -58,7 +58,7 @@ struct IndexIDMapTemplate : IndexT {
58
58
  const SearchParameters* params = nullptr) const override;
59
59
 
60
60
  void train(idx_t n, const component_t* x) override;
61
- void trainEx(idx_t n, const void* x, NumericType numeric_type) override;
61
+ void train_ex(idx_t n, const void* x, NumericType numeric_type) override;
62
62
 
63
63
  void reset() override;
64
64
 
@@ -104,7 +104,7 @@ struct IndexIDMap2Template : IndexIDMapTemplate<IndexT> {
104
104
 
105
105
  void add_with_ids(idx_t n, const component_t* x, const idx_t* xids)
106
106
  override;
107
- void add_with_idsEx(
107
+ void add_with_ids_ex(
108
108
  idx_t n,
109
109
  const void* x,
110
110
  NumericType numeric_type,
@@ -506,7 +506,7 @@ void IndexIVF::search_preassigned(
506
506
  };
507
507
 
508
508
  // single list scan using the current scanner (with query
509
- // set porperly) and storing results in simi and idxi
509
+ // set properly) and storing results in simi and idxi
510
510
  auto scan_one_list = [&](idx_t key,
511
511
  float coarse_dis_i,
512
512
  float* simi,
@@ -160,7 +160,7 @@ struct IndexIVFInterface : Level1Quantizer {
160
160
  * index maps to a list (aka inverted list or posting list), where the
161
161
  * id of the vector is stored.
162
162
  *
163
- * The inverted list object is required only after trainng. If none is
163
+ * The inverted list object is required only after training. If none is
164
164
  * set externally, an ArrayInvertedLists is used automatically.
165
165
  *
166
166
  * At search time, the vector to be searched is also quantized, and
@@ -171,7 +171,7 @@ struct IndexIVFInterface : Level1Quantizer {
171
171
  * lists are visited.
172
172
  *
173
173
  * Sub-classes implement a post-filtering of the index that refines
174
- * the distance estimation from the query to databse vectors.
174
+ * the distance estimation from the query to database vectors.
175
175
  */
176
176
  struct IndexIVF : Index, IndexIVFInterface {
177
177
  /// Access to the actual data
@@ -497,12 +497,12 @@ struct InvertedListScanner {
497
497
  /// compute a single query-to-code distance
498
498
  virtual float distance_to_code(const uint8_t* code) const = 0;
499
499
 
500
- /** scan a set of codes, compute distances to current query and
500
+ /** scan a set of codes, compute distances to current query, and
501
501
  * update heap of results if necessary. Default implementation
502
502
  * calls distance_to_code.
503
503
  *
504
- * @param n number of codes to scan
505
- * @param codes codes to scan (n * code_size)
504
+ * @param n number of codes to scan
505
+ * @param codes codes to scan (n * code_size)
506
506
  * @param ids corresponding ids (ignored if store_pairs)
507
507
  * @param distances heap distances (size k)
508
508
  * @param labels heap labels (size k)
@@ -198,7 +198,7 @@ struct AQInvertedListScanner : InvertedListScanner {
198
198
  }
199
199
  }
200
200
 
201
- ~AQInvertedListScanner() = default;
201
+ ~AQInvertedListScanner() override = default;
202
202
  };
203
203
 
204
204
  template <bool is_IP>
@@ -14,6 +14,7 @@
14
14
 
15
15
  #include <faiss/impl/AuxIndexStructures.h>
16
16
  #include <faiss/impl/FaissAssert.h>
17
+ #include <faiss/impl/FastScanDistancePostProcessing.h>
17
18
  #include <faiss/impl/LookupTableScaler.h>
18
19
  #include <faiss/impl/pq4_fast_scan.h>
19
20
  #include <faiss/invlists/BlockInvertedLists.h>
@@ -212,7 +213,9 @@ void IndexIVFAdditiveQuantizerFastScan::estimate_norm_scale(
212
213
  size_t index_nprobe = nprobe;
213
214
  nprobe = 1;
214
215
  CoarseQuantized cq{index_nprobe, coarse_dis.data(), coarse_ids.data()};
215
- compute_LUT(n, x, cq, dis_tables, biases);
216
+ FastScanDistancePostProcessing empty_context{};
217
+
218
+ compute_LUT(n, x, cq, dis_tables, biases, empty_context);
216
219
  nprobe = index_nprobe;
217
220
 
218
221
  float scale = 0;
@@ -314,8 +317,10 @@ void IndexIVFAdditiveQuantizerFastScan::search(
314
317
  }
315
318
 
316
319
  NormTableScaler scaler(norm_scale);
320
+ FastScanDistancePostProcessing context;
321
+ context.norm_scaler = &scaler;
317
322
  IndexIVFFastScan::CoarseQuantized cq{nprobe};
318
- search_dispatch_implem(n, x, k, distances, labels, cq, &scaler);
323
+ search_dispatch_implem(n, x, k, distances, labels, cq, context);
319
324
  }
320
325
 
321
326
  /*********************************************************
@@ -383,7 +388,8 @@ void IndexIVFAdditiveQuantizerFastScan::compute_LUT(
383
388
  const float* x,
384
389
  const CoarseQuantized& cq,
385
390
  AlignedTable<float>& dis_tables,
386
- AlignedTable<float>& biases) const {
391
+ AlignedTable<float>& biases,
392
+ const FastScanDistancePostProcessing&) const {
387
393
  const size_t dim12 = ksub * M;
388
394
  const size_t ip_dim12 = aq->M * ksub;
389
395
  const size_t nprobe = cq.nprobe;
@@ -12,6 +12,7 @@
12
12
  #include <faiss/IndexIVFAdditiveQuantizer.h>
13
13
  #include <faiss/IndexIVFFastScan.h>
14
14
  #include <faiss/impl/AdditiveQuantizer.h>
15
+ #include <faiss/impl/FastScanDistancePostProcessing.h>
15
16
  #include <faiss/impl/ProductAdditiveQuantizer.h>
16
17
  #include <faiss/utils/AlignedTable.h>
17
18
 
@@ -101,7 +102,8 @@ struct IndexIVFAdditiveQuantizerFastScan : IndexIVFFastScan {
101
102
  const float* x,
102
103
  const CoarseQuantized& cq,
103
104
  AlignedTable<float>& dis_tables,
104
- AlignedTable<float>& biases) const override;
105
+ AlignedTable<float>& biases,
106
+ const FastScanDistancePostProcessing& context) const override;
105
107
  };
106
108
 
107
109
  struct IndexIVFLocalSearchQuantizerFastScan