faiss 0.3.2 → 0.3.4

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 (295) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/LICENSE.txt +1 -1
  4. data/ext/faiss/extconf.rb +1 -1
  5. data/ext/faiss/index.cpp +10 -14
  6. data/ext/faiss/numo.hpp +957 -833
  7. data/lib/faiss/version.rb +1 -1
  8. data/vendor/faiss/faiss/AutoTune.cpp +2 -2
  9. data/vendor/faiss/faiss/AutoTune.h +2 -2
  10. data/vendor/faiss/faiss/Clustering.cpp +2 -2
  11. data/vendor/faiss/faiss/Clustering.h +2 -2
  12. data/vendor/faiss/faiss/IVFlib.cpp +2 -2
  13. data/vendor/faiss/faiss/IVFlib.h +2 -2
  14. data/vendor/faiss/faiss/Index.cpp +6 -2
  15. data/vendor/faiss/faiss/Index.h +10 -3
  16. data/vendor/faiss/faiss/Index2Layer.cpp +2 -2
  17. data/vendor/faiss/faiss/Index2Layer.h +2 -2
  18. data/vendor/faiss/faiss/IndexAdditiveQuantizer.cpp +7 -7
  19. data/vendor/faiss/faiss/IndexAdditiveQuantizer.h +2 -2
  20. data/vendor/faiss/faiss/IndexAdditiveQuantizerFastScan.cpp +14 -16
  21. data/vendor/faiss/faiss/IndexAdditiveQuantizerFastScan.h +2 -2
  22. data/vendor/faiss/faiss/IndexBinary.cpp +13 -2
  23. data/vendor/faiss/faiss/IndexBinary.h +8 -2
  24. data/vendor/faiss/faiss/IndexBinaryFlat.cpp +2 -3
  25. data/vendor/faiss/faiss/IndexBinaryFlat.h +2 -2
  26. data/vendor/faiss/faiss/IndexBinaryFromFloat.cpp +2 -2
  27. data/vendor/faiss/faiss/IndexBinaryFromFloat.h +2 -2
  28. data/vendor/faiss/faiss/IndexBinaryHNSW.cpp +2 -7
  29. data/vendor/faiss/faiss/IndexBinaryHNSW.h +2 -2
  30. data/vendor/faiss/faiss/IndexBinaryHash.cpp +2 -3
  31. data/vendor/faiss/faiss/IndexBinaryHash.h +2 -2
  32. data/vendor/faiss/faiss/IndexBinaryIVF.cpp +2 -2
  33. data/vendor/faiss/faiss/IndexBinaryIVF.h +2 -2
  34. data/vendor/faiss/faiss/IndexFastScan.cpp +10 -14
  35. data/vendor/faiss/faiss/IndexFastScan.h +11 -2
  36. data/vendor/faiss/faiss/IndexFlat.cpp +2 -3
  37. data/vendor/faiss/faiss/IndexFlat.h +2 -2
  38. data/vendor/faiss/faiss/IndexFlatCodes.cpp +11 -2
  39. data/vendor/faiss/faiss/IndexFlatCodes.h +5 -2
  40. data/vendor/faiss/faiss/IndexHNSW.cpp +13 -6
  41. data/vendor/faiss/faiss/IndexHNSW.h +2 -2
  42. data/vendor/faiss/faiss/IndexIDMap.cpp +19 -3
  43. data/vendor/faiss/faiss/IndexIDMap.h +5 -2
  44. data/vendor/faiss/faiss/IndexIVF.cpp +2 -3
  45. data/vendor/faiss/faiss/IndexIVF.h +5 -4
  46. data/vendor/faiss/faiss/IndexIVFAdditiveQuantizer.cpp +6 -7
  47. data/vendor/faiss/faiss/IndexIVFAdditiveQuantizer.h +2 -2
  48. data/vendor/faiss/faiss/IndexIVFAdditiveQuantizerFastScan.cpp +3 -14
  49. data/vendor/faiss/faiss/IndexIVFAdditiveQuantizerFastScan.h +2 -4
  50. data/vendor/faiss/faiss/IndexIVFFastScan.cpp +71 -34
  51. data/vendor/faiss/faiss/IndexIVFFastScan.h +19 -2
  52. data/vendor/faiss/faiss/IndexIVFFlat.cpp +2 -2
  53. data/vendor/faiss/faiss/IndexIVFFlat.h +2 -2
  54. data/vendor/faiss/faiss/IndexIVFIndependentQuantizer.cpp +2 -2
  55. data/vendor/faiss/faiss/IndexIVFIndependentQuantizer.h +2 -2
  56. data/vendor/faiss/faiss/IndexIVFPQ.cpp +2 -3
  57. data/vendor/faiss/faiss/IndexIVFPQ.h +2 -2
  58. data/vendor/faiss/faiss/IndexIVFPQFastScan.cpp +7 -33
  59. data/vendor/faiss/faiss/IndexIVFPQFastScan.h +2 -4
  60. data/vendor/faiss/faiss/IndexIVFPQR.cpp +2 -2
  61. data/vendor/faiss/faiss/IndexIVFPQR.h +2 -2
  62. data/vendor/faiss/faiss/IndexIVFSpectralHash.cpp +2 -3
  63. data/vendor/faiss/faiss/IndexIVFSpectralHash.h +2 -2
  64. data/vendor/faiss/faiss/IndexLSH.cpp +2 -3
  65. data/vendor/faiss/faiss/IndexLSH.h +2 -2
  66. data/vendor/faiss/faiss/IndexLattice.cpp +2 -2
  67. data/vendor/faiss/faiss/IndexLattice.h +2 -2
  68. data/vendor/faiss/faiss/IndexNNDescent.cpp +2 -2
  69. data/vendor/faiss/faiss/IndexNNDescent.h +2 -2
  70. data/vendor/faiss/faiss/IndexNSG.cpp +2 -5
  71. data/vendor/faiss/faiss/IndexNSG.h +2 -2
  72. data/vendor/faiss/faiss/IndexNeuralNetCodec.cpp +2 -2
  73. data/vendor/faiss/faiss/IndexNeuralNetCodec.h +2 -2
  74. data/vendor/faiss/faiss/IndexPQ.cpp +26 -26
  75. data/vendor/faiss/faiss/IndexPQ.h +2 -2
  76. data/vendor/faiss/faiss/IndexPQFastScan.cpp +2 -5
  77. data/vendor/faiss/faiss/IndexPQFastScan.h +2 -11
  78. data/vendor/faiss/faiss/IndexPreTransform.cpp +2 -2
  79. data/vendor/faiss/faiss/IndexPreTransform.h +2 -2
  80. data/vendor/faiss/faiss/IndexRefine.cpp +41 -4
  81. data/vendor/faiss/faiss/IndexRefine.h +9 -2
  82. data/vendor/faiss/faiss/IndexReplicas.cpp +2 -2
  83. data/vendor/faiss/faiss/IndexReplicas.h +2 -2
  84. data/vendor/faiss/faiss/IndexRowwiseMinMax.cpp +2 -2
  85. data/vendor/faiss/faiss/IndexRowwiseMinMax.h +2 -2
  86. data/vendor/faiss/faiss/IndexScalarQuantizer.cpp +2 -3
  87. data/vendor/faiss/faiss/IndexScalarQuantizer.h +2 -2
  88. data/vendor/faiss/faiss/IndexShards.cpp +2 -2
  89. data/vendor/faiss/faiss/IndexShards.h +2 -2
  90. data/vendor/faiss/faiss/IndexShardsIVF.cpp +2 -2
  91. data/vendor/faiss/faiss/IndexShardsIVF.h +2 -2
  92. data/vendor/faiss/faiss/MatrixStats.cpp +2 -2
  93. data/vendor/faiss/faiss/MatrixStats.h +2 -2
  94. data/vendor/faiss/faiss/MetaIndexes.cpp +2 -3
  95. data/vendor/faiss/faiss/MetaIndexes.h +2 -2
  96. data/vendor/faiss/faiss/MetricType.h +2 -2
  97. data/vendor/faiss/faiss/VectorTransform.cpp +2 -2
  98. data/vendor/faiss/faiss/VectorTransform.h +2 -2
  99. data/vendor/faiss/faiss/clone_index.cpp +2 -2
  100. data/vendor/faiss/faiss/clone_index.h +2 -2
  101. data/vendor/faiss/faiss/cppcontrib/SaDecodeKernels.h +2 -2
  102. data/vendor/faiss/faiss/cppcontrib/detail/CoarseBitType.h +2 -2
  103. data/vendor/faiss/faiss/cppcontrib/detail/UintReader.h +2 -2
  104. data/vendor/faiss/faiss/cppcontrib/factory_tools.cpp +44 -4
  105. data/vendor/faiss/faiss/cppcontrib/factory_tools.h +7 -2
  106. data/vendor/faiss/faiss/cppcontrib/sa_decode/Level2-avx2-inl.h +2 -2
  107. data/vendor/faiss/faiss/cppcontrib/sa_decode/Level2-inl.h +2 -2
  108. data/vendor/faiss/faiss/cppcontrib/sa_decode/Level2-neon-inl.h +2 -2
  109. data/vendor/faiss/faiss/cppcontrib/sa_decode/MinMax-inl.h +2 -2
  110. data/vendor/faiss/faiss/cppcontrib/sa_decode/MinMaxFP16-inl.h +2 -2
  111. data/vendor/faiss/faiss/cppcontrib/sa_decode/PQ-avx2-inl.h +2 -2
  112. data/vendor/faiss/faiss/cppcontrib/sa_decode/PQ-inl.h +2 -2
  113. data/vendor/faiss/faiss/cppcontrib/sa_decode/PQ-neon-inl.h +2 -2
  114. data/vendor/faiss/faiss/gpu/GpuAutoTune.cpp +2 -5
  115. data/vendor/faiss/faiss/gpu/GpuAutoTune.h +2 -2
  116. data/vendor/faiss/faiss/gpu/GpuCloner.cpp +13 -13
  117. data/vendor/faiss/faiss/gpu/GpuCloner.h +2 -2
  118. data/vendor/faiss/faiss/gpu/GpuClonerOptions.h +6 -6
  119. data/vendor/faiss/faiss/gpu/GpuDistance.h +11 -7
  120. data/vendor/faiss/faiss/gpu/GpuFaissAssert.h +2 -2
  121. data/vendor/faiss/faiss/gpu/GpuIcmEncoder.h +2 -2
  122. data/vendor/faiss/faiss/gpu/GpuIndex.h +8 -7
  123. data/vendor/faiss/faiss/gpu/GpuIndexBinaryFlat.h +2 -2
  124. data/vendor/faiss/faiss/gpu/GpuIndexCagra.h +6 -3
  125. data/vendor/faiss/faiss/gpu/GpuIndexFlat.h +2 -2
  126. data/vendor/faiss/faiss/gpu/GpuIndexIVF.h +2 -2
  127. data/vendor/faiss/faiss/gpu/GpuIndexIVFFlat.h +2 -2
  128. data/vendor/faiss/faiss/gpu/GpuIndexIVFPQ.h +3 -3
  129. data/vendor/faiss/faiss/gpu/GpuIndexIVFScalarQuantizer.h +2 -2
  130. data/vendor/faiss/faiss/gpu/GpuIndicesOptions.h +2 -2
  131. data/vendor/faiss/faiss/gpu/GpuResources.cpp +7 -2
  132. data/vendor/faiss/faiss/gpu/GpuResources.h +11 -4
  133. data/vendor/faiss/faiss/gpu/StandardGpuResources.cpp +51 -21
  134. data/vendor/faiss/faiss/gpu/StandardGpuResources.h +15 -5
  135. data/vendor/faiss/faiss/gpu/impl/IndexUtils.h +2 -2
  136. data/vendor/faiss/faiss/gpu/impl/InterleavedCodes.cpp +2 -2
  137. data/vendor/faiss/faiss/gpu/impl/InterleavedCodes.h +2 -2
  138. data/vendor/faiss/faiss/gpu/impl/RemapIndices.cpp +2 -2
  139. data/vendor/faiss/faiss/gpu/impl/RemapIndices.h +2 -2
  140. data/vendor/faiss/faiss/gpu/perf/IndexWrapper-inl.h +2 -2
  141. data/vendor/faiss/faiss/gpu/perf/IndexWrapper.h +2 -2
  142. data/vendor/faiss/faiss/gpu/perf/PerfClustering.cpp +2 -2
  143. data/vendor/faiss/faiss/gpu/perf/PerfIVFPQAdd.cpp +2 -3
  144. data/vendor/faiss/faiss/gpu/perf/WriteIndex.cpp +2 -2
  145. data/vendor/faiss/faiss/gpu/test/TestCodePacking.cpp +2 -2
  146. data/vendor/faiss/faiss/gpu/test/TestGpuIndexBinaryFlat.cpp +2 -2
  147. data/vendor/faiss/faiss/gpu/test/TestGpuIndexFlat.cpp +54 -54
  148. data/vendor/faiss/faiss/gpu/test/TestGpuIndexIVFFlat.cpp +80 -78
  149. data/vendor/faiss/faiss/gpu/test/TestGpuIndexIVFPQ.cpp +51 -51
  150. data/vendor/faiss/faiss/gpu/test/TestGpuIndexIVFScalarQuantizer.cpp +2 -2
  151. data/vendor/faiss/faiss/gpu/test/TestGpuMemoryException.cpp +3 -3
  152. data/vendor/faiss/faiss/gpu/test/TestGpuResidualQuantizer.cpp +70 -0
  153. data/vendor/faiss/faiss/gpu/test/TestUtils.cpp +74 -4
  154. data/vendor/faiss/faiss/gpu/test/TestUtils.h +2 -2
  155. data/vendor/faiss/faiss/gpu/test/demo_ivfpq_indexing_gpu.cpp +2 -2
  156. data/vendor/faiss/faiss/gpu/utils/{RaftUtils.h → CuvsUtils.h} +12 -11
  157. data/vendor/faiss/faiss/gpu/utils/DeviceUtils.h +2 -2
  158. data/vendor/faiss/faiss/gpu/utils/StackDeviceMemory.cpp +2 -2
  159. data/vendor/faiss/faiss/gpu/utils/StackDeviceMemory.h +2 -2
  160. data/vendor/faiss/faiss/gpu/utils/StaticUtils.h +2 -2
  161. data/vendor/faiss/faiss/gpu/utils/Timer.cpp +2 -2
  162. data/vendor/faiss/faiss/gpu/utils/Timer.h +2 -2
  163. data/vendor/faiss/faiss/impl/AdditiveQuantizer.cpp +79 -11
  164. data/vendor/faiss/faiss/impl/AdditiveQuantizer.h +17 -5
  165. data/vendor/faiss/faiss/impl/AuxIndexStructures.cpp +2 -2
  166. data/vendor/faiss/faiss/impl/AuxIndexStructures.h +2 -2
  167. data/vendor/faiss/faiss/impl/CodePacker.cpp +2 -2
  168. data/vendor/faiss/faiss/impl/CodePacker.h +2 -2
  169. data/vendor/faiss/faiss/impl/DistanceComputer.h +2 -2
  170. data/vendor/faiss/faiss/impl/FaissAssert.h +2 -2
  171. data/vendor/faiss/faiss/impl/FaissException.cpp +2 -2
  172. data/vendor/faiss/faiss/impl/FaissException.h +2 -3
  173. data/vendor/faiss/faiss/impl/HNSW.cpp +24 -19
  174. data/vendor/faiss/faiss/impl/HNSW.h +12 -2
  175. data/vendor/faiss/faiss/impl/IDSelector.cpp +2 -2
  176. data/vendor/faiss/faiss/impl/IDSelector.h +2 -2
  177. data/vendor/faiss/faiss/impl/LocalSearchQuantizer.cpp +2 -2
  178. data/vendor/faiss/faiss/impl/LocalSearchQuantizer.h +2 -2
  179. data/vendor/faiss/faiss/impl/LookupTableScaler.h +2 -2
  180. data/vendor/faiss/faiss/impl/NNDescent.cpp +2 -2
  181. data/vendor/faiss/faiss/impl/NNDescent.h +2 -2
  182. data/vendor/faiss/faiss/impl/NSG.cpp +27 -21
  183. data/vendor/faiss/faiss/impl/NSG.h +20 -8
  184. data/vendor/faiss/faiss/impl/PolysemousTraining.cpp +2 -2
  185. data/vendor/faiss/faiss/impl/PolysemousTraining.h +2 -2
  186. data/vendor/faiss/faiss/impl/ProductAdditiveQuantizer.cpp +2 -4
  187. data/vendor/faiss/faiss/impl/ProductAdditiveQuantizer.h +2 -2
  188. data/vendor/faiss/faiss/impl/ProductQuantizer-inl.h +2 -2
  189. data/vendor/faiss/faiss/impl/ProductQuantizer.cpp +2 -2
  190. data/vendor/faiss/faiss/impl/ProductQuantizer.h +2 -2
  191. data/vendor/faiss/faiss/impl/Quantizer.h +2 -2
  192. data/vendor/faiss/faiss/impl/ResidualQuantizer.cpp +2 -36
  193. data/vendor/faiss/faiss/impl/ResidualQuantizer.h +3 -13
  194. data/vendor/faiss/faiss/impl/ResultHandler.h +2 -2
  195. data/vendor/faiss/faiss/impl/ScalarQuantizer.cpp +2 -2
  196. data/vendor/faiss/faiss/impl/ScalarQuantizer.h +2 -2
  197. data/vendor/faiss/faiss/impl/ThreadedIndex-inl.h +2 -2
  198. data/vendor/faiss/faiss/impl/ThreadedIndex.h +2 -2
  199. data/vendor/faiss/faiss/impl/code_distance/code_distance-avx2.h +2 -2
  200. data/vendor/faiss/faiss/impl/code_distance/code_distance-avx512.h +2 -2
  201. data/vendor/faiss/faiss/impl/code_distance/code_distance-generic.h +2 -2
  202. data/vendor/faiss/faiss/impl/code_distance/code_distance-sve.h +440 -0
  203. data/vendor/faiss/faiss/impl/code_distance/code_distance.h +55 -2
  204. data/vendor/faiss/faiss/impl/index_read.cpp +2 -5
  205. data/vendor/faiss/faiss/impl/index_read_utils.h +2 -2
  206. data/vendor/faiss/faiss/impl/index_write.cpp +2 -6
  207. data/vendor/faiss/faiss/impl/io.cpp +2 -2
  208. data/vendor/faiss/faiss/impl/io.h +2 -2
  209. data/vendor/faiss/faiss/impl/io_macros.h +2 -9
  210. data/vendor/faiss/faiss/impl/kmeans1d.cpp +2 -3
  211. data/vendor/faiss/faiss/impl/kmeans1d.h +2 -2
  212. data/vendor/faiss/faiss/impl/lattice_Zn.cpp +2 -3
  213. data/vendor/faiss/faiss/impl/lattice_Zn.h +2 -2
  214. data/vendor/faiss/faiss/impl/platform_macros.h +12 -2
  215. data/vendor/faiss/faiss/impl/pq4_fast_scan.cpp +2 -2
  216. data/vendor/faiss/faiss/impl/pq4_fast_scan.h +20 -2
  217. data/vendor/faiss/faiss/impl/pq4_fast_scan_search_1.cpp +2 -2
  218. data/vendor/faiss/faiss/impl/pq4_fast_scan_search_qbs.cpp +2 -2
  219. data/vendor/faiss/faiss/impl/residual_quantizer_encode_steps.cpp +3 -3
  220. data/vendor/faiss/faiss/impl/residual_quantizer_encode_steps.h +2 -2
  221. data/vendor/faiss/faiss/impl/simd_result_handlers.h +18 -18
  222. data/vendor/faiss/faiss/index_factory.cpp +20 -21
  223. data/vendor/faiss/faiss/index_factory.h +2 -2
  224. data/vendor/faiss/faiss/index_io.h +2 -2
  225. data/vendor/faiss/faiss/invlists/BlockInvertedLists.cpp +2 -2
  226. data/vendor/faiss/faiss/invlists/BlockInvertedLists.h +2 -2
  227. data/vendor/faiss/faiss/invlists/DirectMap.cpp +2 -2
  228. data/vendor/faiss/faiss/invlists/DirectMap.h +2 -2
  229. data/vendor/faiss/faiss/invlists/InvertedLists.cpp +2 -2
  230. data/vendor/faiss/faiss/invlists/InvertedLists.h +2 -2
  231. data/vendor/faiss/faiss/invlists/InvertedListsIOHook.cpp +2 -2
  232. data/vendor/faiss/faiss/invlists/InvertedListsIOHook.h +2 -2
  233. data/vendor/faiss/faiss/invlists/OnDiskInvertedLists.cpp +2 -3
  234. data/vendor/faiss/faiss/invlists/OnDiskInvertedLists.h +2 -2
  235. data/vendor/faiss/faiss/python/python_callbacks.cpp +2 -2
  236. data/vendor/faiss/faiss/python/python_callbacks.h +2 -2
  237. data/vendor/faiss/faiss/utils/AlignedTable.h +5 -3
  238. data/vendor/faiss/faiss/utils/Heap.cpp +2 -2
  239. data/vendor/faiss/faiss/utils/Heap.h +2 -2
  240. data/vendor/faiss/faiss/utils/NeuralNet.cpp +11 -7
  241. data/vendor/faiss/faiss/utils/NeuralNet.h +2 -2
  242. data/vendor/faiss/faiss/utils/WorkerThread.cpp +2 -2
  243. data/vendor/faiss/faiss/utils/WorkerThread.h +2 -2
  244. data/vendor/faiss/faiss/utils/approx_topk/approx_topk.h +2 -2
  245. data/vendor/faiss/faiss/utils/approx_topk/avx2-inl.h +2 -2
  246. data/vendor/faiss/faiss/utils/approx_topk/generic.h +2 -2
  247. data/vendor/faiss/faiss/utils/approx_topk/mode.h +2 -2
  248. data/vendor/faiss/faiss/utils/approx_topk_hamming/approx_topk_hamming.h +2 -2
  249. data/vendor/faiss/faiss/utils/bf16.h +2 -2
  250. data/vendor/faiss/faiss/utils/distances.cpp +191 -2
  251. data/vendor/faiss/faiss/utils/distances.h +3 -3
  252. data/vendor/faiss/faiss/utils/distances_fused/avx512.cpp +2 -2
  253. data/vendor/faiss/faiss/utils/distances_fused/avx512.h +2 -2
  254. data/vendor/faiss/faiss/utils/distances_fused/distances_fused.cpp +2 -2
  255. data/vendor/faiss/faiss/utils/distances_fused/distances_fused.h +2 -2
  256. data/vendor/faiss/faiss/utils/distances_fused/simdlib_based.cpp +2 -2
  257. data/vendor/faiss/faiss/utils/distances_fused/simdlib_based.h +2 -2
  258. data/vendor/faiss/faiss/utils/distances_simd.cpp +502 -3
  259. data/vendor/faiss/faiss/utils/extra_distances-inl.h +2 -2
  260. data/vendor/faiss/faiss/utils/extra_distances.cpp +2 -3
  261. data/vendor/faiss/faiss/utils/extra_distances.h +2 -2
  262. data/vendor/faiss/faiss/utils/fp16-arm.h +2 -2
  263. data/vendor/faiss/faiss/utils/fp16-fp16c.h +2 -2
  264. data/vendor/faiss/faiss/utils/fp16-inl.h +2 -2
  265. data/vendor/faiss/faiss/utils/fp16.h +2 -2
  266. data/vendor/faiss/faiss/utils/hamming-inl.h +2 -2
  267. data/vendor/faiss/faiss/utils/hamming.cpp +2 -3
  268. data/vendor/faiss/faiss/utils/hamming.h +2 -2
  269. data/vendor/faiss/faiss/utils/hamming_distance/avx2-inl.h +2 -2
  270. data/vendor/faiss/faiss/utils/hamming_distance/avx512-inl.h +490 -0
  271. data/vendor/faiss/faiss/utils/hamming_distance/common.h +2 -2
  272. data/vendor/faiss/faiss/utils/hamming_distance/generic-inl.h +2 -2
  273. data/vendor/faiss/faiss/utils/hamming_distance/hamdis-inl.h +5 -2
  274. data/vendor/faiss/faiss/utils/hamming_distance/neon-inl.h +5 -5
  275. data/vendor/faiss/faiss/utils/ordered_key_value.h +2 -2
  276. data/vendor/faiss/faiss/utils/partitioning.cpp +2 -2
  277. data/vendor/faiss/faiss/utils/partitioning.h +2 -2
  278. data/vendor/faiss/faiss/utils/prefetch.h +2 -2
  279. data/vendor/faiss/faiss/utils/quantize_lut.cpp +2 -2
  280. data/vendor/faiss/faiss/utils/quantize_lut.h +2 -2
  281. data/vendor/faiss/faiss/utils/random.cpp +2 -2
  282. data/vendor/faiss/faiss/utils/random.h +2 -2
  283. data/vendor/faiss/faiss/utils/simdlib.h +2 -2
  284. data/vendor/faiss/faiss/utils/simdlib_avx2.h +2 -2
  285. data/vendor/faiss/faiss/utils/simdlib_avx512.h +2 -2
  286. data/vendor/faiss/faiss/utils/simdlib_emulated.h +2 -2
  287. data/vendor/faiss/faiss/utils/simdlib_neon.h +2 -2
  288. data/vendor/faiss/faiss/utils/simdlib_ppc64.h +2 -2
  289. data/vendor/faiss/faiss/utils/sorting.cpp +2 -2
  290. data/vendor/faiss/faiss/utils/sorting.h +2 -2
  291. data/vendor/faiss/faiss/utils/transpose/transpose-avx2-inl.h +2 -2
  292. data/vendor/faiss/faiss/utils/transpose/transpose-avx512-inl.h +2 -2
  293. data/vendor/faiss/faiss/utils/utils.cpp +7 -7
  294. data/vendor/faiss/faiss/utils/utils.h +4 -3
  295. metadata +9 -10
