faiss 0.3.3 → 0.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/ext/faiss/extconf.rb +1 -1
- data/ext/faiss/index.cpp +10 -14
- data/ext/faiss/numo.hpp +957 -833
- data/lib/faiss/version.rb +1 -1
- data/vendor/faiss/faiss/AutoTune.cpp +11 -8
- data/vendor/faiss/faiss/Clustering.cpp +0 -16
- data/vendor/faiss/faiss/IVFlib.cpp +213 -0
- data/vendor/faiss/faiss/IVFlib.h +42 -0
- data/vendor/faiss/faiss/Index.h +1 -1
- data/vendor/faiss/faiss/IndexBinaryFlat.cpp +9 -7
- data/vendor/faiss/faiss/IndexBinaryFlat.h +2 -1
- data/vendor/faiss/faiss/IndexFlatCodes.cpp +1 -1
- data/vendor/faiss/faiss/IndexFlatCodes.h +4 -2
- data/vendor/faiss/faiss/IndexHNSW.cpp +13 -20
- data/vendor/faiss/faiss/IndexHNSW.h +1 -1
- data/vendor/faiss/faiss/IndexIVF.cpp +20 -3
- data/vendor/faiss/faiss/IndexIVF.h +5 -2
- data/vendor/faiss/faiss/IndexIVFAdditiveQuantizer.cpp +2 -1
- data/vendor/faiss/faiss/IndexIVFAdditiveQuantizer.h +2 -1
- data/vendor/faiss/faiss/IndexIVFFlat.cpp +2 -1
- data/vendor/faiss/faiss/IndexIVFFlat.h +2 -1
- data/vendor/faiss/faiss/IndexIVFPQ.cpp +2 -1
- data/vendor/faiss/faiss/IndexIVFPQ.h +2 -1
- data/vendor/faiss/faiss/IndexIVFRaBitQ.cpp +277 -0
- data/vendor/faiss/faiss/IndexIVFRaBitQ.h +70 -0
- data/vendor/faiss/faiss/IndexIVFSpectralHash.cpp +2 -1
- data/vendor/faiss/faiss/IndexIVFSpectralHash.h +2 -1
- data/vendor/faiss/faiss/IndexRaBitQ.cpp +148 -0
- data/vendor/faiss/faiss/IndexRaBitQ.h +65 -0
- data/vendor/faiss/faiss/IndexScalarQuantizer.cpp +2 -1
- data/vendor/faiss/faiss/IndexScalarQuantizer.h +2 -1
- data/vendor/faiss/faiss/clone_index.cpp +38 -3
- data/vendor/faiss/faiss/cppcontrib/factory_tools.cpp +19 -0
- data/vendor/faiss/faiss/cppcontrib/factory_tools.h +4 -11
- data/vendor/faiss/faiss/gpu/GpuAutoTune.cpp +2 -1
- data/vendor/faiss/faiss/gpu/GpuIndexCagra.h +13 -3
- data/vendor/faiss/faiss/gpu/StandardGpuResources.cpp +1 -1
- data/vendor/faiss/faiss/gpu/StandardGpuResources.h +1 -1
- data/vendor/faiss/faiss/gpu/test/TestGpuIcmEncoder.cpp +112 -0
- data/vendor/faiss/faiss/impl/HNSW.cpp +35 -13
- data/vendor/faiss/faiss/impl/HNSW.h +5 -4
- data/vendor/faiss/faiss/impl/NNDescent.cpp +1 -1
- data/vendor/faiss/faiss/impl/RaBitQuantizer.cpp +519 -0
- data/vendor/faiss/faiss/impl/RaBitQuantizer.h +78 -0
- data/vendor/faiss/faiss/impl/ResultHandler.h +2 -2
- data/vendor/faiss/faiss/impl/code_distance/code_distance-sve.h +3 -4
- data/vendor/faiss/faiss/impl/index_read.cpp +220 -25
- data/vendor/faiss/faiss/impl/index_write.cpp +29 -0
- data/vendor/faiss/faiss/impl/io.h +2 -2
- data/vendor/faiss/faiss/impl/io_macros.h +2 -0
- data/vendor/faiss/faiss/impl/mapped_io.cpp +313 -0
- data/vendor/faiss/faiss/impl/mapped_io.h +51 -0
- data/vendor/faiss/faiss/impl/maybe_owned_vector.h +316 -0
- data/vendor/faiss/faiss/impl/platform_macros.h +7 -3
- data/vendor/faiss/faiss/impl/simd_result_handlers.h +1 -1
- data/vendor/faiss/faiss/impl/zerocopy_io.cpp +67 -0
- data/vendor/faiss/faiss/impl/zerocopy_io.h +32 -0
- data/vendor/faiss/faiss/index_factory.cpp +16 -5
- data/vendor/faiss/faiss/index_io.h +4 -0
- data/vendor/faiss/faiss/invlists/InvertedLists.cpp +3 -3
- data/vendor/faiss/faiss/invlists/InvertedLists.h +5 -3
- data/vendor/faiss/faiss/invlists/InvertedListsIOHook.cpp +3 -3
- data/vendor/faiss/faiss/python/python_callbacks.cpp +24 -0
- data/vendor/faiss/faiss/python/python_callbacks.h +22 -0
- data/vendor/faiss/faiss/utils/approx_topk_hamming/approx_topk_hamming.h +30 -12
- data/vendor/faiss/faiss/utils/hamming.cpp +45 -21
- data/vendor/faiss/faiss/utils/hamming.h +7 -3
- data/vendor/faiss/faiss/utils/hamming_distance/avx512-inl.h +1 -1
- data/vendor/faiss/faiss/utils/utils.cpp +4 -4
- data/vendor/faiss/faiss/utils/utils.h +3 -3
- metadata +18 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57303540dbb2c3de9e0d34e8a3ffcbb7c31ed44bb71ece9cafeb8de80594660d
|
4
|
+
data.tar.gz: 31c77390c331a0622c230bb245751ab3799196b0918f542fb4ba49b7582f28c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2879d2d866bf10d1dc745841b5047933f43d9e84003b8b3c49a9ac5862be48c9fae31d042d2b39f2aaf188e1f110aa1ffd05b050c0f6510a35670724f890652c
|
7
|
+
data.tar.gz: 92dcbf603c5fab0b5f3fadfe377b91ec92e40840d91169cabb86f7c32d87f3b611937f4ad2423fe76abdc787af418de02bd23467a78a9b15633dd06a3c9d8187
|
data/CHANGELOG.md
CHANGED
data/ext/faiss/extconf.rb
CHANGED
@@ -20,7 +20,7 @@ abort "Numo not found" unless find_header("numo/narray.h", numo)
|
|
20
20
|
$LDFLAGS += " -Wl,-undefined,dynamic_lookup" if RbConfig::CONFIG["host_os"] =~ /darwin/i
|
21
21
|
|
22
22
|
$CXXFLAGS += " -std=c++17 $(optflags) -DFINTEGER=int"
|
23
|
-
$CXXFLAGS += " -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wno-deprecated-declarations -Wno-sign-compare"
|
23
|
+
$CXXFLAGS += " -Wall -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wno-unused-private-field -Wno-deprecated-declarations -Wno-sign-compare"
|
24
24
|
|
25
25
|
# -march=native not supported with ARM Mac
|
26
26
|
default_optflags = RbConfig::CONFIG["host_os"] =~ /darwin/i && RbConfig::CONFIG["host_cpu"] =~ /arm|aarch64/i ? "" : " -march=native"
|
data/ext/faiss/index.cpp
CHANGED
@@ -17,10 +17,7 @@ namespace Rice::detail {
|
|
17
17
|
template<>
|
18
18
|
struct Type<faiss::MetricType>
|
19
19
|
{
|
20
|
-
static bool verify()
|
21
|
-
{
|
22
|
-
return true;
|
23
|
-
}
|
20
|
+
static bool verify() { return true; }
|
24
21
|
};
|
25
22
|
|
26
23
|
template<>
|
@@ -29,9 +26,9 @@ namespace Rice::detail {
|
|
29
26
|
public:
|
30
27
|
From_Ruby() = default;
|
31
28
|
|
32
|
-
From_Ruby(Arg* arg) : arg_(arg)
|
33
|
-
|
34
|
-
}
|
29
|
+
From_Ruby(Arg* arg) : arg_(arg) {}
|
30
|
+
|
31
|
+
Convertible is_convertible(VALUE value) { return Convertible::Cast; }
|
35
32
|
|
36
33
|
faiss::MetricType convert(VALUE x)
|
37
34
|
{
|
@@ -56,16 +53,15 @@ namespace Rice::detail {
|
|
56
53
|
template<>
|
57
54
|
struct Type<faiss::ScalarQuantizer::QuantizerType>
|
58
55
|
{
|
59
|
-
static bool verify()
|
60
|
-
{
|
61
|
-
return true;
|
62
|
-
}
|
56
|
+
static bool verify() { return true; }
|
63
57
|
};
|
64
58
|
|
65
59
|
template<>
|
66
60
|
class From_Ruby<faiss::ScalarQuantizer::QuantizerType>
|
67
61
|
{
|
68
62
|
public:
|
63
|
+
Convertible is_convertible(VALUE value) { return Convertible::Cast; }
|
64
|
+
|
69
65
|
faiss::ScalarQuantizer::QuantizerType convert(VALUE x)
|
70
66
|
{
|
71
67
|
auto s = Object(x).to_s().str();
|
@@ -166,10 +162,10 @@ void init_index(Rice::Module& m) {
|
|
166
162
|
.define_constructor(Rice::Constructor<faiss::IndexFlatIP, int64_t>());
|
167
163
|
|
168
164
|
Rice::define_class_under<faiss::IndexHNSWFlat, faiss::Index>(m, "IndexHNSWFlat")
|
169
|
-
.define_constructor(Rice::Constructor<faiss::IndexHNSWFlat, int, int, faiss::MetricType>(), Rice::Arg("
|
165
|
+
.define_constructor(Rice::Constructor<faiss::IndexHNSWFlat, int, int, faiss::MetricType>(), Rice::Arg("_d"), Rice::Arg("_M"), Rice::Arg("_metric") = faiss::METRIC_L2);
|
170
166
|
|
171
167
|
Rice::define_class_under<faiss::IndexIVFFlat, faiss::Index>(m, "IndexIVFFlat")
|
172
|
-
.define_constructor(Rice::Constructor<faiss::IndexIVFFlat, faiss::Index*, size_t, size_t, faiss::MetricType>(), Rice::Arg("
|
168
|
+
.define_constructor(Rice::Constructor<faiss::IndexIVFFlat, faiss::Index*, size_t, size_t, faiss::MetricType>(), Rice::Arg("_quantizer"), Rice::Arg("_d"), Rice::Arg("_nlist"), Rice::Arg("_metric") = faiss::METRIC_L2);
|
173
169
|
|
174
170
|
Rice::define_class_under<faiss::IndexLSH, faiss::Index>(m, "IndexLSH")
|
175
171
|
.define_constructor(Rice::Constructor<faiss::IndexLSH, int64_t, int>());
|
@@ -184,7 +180,7 @@ void init_index(Rice::Module& m) {
|
|
184
180
|
.define_constructor(Rice::Constructor<faiss::IndexIVFScalarQuantizer, faiss::Index*, size_t, size_t, faiss::ScalarQuantizer::QuantizerType>());
|
185
181
|
|
186
182
|
Rice::define_class_under<faiss::IndexIVFPQ, faiss::Index>(m, "IndexIVFPQ")
|
187
|
-
.define_constructor(Rice::Constructor<faiss::IndexIVFPQ, faiss::Index*, size_t, size_t, size_t, size_t, faiss::MetricType>(), Rice::Arg("
|
183
|
+
.define_constructor(Rice::Constructor<faiss::IndexIVFPQ, faiss::Index*, size_t, size_t, size_t, size_t, faiss::MetricType>(), Rice::Arg("_quantizer"), Rice::Arg("_d"), Rice::Arg("_nlist"), Rice::Arg("_M"), Rice::Arg("_nbits_per_idx"), Rice::Arg("_metric") = faiss::METRIC_L2);
|
188
184
|
|
189
185
|
Rice::define_class_under<faiss::IndexIVFPQR, faiss::Index>(m, "IndexIVFPQR")
|
190
186
|
.define_constructor(Rice::Constructor<faiss::IndexIVFPQR, faiss::Index*, size_t, size_t, size_t, size_t, size_t, size_t>());
|