faiss 0.3.1 → 0.3.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +1 -1
- data/lib/faiss/version.rb +1 -1
- data/vendor/faiss/faiss/AutoTune.cpp +2 -2
- data/vendor/faiss/faiss/AutoTune.h +3 -3
- data/vendor/faiss/faiss/Clustering.cpp +37 -6
- data/vendor/faiss/faiss/Clustering.h +12 -3
- data/vendor/faiss/faiss/IVFlib.cpp +6 -3
- data/vendor/faiss/faiss/IVFlib.h +2 -2
- data/vendor/faiss/faiss/Index.cpp +6 -2
- data/vendor/faiss/faiss/Index.h +30 -8
- data/vendor/faiss/faiss/Index2Layer.cpp +2 -2
- data/vendor/faiss/faiss/Index2Layer.h +2 -2
- data/vendor/faiss/faiss/IndexAdditiveQuantizer.cpp +7 -7
- data/vendor/faiss/faiss/IndexAdditiveQuantizer.h +2 -2
- data/vendor/faiss/faiss/IndexAdditiveQuantizerFastScan.cpp +14 -16
- data/vendor/faiss/faiss/IndexAdditiveQuantizerFastScan.h +2 -2
- data/vendor/faiss/faiss/IndexBinary.cpp +13 -2
- data/vendor/faiss/faiss/IndexBinary.h +8 -2
- data/vendor/faiss/faiss/IndexBinaryFlat.cpp +2 -3
- data/vendor/faiss/faiss/IndexBinaryFlat.h +2 -2
- data/vendor/faiss/faiss/IndexBinaryFromFloat.cpp +2 -2
- data/vendor/faiss/faiss/IndexBinaryFromFloat.h +2 -2
- data/vendor/faiss/faiss/IndexBinaryHNSW.cpp +2 -7
- data/vendor/faiss/faiss/IndexBinaryHNSW.h +3 -3
- data/vendor/faiss/faiss/IndexBinaryHash.cpp +2 -3
- data/vendor/faiss/faiss/IndexBinaryHash.h +2 -2
- data/vendor/faiss/faiss/IndexBinaryIVF.cpp +3 -3
- data/vendor/faiss/faiss/IndexBinaryIVF.h +2 -2
- data/vendor/faiss/faiss/IndexFastScan.cpp +32 -18
- data/vendor/faiss/faiss/IndexFastScan.h +11 -2
- data/vendor/faiss/faiss/IndexFlat.cpp +13 -10
- data/vendor/faiss/faiss/IndexFlat.h +2 -2
- data/vendor/faiss/faiss/IndexFlatCodes.cpp +170 -7
- data/vendor/faiss/faiss/IndexFlatCodes.h +25 -5
- data/vendor/faiss/faiss/IndexHNSW.cpp +156 -96
- data/vendor/faiss/faiss/IndexHNSW.h +54 -5
- data/vendor/faiss/faiss/IndexIDMap.cpp +19 -3
- data/vendor/faiss/faiss/IndexIDMap.h +5 -2
- data/vendor/faiss/faiss/IndexIVF.cpp +5 -6
- data/vendor/faiss/faiss/IndexIVF.h +13 -4
- data/vendor/faiss/faiss/IndexIVFAdditiveQuantizer.cpp +21 -7
- data/vendor/faiss/faiss/IndexIVFAdditiveQuantizer.h +5 -2
- data/vendor/faiss/faiss/IndexIVFAdditiveQuantizerFastScan.cpp +3 -14
- data/vendor/faiss/faiss/IndexIVFAdditiveQuantizerFastScan.h +2 -4
- data/vendor/faiss/faiss/IndexIVFFastScan.cpp +201 -91
- data/vendor/faiss/faiss/IndexIVFFastScan.h +33 -9
- data/vendor/faiss/faiss/IndexIVFFlat.cpp +2 -2
- data/vendor/faiss/faiss/IndexIVFFlat.h +2 -2
- data/vendor/faiss/faiss/IndexIVFIndependentQuantizer.cpp +2 -2
- data/vendor/faiss/faiss/IndexIVFIndependentQuantizer.h +2 -2
- data/vendor/faiss/faiss/IndexIVFPQ.cpp +3 -6
- data/vendor/faiss/faiss/IndexIVFPQ.h +2 -2
- data/vendor/faiss/faiss/IndexIVFPQFastScan.cpp +7 -14
- data/vendor/faiss/faiss/IndexIVFPQFastScan.h +2 -4
- data/vendor/faiss/faiss/IndexIVFPQR.cpp +2 -2
- data/vendor/faiss/faiss/IndexIVFPQR.h +2 -2
- data/vendor/faiss/faiss/IndexIVFSpectralHash.cpp +2 -3
- data/vendor/faiss/faiss/IndexIVFSpectralHash.h +2 -2
- data/vendor/faiss/faiss/IndexLSH.cpp +2 -3
- data/vendor/faiss/faiss/IndexLSH.h +2 -2
- data/vendor/faiss/faiss/IndexLattice.cpp +3 -21
- data/vendor/faiss/faiss/IndexLattice.h +5 -24
- data/vendor/faiss/faiss/IndexNNDescent.cpp +2 -31
- data/vendor/faiss/faiss/IndexNNDescent.h +3 -3
- data/vendor/faiss/faiss/IndexNSG.cpp +2 -5
- data/vendor/faiss/faiss/IndexNSG.h +3 -3
- data/vendor/faiss/faiss/IndexNeuralNetCodec.cpp +56 -0
- data/vendor/faiss/faiss/IndexNeuralNetCodec.h +49 -0
- data/vendor/faiss/faiss/IndexPQ.cpp +26 -26
- data/vendor/faiss/faiss/IndexPQ.h +2 -2
- data/vendor/faiss/faiss/IndexPQFastScan.cpp +2 -5
- data/vendor/faiss/faiss/IndexPQFastScan.h +2 -11
- data/vendor/faiss/faiss/IndexPreTransform.cpp +2 -2
- data/vendor/faiss/faiss/IndexPreTransform.h +3 -3
- data/vendor/faiss/faiss/IndexRefine.cpp +46 -9
- data/vendor/faiss/faiss/IndexRefine.h +9 -2
- data/vendor/faiss/faiss/IndexReplicas.cpp +2 -2
- data/vendor/faiss/faiss/IndexReplicas.h +2 -2
- data/vendor/faiss/faiss/IndexRowwiseMinMax.cpp +2 -2
- data/vendor/faiss/faiss/IndexRowwiseMinMax.h +2 -2
- data/vendor/faiss/faiss/IndexScalarQuantizer.cpp +5 -4
- data/vendor/faiss/faiss/IndexScalarQuantizer.h +2 -2
- data/vendor/faiss/faiss/IndexShards.cpp +2 -2
- data/vendor/faiss/faiss/IndexShards.h +2 -2
- data/vendor/faiss/faiss/IndexShardsIVF.cpp +2 -2
- data/vendor/faiss/faiss/IndexShardsIVF.h +2 -2
- data/vendor/faiss/faiss/MatrixStats.cpp +2 -2
- data/vendor/faiss/faiss/MatrixStats.h +2 -2
- data/vendor/faiss/faiss/MetaIndexes.cpp +2 -3
- data/vendor/faiss/faiss/MetaIndexes.h +2 -2
- data/vendor/faiss/faiss/MetricType.h +9 -4
- data/vendor/faiss/faiss/VectorTransform.cpp +2 -2
- data/vendor/faiss/faiss/VectorTransform.h +2 -2
- data/vendor/faiss/faiss/clone_index.cpp +2 -2
- data/vendor/faiss/faiss/clone_index.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/SaDecodeKernels.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/detail/CoarseBitType.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/detail/UintReader.h +97 -19
- data/vendor/faiss/faiss/cppcontrib/factory_tools.cpp +192 -0
- data/vendor/faiss/faiss/cppcontrib/factory_tools.h +29 -0
- data/vendor/faiss/faiss/cppcontrib/sa_decode/Level2-avx2-inl.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/sa_decode/Level2-inl.h +85 -32
- data/vendor/faiss/faiss/cppcontrib/sa_decode/Level2-neon-inl.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/sa_decode/MinMax-inl.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/sa_decode/MinMaxFP16-inl.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/sa_decode/PQ-avx2-inl.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/sa_decode/PQ-inl.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/sa_decode/PQ-neon-inl.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuAutoTune.cpp +2 -5
- data/vendor/faiss/faiss/gpu/GpuAutoTune.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuCloner.cpp +45 -13
- data/vendor/faiss/faiss/gpu/GpuCloner.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuClonerOptions.h +12 -6
- data/vendor/faiss/faiss/gpu/GpuDistance.h +11 -7
- data/vendor/faiss/faiss/gpu/GpuFaissAssert.h +3 -3
- data/vendor/faiss/faiss/gpu/GpuIcmEncoder.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuIndex.h +10 -15
- data/vendor/faiss/faiss/gpu/GpuIndexBinaryFlat.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuIndexCagra.h +285 -0
- data/vendor/faiss/faiss/gpu/GpuIndexFlat.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuIndexIVF.h +8 -2
- data/vendor/faiss/faiss/gpu/GpuIndexIVFFlat.h +4 -2
- data/vendor/faiss/faiss/gpu/GpuIndexIVFPQ.h +3 -3
- data/vendor/faiss/faiss/gpu/GpuIndexIVFScalarQuantizer.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuIndicesOptions.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuResources.cpp +7 -2
- data/vendor/faiss/faiss/gpu/GpuResources.h +11 -4
- data/vendor/faiss/faiss/gpu/StandardGpuResources.cpp +66 -11
- data/vendor/faiss/faiss/gpu/StandardGpuResources.h +15 -5
- data/vendor/faiss/faiss/gpu/impl/IndexUtils.h +2 -2
- data/vendor/faiss/faiss/gpu/impl/InterleavedCodes.cpp +28 -23
- data/vendor/faiss/faiss/gpu/impl/InterleavedCodes.h +2 -2
- data/vendor/faiss/faiss/gpu/impl/RemapIndices.cpp +2 -2
- data/vendor/faiss/faiss/gpu/impl/RemapIndices.h +2 -2
- data/vendor/faiss/faiss/gpu/perf/IndexWrapper-inl.h +2 -2
- data/vendor/faiss/faiss/gpu/perf/IndexWrapper.h +2 -2
- data/vendor/faiss/faiss/gpu/perf/PerfClustering.cpp +8 -2
- data/vendor/faiss/faiss/gpu/perf/PerfIVFPQAdd.cpp +2 -3
- data/vendor/faiss/faiss/gpu/perf/WriteIndex.cpp +2 -2
- data/vendor/faiss/faiss/gpu/test/TestCodePacking.cpp +10 -7
- data/vendor/faiss/faiss/gpu/test/TestGpuIndexBinaryFlat.cpp +2 -2
- data/vendor/faiss/faiss/gpu/test/TestGpuIndexFlat.cpp +54 -54
- data/vendor/faiss/faiss/gpu/test/TestGpuIndexIVFFlat.cpp +144 -77
- data/vendor/faiss/faiss/gpu/test/TestGpuIndexIVFPQ.cpp +51 -51
- data/vendor/faiss/faiss/gpu/test/TestGpuIndexIVFScalarQuantizer.cpp +2 -2
- data/vendor/faiss/faiss/gpu/test/TestGpuMemoryException.cpp +3 -3
- data/vendor/faiss/faiss/gpu/test/TestGpuResidualQuantizer.cpp +70 -0
- data/vendor/faiss/faiss/gpu/test/TestUtils.cpp +74 -4
- data/vendor/faiss/faiss/gpu/test/TestUtils.h +2 -2
- data/vendor/faiss/faiss/gpu/test/demo_ivfpq_indexing_gpu.cpp +3 -3
- data/vendor/faiss/faiss/gpu/utils/{RaftUtils.h → CuvsUtils.h} +12 -11
- data/vendor/faiss/faiss/gpu/utils/DeviceUtils.h +8 -2
- data/vendor/faiss/faiss/gpu/utils/StackDeviceMemory.cpp +2 -2
- data/vendor/faiss/faiss/gpu/utils/StackDeviceMemory.h +2 -2
- data/vendor/faiss/faiss/gpu/utils/StaticUtils.h +2 -2
- data/vendor/faiss/faiss/gpu/utils/Timer.cpp +6 -3
- data/vendor/faiss/faiss/gpu/utils/Timer.h +3 -3
- data/vendor/faiss/faiss/impl/AdditiveQuantizer.cpp +79 -11
- data/vendor/faiss/faiss/impl/AdditiveQuantizer.h +17 -5
- data/vendor/faiss/faiss/impl/AuxIndexStructures.cpp +27 -2
- data/vendor/faiss/faiss/impl/AuxIndexStructures.h +11 -3
- data/vendor/faiss/faiss/impl/CodePacker.cpp +2 -2
- data/vendor/faiss/faiss/impl/CodePacker.h +2 -2
- data/vendor/faiss/faiss/impl/DistanceComputer.h +48 -2
- data/vendor/faiss/faiss/impl/FaissAssert.h +6 -4
- data/vendor/faiss/faiss/impl/FaissException.cpp +2 -2
- data/vendor/faiss/faiss/impl/FaissException.h +2 -3
- data/vendor/faiss/faiss/impl/HNSW.cpp +378 -205
- data/vendor/faiss/faiss/impl/HNSW.h +55 -24
- data/vendor/faiss/faiss/impl/IDSelector.cpp +2 -2
- data/vendor/faiss/faiss/impl/IDSelector.h +2 -2
- data/vendor/faiss/faiss/impl/LocalSearchQuantizer.cpp +10 -10
- data/vendor/faiss/faiss/impl/LocalSearchQuantizer.h +2 -2
- data/vendor/faiss/faiss/impl/LookupTableScaler.h +36 -2
- data/vendor/faiss/faiss/impl/NNDescent.cpp +15 -10
- data/vendor/faiss/faiss/impl/NNDescent.h +2 -2
- data/vendor/faiss/faiss/impl/NSG.cpp +26 -49
- data/vendor/faiss/faiss/impl/NSG.h +20 -8
- data/vendor/faiss/faiss/impl/PolysemousTraining.cpp +2 -2
- data/vendor/faiss/faiss/impl/PolysemousTraining.h +2 -2
- data/vendor/faiss/faiss/impl/ProductAdditiveQuantizer.cpp +2 -4
- data/vendor/faiss/faiss/impl/ProductAdditiveQuantizer.h +2 -2
- data/vendor/faiss/faiss/impl/ProductQuantizer-inl.h +2 -2
- data/vendor/faiss/faiss/impl/ProductQuantizer.cpp +3 -2
- data/vendor/faiss/faiss/impl/ProductQuantizer.h +7 -3
- data/vendor/faiss/faiss/impl/Quantizer.h +2 -2
- data/vendor/faiss/faiss/impl/ResidualQuantizer.cpp +2 -36
- data/vendor/faiss/faiss/impl/ResidualQuantizer.h +3 -13
- data/vendor/faiss/faiss/impl/ResultHandler.h +153 -34
- data/vendor/faiss/faiss/impl/ScalarQuantizer.cpp +721 -104
- data/vendor/faiss/faiss/impl/ScalarQuantizer.h +5 -2
- data/vendor/faiss/faiss/impl/ThreadedIndex-inl.h +2 -2
- data/vendor/faiss/faiss/impl/ThreadedIndex.h +2 -2
- data/vendor/faiss/faiss/impl/code_distance/code_distance-avx2.h +7 -2
- data/vendor/faiss/faiss/impl/code_distance/code_distance-avx512.h +248 -0
- data/vendor/faiss/faiss/impl/code_distance/code_distance-generic.h +2 -2
- data/vendor/faiss/faiss/impl/code_distance/code_distance-sve.h +440 -0
- data/vendor/faiss/faiss/impl/code_distance/code_distance.h +55 -2
- data/vendor/faiss/faiss/impl/index_read.cpp +31 -20
- data/vendor/faiss/faiss/impl/index_read_utils.h +37 -0
- data/vendor/faiss/faiss/impl/index_write.cpp +30 -16
- data/vendor/faiss/faiss/impl/io.cpp +15 -7
- data/vendor/faiss/faiss/impl/io.h +6 -6
- data/vendor/faiss/faiss/impl/io_macros.h +8 -9
- data/vendor/faiss/faiss/impl/kmeans1d.cpp +2 -3
- data/vendor/faiss/faiss/impl/kmeans1d.h +2 -2
- data/vendor/faiss/faiss/impl/lattice_Zn.cpp +2 -3
- data/vendor/faiss/faiss/impl/lattice_Zn.h +2 -2
- data/vendor/faiss/faiss/impl/platform_macros.h +34 -2
- data/vendor/faiss/faiss/impl/pq4_fast_scan.cpp +13 -2
- data/vendor/faiss/faiss/impl/pq4_fast_scan.h +20 -2
- data/vendor/faiss/faiss/impl/pq4_fast_scan_search_1.cpp +3 -3
- data/vendor/faiss/faiss/impl/pq4_fast_scan_search_qbs.cpp +450 -3
- data/vendor/faiss/faiss/impl/residual_quantizer_encode_steps.cpp +8 -8
- data/vendor/faiss/faiss/impl/residual_quantizer_encode_steps.h +3 -3
- data/vendor/faiss/faiss/impl/simd_result_handlers.h +151 -67
- data/vendor/faiss/faiss/index_factory.cpp +51 -34
- data/vendor/faiss/faiss/index_factory.h +2 -2
- data/vendor/faiss/faiss/index_io.h +14 -7
- data/vendor/faiss/faiss/invlists/BlockInvertedLists.cpp +30 -10
- data/vendor/faiss/faiss/invlists/BlockInvertedLists.h +5 -2
- data/vendor/faiss/faiss/invlists/DirectMap.cpp +11 -3
- data/vendor/faiss/faiss/invlists/DirectMap.h +2 -2
- data/vendor/faiss/faiss/invlists/InvertedLists.cpp +57 -19
- data/vendor/faiss/faiss/invlists/InvertedLists.h +20 -11
- data/vendor/faiss/faiss/invlists/InvertedListsIOHook.cpp +2 -2
- data/vendor/faiss/faiss/invlists/InvertedListsIOHook.h +2 -2
- data/vendor/faiss/faiss/invlists/OnDiskInvertedLists.cpp +23 -9
- data/vendor/faiss/faiss/invlists/OnDiskInvertedLists.h +4 -3
- data/vendor/faiss/faiss/python/python_callbacks.cpp +5 -5
- data/vendor/faiss/faiss/python/python_callbacks.h +2 -2
- data/vendor/faiss/faiss/utils/AlignedTable.h +5 -3
- data/vendor/faiss/faiss/utils/Heap.cpp +2 -2
- data/vendor/faiss/faiss/utils/Heap.h +107 -2
- data/vendor/faiss/faiss/utils/NeuralNet.cpp +346 -0
- data/vendor/faiss/faiss/utils/NeuralNet.h +147 -0
- data/vendor/faiss/faiss/utils/WorkerThread.cpp +2 -2
- data/vendor/faiss/faiss/utils/WorkerThread.h +2 -2
- data/vendor/faiss/faiss/utils/approx_topk/approx_topk.h +2 -2
- data/vendor/faiss/faiss/utils/approx_topk/avx2-inl.h +2 -2
- data/vendor/faiss/faiss/utils/approx_topk/generic.h +2 -2
- data/vendor/faiss/faiss/utils/approx_topk/mode.h +2 -2
- data/vendor/faiss/faiss/utils/approx_topk_hamming/approx_topk_hamming.h +2 -2
- data/vendor/faiss/faiss/utils/bf16.h +36 -0
- data/vendor/faiss/faiss/utils/distances.cpp +249 -90
- data/vendor/faiss/faiss/utils/distances.h +8 -8
- data/vendor/faiss/faiss/utils/distances_fused/avx512.cpp +2 -2
- data/vendor/faiss/faiss/utils/distances_fused/avx512.h +2 -2
- data/vendor/faiss/faiss/utils/distances_fused/distances_fused.cpp +2 -2
- data/vendor/faiss/faiss/utils/distances_fused/distances_fused.h +2 -2
- data/vendor/faiss/faiss/utils/distances_fused/simdlib_based.cpp +2 -2
- data/vendor/faiss/faiss/utils/distances_fused/simdlib_based.h +2 -2
- data/vendor/faiss/faiss/utils/distances_simd.cpp +1543 -56
- data/vendor/faiss/faiss/utils/extra_distances-inl.h +72 -2
- data/vendor/faiss/faiss/utils/extra_distances.cpp +87 -140
- data/vendor/faiss/faiss/utils/extra_distances.h +5 -4
- data/vendor/faiss/faiss/utils/fp16-arm.h +2 -2
- data/vendor/faiss/faiss/utils/fp16-fp16c.h +2 -2
- data/vendor/faiss/faiss/utils/fp16-inl.h +2 -2
- data/vendor/faiss/faiss/utils/fp16.h +2 -2
- data/vendor/faiss/faiss/utils/hamming-inl.h +2 -2
- data/vendor/faiss/faiss/utils/hamming.cpp +3 -4
- data/vendor/faiss/faiss/utils/hamming.h +2 -2
- data/vendor/faiss/faiss/utils/hamming_distance/avx2-inl.h +2 -2
- data/vendor/faiss/faiss/utils/hamming_distance/avx512-inl.h +490 -0
- data/vendor/faiss/faiss/utils/hamming_distance/common.h +2 -2
- data/vendor/faiss/faiss/utils/hamming_distance/generic-inl.h +6 -3
- data/vendor/faiss/faiss/utils/hamming_distance/hamdis-inl.h +7 -3
- data/vendor/faiss/faiss/utils/hamming_distance/neon-inl.h +5 -5
- data/vendor/faiss/faiss/utils/ordered_key_value.h +2 -2
- data/vendor/faiss/faiss/utils/partitioning.cpp +2 -2
- data/vendor/faiss/faiss/utils/partitioning.h +2 -2
- data/vendor/faiss/faiss/utils/prefetch.h +2 -2
- data/vendor/faiss/faiss/utils/quantize_lut.cpp +2 -2
- data/vendor/faiss/faiss/utils/quantize_lut.h +2 -2
- data/vendor/faiss/faiss/utils/random.cpp +45 -2
- data/vendor/faiss/faiss/utils/random.h +27 -2
- data/vendor/faiss/faiss/utils/simdlib.h +12 -3
- data/vendor/faiss/faiss/utils/simdlib_avx2.h +2 -2
- data/vendor/faiss/faiss/utils/simdlib_avx512.h +296 -0
- data/vendor/faiss/faiss/utils/simdlib_emulated.h +2 -2
- data/vendor/faiss/faiss/utils/simdlib_neon.h +7 -4
- data/vendor/faiss/faiss/utils/simdlib_ppc64.h +1084 -0
- data/vendor/faiss/faiss/utils/sorting.cpp +2 -2
- data/vendor/faiss/faiss/utils/sorting.h +2 -2
- data/vendor/faiss/faiss/utils/transpose/transpose-avx2-inl.h +2 -2
- data/vendor/faiss/faiss/utils/transpose/transpose-avx512-inl.h +176 -0
- data/vendor/faiss/faiss/utils/utils.cpp +17 -10
- data/vendor/faiss/faiss/utils/utils.h +7 -3
- metadata +22 -11
- data/vendor/faiss/faiss/impl/code_distance/code_distance_avx512.h +0 -102
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
* Copyright (c)
|
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.
|
@@ -18,6 +18,8 @@
|
|
18
18
|
|
19
19
|
#ifdef __AVX2__
|
20
20
|
#include <immintrin.h>
|
21
|
+
#elif defined(__ARM_FEATURE_SVE)
|
22
|
+
#include <arm_sve.h>
|
21
23
|
#endif
|
22
24
|
|
23
25
|
#include <faiss/impl/AuxIndexStructures.h>
|
@@ -130,20 +132,17 @@ void fvec_renorm_L2(size_t d, size_t nx, float* __restrict x) {
|
|
130
132
|
namespace {
|
131
133
|
|
132
134
|
/* Find the nearest neighbors for nx queries in a set of ny vectors */
|
133
|
-
template <class BlockResultHandler
|
135
|
+
template <class BlockResultHandler>
|
134
136
|
void exhaustive_inner_product_seq(
|
135
137
|
const float* x,
|
136
138
|
const float* y,
|
137
139
|
size_t d,
|
138
140
|
size_t nx,
|
139
141
|
size_t ny,
|
140
|
-
BlockResultHandler& res
|
141
|
-
const IDSelector* sel = nullptr) {
|
142
|
+
BlockResultHandler& res) {
|
142
143
|
using SingleResultHandler =
|
143
144
|
typename BlockResultHandler::SingleResultHandler;
|
144
|
-
int nt = std::min(int(nx), omp_get_max_threads());
|
145
|
-
|
146
|
-
FAISS_ASSERT(use_sel == (sel != nullptr));
|
145
|
+
[[maybe_unused]] int nt = std::min(int(nx), omp_get_max_threads());
|
147
146
|
|
148
147
|
#pragma omp parallel num_threads(nt)
|
149
148
|
{
|
@@ -156,7 +155,7 @@ void exhaustive_inner_product_seq(
|
|
156
155
|
resi.begin(i);
|
157
156
|
|
158
157
|
for (size_t j = 0; j < ny; j++, y_j += d) {
|
159
|
-
if (
|
158
|
+
if (!res.is_in_selection(j)) {
|
160
159
|
continue;
|
161
160
|
}
|
162
161
|
float ip = fvec_inner_product(x_i, y_j, d);
|
@@ -167,20 +166,17 @@ void exhaustive_inner_product_seq(
|
|
167
166
|
}
|
168
167
|
}
|
169
168
|
|
170
|
-
template <class BlockResultHandler
|
169
|
+
template <class BlockResultHandler>
|
171
170
|
void exhaustive_L2sqr_seq(
|
172
171
|
const float* x,
|
173
172
|
const float* y,
|
174
173
|
size_t d,
|
175
174
|
size_t nx,
|
176
175
|
size_t ny,
|
177
|
-
BlockResultHandler& res
|
178
|
-
const IDSelector* sel = nullptr) {
|
176
|
+
BlockResultHandler& res) {
|
179
177
|
using SingleResultHandler =
|
180
178
|
typename BlockResultHandler::SingleResultHandler;
|
181
|
-
int nt = std::min(int(nx), omp_get_max_threads());
|
182
|
-
|
183
|
-
FAISS_ASSERT(use_sel == (sel != nullptr));
|
179
|
+
[[maybe_unused]] int nt = std::min(int(nx), omp_get_max_threads());
|
184
180
|
|
185
181
|
#pragma omp parallel num_threads(nt)
|
186
182
|
{
|
@@ -191,7 +187,7 @@ void exhaustive_L2sqr_seq(
|
|
191
187
|
const float* y_j = y;
|
192
188
|
resi.begin(i);
|
193
189
|
for (size_t j = 0; j < ny; j++, y_j += d) {
|
194
|
-
if (
|
190
|
+
if (!res.is_in_selection(j)) {
|
195
191
|
continue;
|
196
192
|
}
|
197
193
|
float disij = fvec_L2sqr(x_i, y_j, d);
|
@@ -326,6 +322,9 @@ void exhaustive_L2sqr_blas_default_impl(
|
|
326
322
|
float ip = *ip_line;
|
327
323
|
float dis = x_norms[i] + y_norms[j] - 2 * ip;
|
328
324
|
|
325
|
+
if (!res.is_in_selection(j)) {
|
326
|
+
dis = HUGE_VALF;
|
327
|
+
}
|
329
328
|
// negative values can occur for identical vectors
|
330
329
|
// due to roundoff errors
|
331
330
|
if (dis < 0)
|
@@ -560,6 +559,183 @@ void exhaustive_L2sqr_blas_cmax_avx2(
|
|
560
559
|
InterruptCallback::check();
|
561
560
|
}
|
562
561
|
}
|
562
|
+
#elif defined(__ARM_FEATURE_SVE)
|
563
|
+
void exhaustive_L2sqr_blas_cmax_sve(
|
564
|
+
const float* x,
|
565
|
+
const float* y,
|
566
|
+
size_t d,
|
567
|
+
size_t nx,
|
568
|
+
size_t ny,
|
569
|
+
Top1BlockResultHandler<CMax<float, int64_t>>& res,
|
570
|
+
const float* y_norms) {
|
571
|
+
// BLAS does not like empty matrices
|
572
|
+
if (nx == 0 || ny == 0)
|
573
|
+
return;
|
574
|
+
|
575
|
+
/* block sizes */
|
576
|
+
const size_t bs_x = distance_compute_blas_query_bs;
|
577
|
+
const size_t bs_y = distance_compute_blas_database_bs;
|
578
|
+
// const size_t bs_x = 16, bs_y = 16;
|
579
|
+
std::unique_ptr<float[]> ip_block(new float[bs_x * bs_y]);
|
580
|
+
std::unique_ptr<float[]> x_norms(new float[nx]);
|
581
|
+
std::unique_ptr<float[]> del2;
|
582
|
+
|
583
|
+
fvec_norms_L2sqr(x_norms.get(), x, d, nx);
|
584
|
+
|
585
|
+
const size_t lanes = svcntw();
|
586
|
+
|
587
|
+
if (!y_norms) {
|
588
|
+
float* y_norms2 = new float[ny];
|
589
|
+
del2.reset(y_norms2);
|
590
|
+
fvec_norms_L2sqr(y_norms2, y, d, ny);
|
591
|
+
y_norms = y_norms2;
|
592
|
+
}
|
593
|
+
|
594
|
+
for (size_t i0 = 0; i0 < nx; i0 += bs_x) {
|
595
|
+
size_t i1 = i0 + bs_x;
|
596
|
+
if (i1 > nx)
|
597
|
+
i1 = nx;
|
598
|
+
|
599
|
+
res.begin_multiple(i0, i1);
|
600
|
+
|
601
|
+
for (size_t j0 = 0; j0 < ny; j0 += bs_y) {
|
602
|
+
size_t j1 = j0 + bs_y;
|
603
|
+
if (j1 > ny)
|
604
|
+
j1 = ny;
|
605
|
+
/* compute the actual dot products */
|
606
|
+
{
|
607
|
+
float one = 1, zero = 0;
|
608
|
+
FINTEGER nyi = j1 - j0, nxi = i1 - i0, di = d;
|
609
|
+
sgemm_("Transpose",
|
610
|
+
"Not transpose",
|
611
|
+
&nyi,
|
612
|
+
&nxi,
|
613
|
+
&di,
|
614
|
+
&one,
|
615
|
+
y + j0 * d,
|
616
|
+
&di,
|
617
|
+
x + i0 * d,
|
618
|
+
&di,
|
619
|
+
&zero,
|
620
|
+
ip_block.get(),
|
621
|
+
&nyi);
|
622
|
+
}
|
623
|
+
#pragma omp parallel for
|
624
|
+
for (int64_t i = i0; i < i1; i++) {
|
625
|
+
const size_t count = j1 - j0;
|
626
|
+
float* ip_line = ip_block.get() + (i - i0) * count;
|
627
|
+
|
628
|
+
svprfw(svwhilelt_b32_u64(0, count), ip_line, SV_PLDL1KEEP);
|
629
|
+
svprfw(svwhilelt_b32_u64(lanes, count),
|
630
|
+
ip_line + lanes,
|
631
|
+
SV_PLDL1KEEP);
|
632
|
+
|
633
|
+
// Track lanes min distances + lanes min indices.
|
634
|
+
// All the distances tracked do not take x_norms[i]
|
635
|
+
// into account in order to get rid of extra
|
636
|
+
// vaddq_f32(x_norms[i], ...) instructions
|
637
|
+
// is distance computations.
|
638
|
+
auto min_distances = svdup_n_f32(res.dis_tab[i] - x_norms[i]);
|
639
|
+
|
640
|
+
// these indices are local and are relative to j0.
|
641
|
+
// so, value 0 means j0.
|
642
|
+
auto min_indices = svdup_n_u32(0u);
|
643
|
+
|
644
|
+
auto current_indices = svindex_u32(0u, 1u);
|
645
|
+
|
646
|
+
// process lanes * 2 elements per loop
|
647
|
+
for (size_t idx_j = 0; idx_j < count;
|
648
|
+
idx_j += lanes * 2, ip_line += lanes * 2) {
|
649
|
+
svprfw(svwhilelt_b32_u64(idx_j + lanes * 2, count),
|
650
|
+
ip_line + lanes * 2,
|
651
|
+
SV_PLDL1KEEP);
|
652
|
+
svprfw(svwhilelt_b32_u64(idx_j + lanes * 3, count),
|
653
|
+
ip_line + lanes * 3,
|
654
|
+
SV_PLDL1KEEP);
|
655
|
+
|
656
|
+
// mask
|
657
|
+
const auto mask_0 = svwhilelt_b32_u64(idx_j, count);
|
658
|
+
const auto mask_1 = svwhilelt_b32_u64(idx_j + lanes, count);
|
659
|
+
|
660
|
+
// load values for norms
|
661
|
+
const auto y_norm_0 =
|
662
|
+
svld1_f32(mask_0, y_norms + idx_j + j0 + 0);
|
663
|
+
const auto y_norm_1 =
|
664
|
+
svld1_f32(mask_1, y_norms + idx_j + j0 + lanes);
|
665
|
+
|
666
|
+
// load values for dot products
|
667
|
+
const auto ip_0 = svld1_f32(mask_0, ip_line + 0);
|
668
|
+
const auto ip_1 = svld1_f32(mask_1, ip_line + lanes);
|
669
|
+
|
670
|
+
// compute dis = y_norm[j] - 2 * dot(x_norm[i], y_norm[j]).
|
671
|
+
// x_norm[i] was dropped off because it is a constant for a
|
672
|
+
// given i. We'll deal with it later.
|
673
|
+
const auto distances_0 =
|
674
|
+
svmla_n_f32_z(mask_0, y_norm_0, ip_0, -2.f);
|
675
|
+
const auto distances_1 =
|
676
|
+
svmla_n_f32_z(mask_1, y_norm_1, ip_1, -2.f);
|
677
|
+
|
678
|
+
// compare the new distances to the min distances
|
679
|
+
// for each of the first group of 4 ARM SIMD components.
|
680
|
+
auto comparison =
|
681
|
+
svcmpgt_f32(mask_0, min_distances, distances_0);
|
682
|
+
|
683
|
+
// update min distances and indices with closest vectors if
|
684
|
+
// needed.
|
685
|
+
min_distances =
|
686
|
+
svsel_f32(comparison, distances_0, min_distances);
|
687
|
+
min_indices =
|
688
|
+
svsel_u32(comparison, current_indices, min_indices);
|
689
|
+
current_indices = svadd_n_u32_x(
|
690
|
+
mask_0,
|
691
|
+
current_indices,
|
692
|
+
static_cast<uint32_t>(lanes));
|
693
|
+
|
694
|
+
// compare the new distances to the min distances
|
695
|
+
// for each of the second group of 4 ARM SIMD components.
|
696
|
+
comparison =
|
697
|
+
svcmpgt_f32(mask_1, min_distances, distances_1);
|
698
|
+
|
699
|
+
// update min distances and indices with closest vectors if
|
700
|
+
// needed.
|
701
|
+
min_distances =
|
702
|
+
svsel_f32(comparison, distances_1, min_distances);
|
703
|
+
min_indices =
|
704
|
+
svsel_u32(comparison, current_indices, min_indices);
|
705
|
+
current_indices = svadd_n_u32_x(
|
706
|
+
mask_1,
|
707
|
+
current_indices,
|
708
|
+
static_cast<uint32_t>(lanes));
|
709
|
+
}
|
710
|
+
|
711
|
+
// add missing x_norms[i]
|
712
|
+
// negative values can occur for identical vectors
|
713
|
+
// due to roundoff errors.
|
714
|
+
auto mask = svwhilelt_b32_u64(0, count);
|
715
|
+
min_distances = svadd_n_f32_z(
|
716
|
+
svcmpge_n_f32(mask, min_distances, -x_norms[i]),
|
717
|
+
min_distances,
|
718
|
+
x_norms[i]);
|
719
|
+
min_indices = svadd_n_u32_x(
|
720
|
+
mask, min_indices, static_cast<uint32_t>(j0));
|
721
|
+
mask = svcmple_n_f32(mask, min_distances, res.dis_tab[i]);
|
722
|
+
if (svcntp_b32(svptrue_b32(), mask) == 0)
|
723
|
+
res.add_result(i, res.dis_tab[i], res.ids_tab[i]);
|
724
|
+
else {
|
725
|
+
const auto min_distance = svminv_f32(mask, min_distances);
|
726
|
+
const auto min_index = svminv_u32(
|
727
|
+
svcmpeq_n_f32(mask, min_distances, min_distance),
|
728
|
+
min_indices);
|
729
|
+
res.add_result(i, min_distance, min_index);
|
730
|
+
}
|
731
|
+
}
|
732
|
+
}
|
733
|
+
// Does nothing for SingleBestResultHandler, but
|
734
|
+
// keeping the call for the consistency.
|
735
|
+
res.end_multiple();
|
736
|
+
InterruptCallback::check();
|
737
|
+
}
|
738
|
+
}
|
563
739
|
#endif
|
564
740
|
|
565
741
|
// an override if only a single closest point is needed
|
@@ -582,6 +758,16 @@ void exhaustive_L2sqr_blas<Top1BlockResultHandler<CMax<float, int64_t>>>(
|
|
582
758
|
// run the specialized AVX2 implementation
|
583
759
|
exhaustive_L2sqr_blas_cmax_avx2(x, y, d, nx, ny, res, y_norms);
|
584
760
|
|
761
|
+
#elif defined(__ARM_FEATURE_SVE)
|
762
|
+
// use a faster fused kernel if available
|
763
|
+
if (exhaustive_L2sqr_fused_cmax(x, y, d, nx, ny, res, y_norms)) {
|
764
|
+
// the kernel is available and it is complete, we're done.
|
765
|
+
return;
|
766
|
+
}
|
767
|
+
|
768
|
+
// run the specialized SVE implementation
|
769
|
+
exhaustive_L2sqr_blas_cmax_sve(x, y, d, nx, ny, res, y_norms);
|
770
|
+
|
585
771
|
#elif defined(__aarch64__)
|
586
772
|
// use a faster fused kernel if available
|
587
773
|
if (exhaustive_L2sqr_fused_cmax(x, y, d, nx, ny, res, y_norms)) {
|
@@ -601,44 +787,40 @@ void exhaustive_L2sqr_blas<Top1BlockResultHandler<CMax<float, int64_t>>>(
|
|
601
787
|
#endif
|
602
788
|
}
|
603
789
|
|
604
|
-
|
605
|
-
void
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
exhaustive_L2sqr_seq(x, y, d, nx, ny, res);
|
619
|
-
} else {
|
620
|
-
exhaustive_L2sqr_blas(x, y, d, nx, ny, res, y_norm2);
|
790
|
+
struct Run_search_inner_product {
|
791
|
+
using T = void;
|
792
|
+
template <class BlockResultHandler>
|
793
|
+
void f(BlockResultHandler& res,
|
794
|
+
const float* x,
|
795
|
+
const float* y,
|
796
|
+
size_t d,
|
797
|
+
size_t nx,
|
798
|
+
size_t ny) {
|
799
|
+
if (res.sel || nx < distance_compute_blas_threshold) {
|
800
|
+
exhaustive_inner_product_seq(x, y, d, nx, ny, res);
|
801
|
+
} else {
|
802
|
+
exhaustive_inner_product_blas(x, y, d, nx, ny, res);
|
803
|
+
}
|
621
804
|
}
|
622
|
-
}
|
623
|
-
|
624
|
-
|
625
|
-
void
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
exhaustive_inner_product_blas(x, y, d, nx, ny, res);
|
805
|
+
};
|
806
|
+
|
807
|
+
struct Run_search_L2sqr {
|
808
|
+
using T = void;
|
809
|
+
template <class BlockResultHandler>
|
810
|
+
void f(BlockResultHandler& res,
|
811
|
+
const float* x,
|
812
|
+
const float* y,
|
813
|
+
size_t d,
|
814
|
+
size_t nx,
|
815
|
+
size_t ny,
|
816
|
+
const float* y_norm2) {
|
817
|
+
if (res.sel || nx < distance_compute_blas_threshold) {
|
818
|
+
exhaustive_L2sqr_seq(x, y, d, nx, ny, res);
|
819
|
+
} else {
|
820
|
+
exhaustive_L2sqr_blas(x, y, d, nx, ny, res, y_norm2);
|
821
|
+
}
|
640
822
|
}
|
641
|
-
}
|
823
|
+
};
|
642
824
|
|
643
825
|
} // anonymous namespace
|
644
826
|
|
@@ -675,16 +857,9 @@ void knn_inner_product(
|
|
675
857
|
return;
|
676
858
|
}
|
677
859
|
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
} else if (k < distance_compute_min_k_reservoir) {
|
682
|
-
HeapBlockResultHandler<CMin<float, int64_t>> res(nx, vals, ids, k);
|
683
|
-
knn_inner_product_select(x, y, d, nx, ny, res, sel);
|
684
|
-
} else {
|
685
|
-
ReservoirBlockResultHandler<CMin<float, int64_t>> res(nx, vals, ids, k);
|
686
|
-
knn_inner_product_select(x, y, d, nx, ny, res, sel);
|
687
|
-
}
|
860
|
+
Run_search_inner_product r;
|
861
|
+
dispatch_knn_ResultHandler(
|
862
|
+
nx, vals, ids, k, METRIC_INNER_PRODUCT, sel, r, x, y, d, nx, ny);
|
688
863
|
|
689
864
|
if (imin != 0) {
|
690
865
|
for (size_t i = 0; i < nx * k; i++) {
|
@@ -730,16 +905,11 @@ void knn_L2sqr(
|
|
730
905
|
knn_L2sqr_by_idx(x, y, sela->ids, d, nx, ny, sela->n, k, vals, ids, 0);
|
731
906
|
return;
|
732
907
|
}
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
knn_L2sqr_select(x, y, d, nx, ny, res, y_norm2, sel);
|
739
|
-
} else {
|
740
|
-
ReservoirBlockResultHandler<CMax<float, int64_t>> res(nx, vals, ids, k);
|
741
|
-
knn_L2sqr_select(x, y, d, nx, ny, res, y_norm2, sel);
|
742
|
-
}
|
908
|
+
|
909
|
+
Run_search_L2sqr r;
|
910
|
+
dispatch_knn_ResultHandler(
|
911
|
+
nx, vals, ids, k, METRIC_L2, sel, r, x, y, d, nx, ny, y_norm2);
|
912
|
+
|
743
913
|
if (imin != 0) {
|
744
914
|
for (size_t i = 0; i < nx * k; i++) {
|
745
915
|
if (ids[i] >= 0) {
|
@@ -766,6 +936,7 @@ void knn_L2sqr(
|
|
766
936
|
* Range search
|
767
937
|
***************************************************************************/
|
768
938
|
|
939
|
+
// TODO accept a y_norm2 as well
|
769
940
|
void range_search_L2sqr(
|
770
941
|
const float* x,
|
771
942
|
const float* y,
|
@@ -775,15 +946,9 @@ void range_search_L2sqr(
|
|
775
946
|
float radius,
|
776
947
|
RangeSearchResult* res,
|
777
948
|
const IDSelector* sel) {
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
exhaustive_L2sqr_seq<RH, true>(x, y, d, nx, ny, resh, sel);
|
782
|
-
} else if (nx < distance_compute_blas_threshold) {
|
783
|
-
exhaustive_L2sqr_seq(x, y, d, nx, ny, resh, sel);
|
784
|
-
} else {
|
785
|
-
exhaustive_L2sqr_blas(x, y, d, nx, ny, resh);
|
786
|
-
}
|
949
|
+
Run_search_L2sqr r;
|
950
|
+
dispatch_range_ResultHandler(
|
951
|
+
res, radius, METRIC_L2, sel, r, x, y, d, nx, ny, nullptr);
|
787
952
|
}
|
788
953
|
|
789
954
|
void range_search_inner_product(
|
@@ -795,15 +960,9 @@ void range_search_inner_product(
|
|
795
960
|
float radius,
|
796
961
|
RangeSearchResult* res,
|
797
962
|
const IDSelector* sel) {
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
exhaustive_inner_product_seq<RH, true>(x, y, d, nx, ny, resh, sel);
|
802
|
-
} else if (nx < distance_compute_blas_threshold) {
|
803
|
-
exhaustive_inner_product_seq(x, y, d, nx, ny, resh);
|
804
|
-
} else {
|
805
|
-
exhaustive_inner_product_blas(x, y, d, nx, ny, resh);
|
806
|
-
}
|
963
|
+
Run_search_inner_product r;
|
964
|
+
dispatch_range_ResultHandler(
|
965
|
+
res, radius, METRIC_INNER_PRODUCT, sel, r, x, y, d, nx, ny);
|
807
966
|
}
|
808
967
|
|
809
968
|
/***************************************************************************
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
* Copyright (c)
|
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.
|
@@ -285,7 +285,7 @@ FAISS_API extern int distance_compute_blas_database_bs;
|
|
285
285
|
// rather than a heap
|
286
286
|
FAISS_API extern int distance_compute_min_k_reservoir;
|
287
287
|
|
288
|
-
/** Return the k nearest
|
288
|
+
/** Return the k nearest neighbors of each of the nx vectors x among the ny
|
289
289
|
* vector y, w.r.t to max inner product.
|
290
290
|
*
|
291
291
|
* @param x query vectors, size nx * d
|
@@ -301,7 +301,7 @@ void knn_inner_product(
|
|
301
301
|
float_minheap_array_t* res,
|
302
302
|
const IDSelector* sel = nullptr);
|
303
303
|
|
304
|
-
/** Return the k nearest
|
304
|
+
/** Return the k nearest neighbors of each of the nx vectors x among the ny
|
305
305
|
* vector y, for the inner product metric.
|
306
306
|
*
|
307
307
|
* @param x query vectors, size nx * d
|
@@ -320,7 +320,7 @@ void knn_inner_product(
|
|
320
320
|
int64_t* indexes,
|
321
321
|
const IDSelector* sel = nullptr);
|
322
322
|
|
323
|
-
/** Return the k nearest
|
323
|
+
/** Return the k nearest neighbors of each of the nx vectors x among the ny
|
324
324
|
* vector y, for the L2 distance
|
325
325
|
* @param x query vectors, size nx * d
|
326
326
|
* @param y database vectors, size ny * d
|
@@ -338,7 +338,7 @@ void knn_L2sqr(
|
|
338
338
|
const float* y_norm2 = nullptr,
|
339
339
|
const IDSelector* sel = nullptr);
|
340
340
|
|
341
|
-
/** Return the k nearest
|
341
|
+
/** Return the k nearest neighbors of each of the nx vectors x among the ny
|
342
342
|
* vector y, for the L2 distance
|
343
343
|
*
|
344
344
|
* @param x query vectors, size nx * d
|
@@ -413,7 +413,7 @@ void knn_L2sqr_by_idx(
|
|
413
413
|
/// Forward declaration, see AuxIndexStructures.h
|
414
414
|
struct RangeSearchResult;
|
415
415
|
|
416
|
-
/** Return the k nearest
|
416
|
+
/** Return the k nearest neighbors of each of the nx vectors x among the ny
|
417
417
|
* vector y, w.r.t to max inner product
|
418
418
|
*
|
419
419
|
* @param x query vectors, size nx * d
|
@@ -469,7 +469,7 @@ void compute_PQ_dis_tables_dsub2(
|
|
469
469
|
* @param n size of the tables
|
470
470
|
* @param a size n
|
471
471
|
* @param b size n
|
472
|
-
* @param c
|
472
|
+
* @param c result table, size n
|
473
473
|
*/
|
474
474
|
void fvec_madd(size_t n, const float* a, float bf, const float* b, float* c);
|
475
475
|
|