data/lib/faiss/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Faiss
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -134,6 +134,10 @@ void Index::sa_decode(idx_t, const uint8_t*, float*) const {
134
134
  FAISS_THROW_MSG("standalone codec not implemented for this type of index");
135
135
  }
136
136
 
137
+ void Index::add_sa_codes(idx_t, const uint8_t*, const idx_t*) {
138
+ FAISS_THROW_MSG("add_sa_codes not implemented for this type of index");
139
+ }
140
+
137
141
  namespace {
138
142
 
139
143
  // storage that explicitly reconstructs vectors before computing distances
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -17,7 +17,7 @@
17
17
  #include <typeinfo>
18
18
 
19
19
  #define FAISS_VERSION_MAJOR 1
20
- #define FAISS_VERSION_MINOR 9
20
+ #define FAISS_VERSION_MINOR 10
21
21
  #define FAISS_VERSION_PATCH 0
22
22
 
23
23
  // Macro to combine the version components into a single string
@@ -307,6 +307,13 @@ struct Index {
307
307
  * trained in the same way and have the same
308
308
  * parameters). Otherwise throw. */
309
309
  virtual void check_compatible_for_merge(const Index& otherIndex) const;
310
+
311
+ /** Add vectors that are computed with the standalone codec
312
+ *
313
+ * @param codes codes to add size n * sa_code_size()
314
+ * @param xids corresponding ids, size n
315
+ */
316
+ virtual void add_sa_codes(idx_t n, const uint8_t* codes, const idx_t* xids);
310
317
  };
311
318
 
312
319
  } // namespace faiss
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -16,7 +16,6 @@
16
16
  #include <faiss/impl/ResultHandler.h>
17
17
  #include <faiss/utils/distances.h>
18
18
  #include <faiss/utils/extra_distances.h>
19
- #include <faiss/utils/utils.h>
20
19
 
21
20
  namespace faiss {
22
21
 
@@ -273,6 +272,7 @@ void IndexAdditiveQuantizer::search(
273
272
  DISPATCH(ST_norm_qint8)
274
273
  DISPATCH(ST_norm_qint4)
275
274
  DISPATCH(ST_norm_cqint4)
275
+ DISPATCH(ST_norm_from_LUT)
276
276
  case AdditiveQuantizer::ST_norm_cqint8:
277
277
  case AdditiveQuantizer::ST_norm_lsq2x4:
278
278
  case AdditiveQuantizer::ST_norm_rq2x4:
@@ -527,7 +527,7 @@ void ResidualCoarseQuantizer::search(
527
527
  float* distances,
528
528
  idx_t* labels,
529
529
  const SearchParameters* params_in) const {
530
- float beam_factor = this->beam_factor;
530
+ float actual_beam_factor = this->beam_factor;
531
531
  if (params_in) {
532
532
  auto params =
533
533
  dynamic_cast<const SearchParametersResidualCoarseQuantizer*>(
@@ -535,15 +535,15 @@ void ResidualCoarseQuantizer::search(
535
535
  FAISS_THROW_IF_NOT_MSG(
536
536
  params,
537
537
  "need SearchParametersResidualCoarseQuantizer parameters");
538
- beam_factor = params->beam_factor;
538
+ actual_beam_factor = params->beam_factor;
539
539
  }
540
540
 
541
- if (beam_factor < 0) {
541
+ if (actual_beam_factor < 0) {
542
542
  AdditiveCoarseQuantizer::search(n, x, k, distances, labels);
543
543
  return;
544
544
  }
545
545
 
546
- int beam_size = int(k * beam_factor);
546
+ int beam_size = int(k * actual_beam_factor);
547
547
  if (beam_size > ntotal) {
548
548
  beam_size = ntotal;
549
549
  }
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -8,11 +8,8 @@
8
8
  #include <faiss/IndexAdditiveQuantizerFastScan.h>
9
9
 
10
10
  #include <cassert>
11
- #include <climits>
12
11
  #include <memory>
13
12
 
14
- #include <omp.h>
15
-
16
13
  #include <faiss/impl/FaissAssert.h>
17
14
  #include <faiss/impl/LocalSearchQuantizer.h>
18
15
  #include <faiss/impl/LookupTableScaler.h>
@@ -35,30 +32,31 @@ IndexAdditiveQuantizerFastScan::IndexAdditiveQuantizerFastScan(
35
32
  }
36
33
 
37
34
  void IndexAdditiveQuantizerFastScan::init(
38
- AdditiveQuantizer* aq_2,
35
+ AdditiveQuantizer* aq_init,
39
36
  MetricType metric,
40
37
  int bbs) {
41
- FAISS_THROW_IF_NOT(aq_2 != nullptr);
42
- FAISS_THROW_IF_NOT(!aq_2->nbits.empty());
43
- FAISS_THROW_IF_NOT(aq_2->nbits[0] == 4);
38
+ FAISS_THROW_IF_NOT(aq_init != nullptr);
39
+ FAISS_THROW_IF_NOT(!aq_init->nbits.empty());
40
+ FAISS_THROW_IF_NOT(aq_init->nbits[0] == 4);
44
41
  if (metric == METRIC_INNER_PRODUCT) {
45
42
  FAISS_THROW_IF_NOT_MSG(
46
- aq_2->search_type == AdditiveQuantizer::ST_LUT_nonorm,
43
+ aq_init->search_type == AdditiveQuantizer::ST_LUT_nonorm,
47
44
  "Search type must be ST_LUT_nonorm for IP metric");
48
45
  } else {
49
46
  FAISS_THROW_IF_NOT_MSG(
50
- aq_2->search_type == AdditiveQuantizer::ST_norm_lsq2x4 ||
51
- aq_2->search_type == AdditiveQuantizer::ST_norm_rq2x4,
47
+ aq_init->search_type == AdditiveQuantizer::ST_norm_lsq2x4 ||
48
+ aq_init->search_type ==
49
+ AdditiveQuantizer::ST_norm_rq2x4,
52
50
  "Search type must be lsq2x4 or rq2x4 for L2 metric");
53
51
  }
54
52
 
55
- this->aq = aq_2;
53
+ this->aq = aq_init;
56
54
  if (metric == METRIC_L2) {
57
- M = aq_2->M + 2; // 2x4 bits AQ
55
+ M = aq_init->M + 2; // 2x4 bits AQ
58
56
  } else {
59
- M = aq_2->M;
57
+ M = aq_init->M;
60
58
  }
61
- init_fastscan(aq_2->d, M, 4, metric, bbs);
59
+ init_fastscan(aq_init->d, M, 4, metric, bbs);
62
60
 
63
61
  max_train_points = 1024 * ksub * M;
64
62
  }
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -103,4 +103,15 @@ void IndexBinary::check_compatible_for_merge(
103
103
  FAISS_THROW_MSG("check_compatible_for_merge() not implemented");
104
104
  }
105
105
 
106
+ size_t IndexBinary::sa_code_size() const {
107
+ return code_size;
108
+ }
109
+
110
+ void IndexBinary::add_sa_codes(
111
+ idx_t n,
112
+ const uint8_t* codes,
113
+ const idx_t* xids) {
114
+ add_with_ids(n, codes, xids);
115
+ }
116
+
106
117
  } // namespace faiss
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -171,6 +171,12 @@ struct IndexBinary {
171
171
  * parameters). Otherwise throw. */
172
172
  virtual void check_compatible_for_merge(
173
173
  const IndexBinary& otherIndex) const;
174
+
175
+ /** size of the produced codes in bytes */
176
+ virtual size_t sa_code_size() const;
177
+
178
+ /** Same as add_with_ids for IndexBinary. */
179
+ virtual void add_sa_codes(idx_t n, const uint8_t* codes, const idx_t* xids);
174
180
  };
175
181
 
176
182
  } // namespace faiss
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -14,7 +14,6 @@
14
14
  #include <faiss/impl/IDSelector.h>
15
15
  #include <faiss/utils/Heap.h>
16
16
  #include <faiss/utils/hamming.h>
17
- #include <faiss/utils/utils.h>
18
17
  #include <cstring>
19
18
 
20
19
  namespace faiss {
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -15,11 +15,6 @@
15
15
  #include <cstring>
16
16
  #include <memory>
17
17
 
18
- #include <queue>
19
- #include <unordered_set>
20
-
21
- #include <sys/stat.h>
22
- #include <sys/types.h>
23
18
  #include <cstdint>
24
19
 
25
20
  #include <faiss/IndexBinaryFlat.h>
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -19,7 +19,6 @@
19
19
 
20
20
  #include <faiss/impl/AuxIndexStructures.h>
21
21
  #include <faiss/impl/FaissAssert.h>
22
- #include <faiss/impl/platform_macros.h>
23
22
 
24
23
  namespace faiss {
25
24
 
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -17,11 +17,7 @@
17
17
  #include <faiss/impl/IDSelector.h>
18
18
  #include <faiss/impl/LookupTableScaler.h>
19
19
  #include <faiss/impl/ResultHandler.h>
20
- #include <faiss/utils/distances.h>
21
- #include <faiss/utils/extra_distances.h>
22
20
  #include <faiss/utils/hamming.h>
23
- #include <faiss/utils/random.h>
24
- #include <faiss/utils/utils.h>
25
21
 
26
22
  #include <faiss/impl/pq4_fast_scan.h>
27
23
  #include <faiss/impl/simd_result_handlers.h>
@@ -37,22 +33,22 @@ inline size_t roundup(size_t a, size_t b) {
37
33
 
38
34
  void IndexFastScan::init_fastscan(
39
35
  int d,
40
- size_t M_2,
41
- size_t nbits_2,
36
+ size_t M_init,
37
+ size_t nbits_init,
42
38
  MetricType metric,
43
39
  int bbs) {
44
- FAISS_THROW_IF_NOT(nbits_2 == 4);
40
+ FAISS_THROW_IF_NOT(nbits_init == 4);
45
41
  FAISS_THROW_IF_NOT(bbs % 32 == 0);
46
42
  this->d = d;
47
- this->M = M_2;
48
- this->nbits = nbits_2;
43
+ this->M = M_init;
44
+ this->nbits = nbits_init;
49
45
  this->metric_type = metric;
50
46
  this->bbs = bbs;
51
- ksub = (1 << nbits_2);
47
+ ksub = (1 << nbits_init);
52
48
 
53
- code_size = (M_2 * nbits_2 + 7) / 8;
49
+ code_size = (M_init * nbits_init + 7) / 8;
54
50
  ntotal = ntotal2 = 0;
55
- M2 = roundup(M_2, 2);
51
+ M2 = roundup(M_init, 2);
56
52
  is_trained = false;
57
53
  }
58
54
 
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -133,6 +133,15 @@ struct IndexFastScan : Index {
133
133
 
134
134
  void merge_from(Index& otherIndex, idx_t add_id = 0) override;
135
135
  void check_compatible_for_merge(const Index& otherIndex) const override;
136
+
137
+ /// standalone codes interface (but the codes are flattened)
138
+ size_t sa_code_size() const override {
139
+ return code_size;
140
+ }
141
+
142
+ void sa_encode(idx_t n, const float* x, uint8_t* bytes) const override {
143
+ compute_codes(bytes, n, x);
144
+ }
136
145
  };
137
146
 
138
147
  struct FastScanStats {
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -16,7 +16,6 @@
16
16
  #include <faiss/utils/extra_distances.h>
17
17
  #include <faiss/utils/prefetch.h>
18
18
  #include <faiss/utils/sorting.h>
19
- #include <faiss/utils/utils.h>
20
19
  #include <cstring>
21
20
 
22
21
  namespace faiss {
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -32,6 +32,15 @@ void IndexFlatCodes::add(idx_t n, const float* x) {
32
32
  ntotal += n;
33
33
  }
34
34
 
35
+ void IndexFlatCodes::add_sa_codes(
36
+ idx_t n,
37
+ const uint8_t* codes_in,
38
+ const idx_t* /* xids */) {
39
+ codes.resize((ntotal + n) * code_size);
40
+ memcpy(codes.data() + (ntotal * code_size), codes_in, n * code_size);
41
+ ntotal += n;
42
+ }
43
+
35
44
  void IndexFlatCodes::reset() {
36
45
  codes.clear();
37
46
  ntotal = 0;
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -76,6 +76,9 @@ struct IndexFlatCodes : Index {
76
76
 
77
77
  virtual void merge_from(Index& otherIndex, idx_t add_id = 0) override;
78
78
 
79
+ virtual void add_sa_codes(idx_t n, const uint8_t* x, const idx_t* xids)
80
+ override;
81
+
79
82
  // permute_entries. perm of size ntotal maps new to old positions
80
83
  void permute_entries(const idx_t* perm);
81
84
  };
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -19,10 +19,7 @@
19
19
  #include <memory>
20
20
  #include <queue>
21
21
  #include <random>
22
- #include <unordered_set>
23
22
 
24
- #include <sys/stat.h>
25
- #include <sys/types.h>
26
23
  #include <cstdint>
27
24
 
28
25
  #include <faiss/Index2Layer.h>
@@ -31,7 +28,6 @@
31
28
  #include <faiss/impl/AuxIndexStructures.h>
32
29
  #include <faiss/impl/FaissAssert.h>
33
30
  #include <faiss/impl/ResultHandler.h>
34
- #include <faiss/utils/distances.h>
35
31
  #include <faiss/utils/random.h>
36
32
  #include <faiss/utils/sorting.h>
37
33
 
@@ -355,6 +351,17 @@ void IndexHNSW::reconstruct(idx_t key, float* recons) const {
355
351
  storage->reconstruct(key, recons);
356
352
  }
357
353
 
354
+ /**************************************************************
355
+ * This section of functions were used during the development of HNSW support.
356
+ * They may be useful in the future but are dormant for now, and thus are not
357
+ * unit tested at the moment.
358
+ * shrink_level_0_neighbors
359
+ * search_level_0
360
+ * init_level_0_from_knngraph
361
+ * init_level_0_from_entry_points
362
+ * reorder_links
363
+ * link_singletons
364
+ **************************************************************/
358
365
  void IndexHNSW::shrink_level_0_neighbors(int new_size) {
359
366
  #pragma omp parallel
360
367
  {
@@ -1,5 +1,5 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.