faiss 0.5.1 → 0.5.2
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 +4 -0
- data/ext/faiss/index.cpp +8 -9
- data/ext/faiss/numo.hpp +31 -31
- data/lib/faiss/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8ab397b95262fa87d28a4f08098de35f487b44e6240682ec8e98c4efc823c4df
|
|
4
|
+
data.tar.gz: 719490d3f20bad4531f588e9469d3fa9ec2362cc18f800e913725ffb6b0aeca0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56e16fad10a1ba95c9727f2e356470e984ca29b44406cf125b1ab529c83fee2c9bf15efa564a543cda331489dbdc56c9c44f4eda4ad53178979370987b6fbf9e
|
|
7
|
+
data.tar.gz: 691e9a843eaac7e699dafc15d5505f6febf783ae6d474ee0409cb01d1b1f1575477db13cb7290a4d2cc639692503099fa7d4ff767d3c3034838d05ea0476521a
|
data/CHANGELOG.md
CHANGED
data/ext/faiss/index.cpp
CHANGED
|
@@ -31,13 +31,9 @@ namespace Rice::detail {
|
|
|
31
31
|
|
|
32
32
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
double is_convertible(VALUE value) { return Convertible::Exact; }
|
|
35
35
|
|
|
36
36
|
faiss::MetricType convert(VALUE x) {
|
|
37
|
-
if (x == Qnil && this->arg_ && this->arg_->hasDefaultValue()) {
|
|
38
|
-
return this->arg_->defaultValue<faiss::MetricType>();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
37
|
auto s = Object(x).to_s().str();
|
|
42
38
|
if (s == "inner_product") {
|
|
43
39
|
return faiss::METRIC_INNER_PRODUCT;
|
|
@@ -64,7 +60,7 @@ namespace Rice::detail {
|
|
|
64
60
|
|
|
65
61
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
66
62
|
|
|
67
|
-
|
|
63
|
+
double is_convertible(VALUE value) { return Convertible::Exact; }
|
|
68
64
|
|
|
69
65
|
faiss::ScalarQuantizer::QuantizerType convert(VALUE x) {
|
|
70
66
|
auto s = Object(x).to_s().str();
|
|
@@ -195,10 +191,12 @@ void init_index(Rice::Module& m) {
|
|
|
195
191
|
.define_constructor(Rice::Constructor<faiss::IndexFlatIP, int64_t>());
|
|
196
192
|
|
|
197
193
|
Rice::define_class_under<faiss::IndexHNSWFlat, faiss::Index>(m, "IndexHNSWFlat")
|
|
198
|
-
.define_constructor(Rice::Constructor<faiss::IndexHNSWFlat, int, int
|
|
194
|
+
.define_constructor(Rice::Constructor<faiss::IndexHNSWFlat, int, int>())
|
|
195
|
+
.define_constructor(Rice::Constructor<faiss::IndexHNSWFlat, int, int, faiss::MetricType>());
|
|
199
196
|
|
|
200
197
|
Rice::define_class_under<faiss::IndexIVFFlat, faiss::Index>(m, "IndexIVFFlat")
|
|
201
|
-
.define_constructor(Rice::Constructor<faiss::IndexIVFFlat, faiss::Index*, size_t, size_t
|
|
198
|
+
.define_constructor(Rice::Constructor<faiss::IndexIVFFlat, faiss::Index*, size_t, size_t>())
|
|
199
|
+
.define_constructor(Rice::Constructor<faiss::IndexIVFFlat, faiss::Index*, size_t, size_t, faiss::MetricType>());
|
|
202
200
|
|
|
203
201
|
Rice::define_class_under<faiss::IndexLSH, faiss::Index>(m, "IndexLSH")
|
|
204
202
|
.define_constructor(Rice::Constructor<faiss::IndexLSH, int64_t, int>());
|
|
@@ -213,7 +211,8 @@ void init_index(Rice::Module& m) {
|
|
|
213
211
|
.define_constructor(Rice::Constructor<faiss::IndexIVFScalarQuantizer, faiss::Index*, size_t, size_t, faiss::ScalarQuantizer::QuantizerType>());
|
|
214
212
|
|
|
215
213
|
Rice::define_class_under<faiss::IndexIVFPQ, faiss::Index>(m, "IndexIVFPQ")
|
|
216
|
-
.define_constructor(Rice::Constructor<faiss::IndexIVFPQ, faiss::Index*, size_t, size_t, size_t, size_t
|
|
214
|
+
.define_constructor(Rice::Constructor<faiss::IndexIVFPQ, faiss::Index*, size_t, size_t, size_t, size_t>())
|
|
215
|
+
.define_constructor(Rice::Constructor<faiss::IndexIVFPQ, faiss::Index*, size_t, size_t, size_t, size_t, faiss::MetricType>());
|
|
217
216
|
|
|
218
217
|
Rice::define_class_under<faiss::IndexIVFPQR, faiss::Index>(m, "IndexIVFPQR")
|
|
219
218
|
.define_constructor(Rice::Constructor<faiss::IndexIVFPQR, faiss::Index*, size_t, size_t, size_t, size_t, size_t, size_t>());
|
data/ext/faiss/numo.hpp
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Numo.hpp v0.
|
|
2
|
+
* Numo.hpp v0.3.0
|
|
3
3
|
* https://github.com/ankane/numo.hpp
|
|
4
4
|
* BSD-2-Clause License
|
|
5
5
|
*/
|
|
@@ -460,12 +460,12 @@ public:
|
|
|
460
460
|
|
|
461
461
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
462
462
|
|
|
463
|
-
|
|
463
|
+
double is_convertible(VALUE value) {
|
|
464
464
|
switch (rb_type(value)) {
|
|
465
465
|
case RUBY_T_DATA:
|
|
466
466
|
return Data_Type<numo::NArray>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
467
467
|
case RUBY_T_ARRAY:
|
|
468
|
-
return Convertible::
|
|
468
|
+
return Convertible::Exact;
|
|
469
469
|
default:
|
|
470
470
|
return Convertible::None;
|
|
471
471
|
}
|
|
@@ -506,12 +506,12 @@ public:
|
|
|
506
506
|
|
|
507
507
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
508
508
|
|
|
509
|
-
|
|
509
|
+
double is_convertible(VALUE value) {
|
|
510
510
|
switch (rb_type(value)) {
|
|
511
511
|
case RUBY_T_DATA:
|
|
512
512
|
return Data_Type<numo::SFloat>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
513
513
|
case RUBY_T_ARRAY:
|
|
514
|
-
return Convertible::
|
|
514
|
+
return Convertible::Exact;
|
|
515
515
|
default:
|
|
516
516
|
return Convertible::None;
|
|
517
517
|
}
|
|
@@ -552,12 +552,12 @@ public:
|
|
|
552
552
|
|
|
553
553
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
554
554
|
|
|
555
|
-
|
|
555
|
+
double is_convertible(VALUE value) {
|
|
556
556
|
switch (rb_type(value)) {
|
|
557
557
|
case RUBY_T_DATA:
|
|
558
558
|
return Data_Type<numo::DFloat>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
559
559
|
case RUBY_T_ARRAY:
|
|
560
|
-
return Convertible::
|
|
560
|
+
return Convertible::Exact;
|
|
561
561
|
default:
|
|
562
562
|
return Convertible::None;
|
|
563
563
|
}
|
|
@@ -598,12 +598,12 @@ public:
|
|
|
598
598
|
|
|
599
599
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
600
600
|
|
|
601
|
-
|
|
601
|
+
double is_convertible(VALUE value) {
|
|
602
602
|
switch (rb_type(value)) {
|
|
603
603
|
case RUBY_T_DATA:
|
|
604
604
|
return Data_Type<numo::Int8>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
605
605
|
case RUBY_T_ARRAY:
|
|
606
|
-
return Convertible::
|
|
606
|
+
return Convertible::Exact;
|
|
607
607
|
default:
|
|
608
608
|
return Convertible::None;
|
|
609
609
|
}
|
|
@@ -644,12 +644,12 @@ public:
|
|
|
644
644
|
|
|
645
645
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
646
646
|
|
|
647
|
-
|
|
647
|
+
double is_convertible(VALUE value) {
|
|
648
648
|
switch (rb_type(value)) {
|
|
649
649
|
case RUBY_T_DATA:
|
|
650
650
|
return Data_Type<numo::Int16>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
651
651
|
case RUBY_T_ARRAY:
|
|
652
|
-
return Convertible::
|
|
652
|
+
return Convertible::Exact;
|
|
653
653
|
default:
|
|
654
654
|
return Convertible::None;
|
|
655
655
|
}
|
|
@@ -690,12 +690,12 @@ public:
|
|
|
690
690
|
|
|
691
691
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
692
692
|
|
|
693
|
-
|
|
693
|
+
double is_convertible(VALUE value) {
|
|
694
694
|
switch (rb_type(value)) {
|
|
695
695
|
case RUBY_T_DATA:
|
|
696
696
|
return Data_Type<numo::Int32>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
697
697
|
case RUBY_T_ARRAY:
|
|
698
|
-
return Convertible::
|
|
698
|
+
return Convertible::Exact;
|
|
699
699
|
default:
|
|
700
700
|
return Convertible::None;
|
|
701
701
|
}
|
|
@@ -736,12 +736,12 @@ public:
|
|
|
736
736
|
|
|
737
737
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
738
738
|
|
|
739
|
-
|
|
739
|
+
double is_convertible(VALUE value) {
|
|
740
740
|
switch (rb_type(value)) {
|
|
741
741
|
case RUBY_T_DATA:
|
|
742
742
|
return Data_Type<numo::Int64>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
743
743
|
case RUBY_T_ARRAY:
|
|
744
|
-
return Convertible::
|
|
744
|
+
return Convertible::Exact;
|
|
745
745
|
default:
|
|
746
746
|
return Convertible::None;
|
|
747
747
|
}
|
|
@@ -782,12 +782,12 @@ public:
|
|
|
782
782
|
|
|
783
783
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
784
784
|
|
|
785
|
-
|
|
785
|
+
double is_convertible(VALUE value) {
|
|
786
786
|
switch (rb_type(value)) {
|
|
787
787
|
case RUBY_T_DATA:
|
|
788
788
|
return Data_Type<numo::UInt8>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
789
789
|
case RUBY_T_ARRAY:
|
|
790
|
-
return Convertible::
|
|
790
|
+
return Convertible::Exact;
|
|
791
791
|
default:
|
|
792
792
|
return Convertible::None;
|
|
793
793
|
}
|
|
@@ -828,12 +828,12 @@ public:
|
|
|
828
828
|
|
|
829
829
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
830
830
|
|
|
831
|
-
|
|
831
|
+
double is_convertible(VALUE value) {
|
|
832
832
|
switch (rb_type(value)) {
|
|
833
833
|
case RUBY_T_DATA:
|
|
834
834
|
return Data_Type<numo::UInt16>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
835
835
|
case RUBY_T_ARRAY:
|
|
836
|
-
return Convertible::
|
|
836
|
+
return Convertible::Exact;
|
|
837
837
|
default:
|
|
838
838
|
return Convertible::None;
|
|
839
839
|
}
|
|
@@ -874,12 +874,12 @@ public:
|
|
|
874
874
|
|
|
875
875
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
876
876
|
|
|
877
|
-
|
|
877
|
+
double is_convertible(VALUE value) {
|
|
878
878
|
switch (rb_type(value)) {
|
|
879
879
|
case RUBY_T_DATA:
|
|
880
880
|
return Data_Type<numo::UInt32>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
881
881
|
case RUBY_T_ARRAY:
|
|
882
|
-
return Convertible::
|
|
882
|
+
return Convertible::Exact;
|
|
883
883
|
default:
|
|
884
884
|
return Convertible::None;
|
|
885
885
|
}
|
|
@@ -920,12 +920,12 @@ public:
|
|
|
920
920
|
|
|
921
921
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
922
922
|
|
|
923
|
-
|
|
923
|
+
double is_convertible(VALUE value) {
|
|
924
924
|
switch (rb_type(value)) {
|
|
925
925
|
case RUBY_T_DATA:
|
|
926
926
|
return Data_Type<numo::UInt64>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
927
927
|
case RUBY_T_ARRAY:
|
|
928
|
-
return Convertible::
|
|
928
|
+
return Convertible::Exact;
|
|
929
929
|
default:
|
|
930
930
|
return Convertible::None;
|
|
931
931
|
}
|
|
@@ -966,12 +966,12 @@ public:
|
|
|
966
966
|
|
|
967
967
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
968
968
|
|
|
969
|
-
|
|
969
|
+
double is_convertible(VALUE value) {
|
|
970
970
|
switch (rb_type(value)) {
|
|
971
971
|
case RUBY_T_DATA:
|
|
972
972
|
return Data_Type<numo::SComplex>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
973
973
|
case RUBY_T_ARRAY:
|
|
974
|
-
return Convertible::
|
|
974
|
+
return Convertible::Exact;
|
|
975
975
|
default:
|
|
976
976
|
return Convertible::None;
|
|
977
977
|
}
|
|
@@ -1012,12 +1012,12 @@ public:
|
|
|
1012
1012
|
|
|
1013
1013
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
1014
1014
|
|
|
1015
|
-
|
|
1015
|
+
double is_convertible(VALUE value) {
|
|
1016
1016
|
switch (rb_type(value)) {
|
|
1017
1017
|
case RUBY_T_DATA:
|
|
1018
1018
|
return Data_Type<numo::DComplex>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
1019
1019
|
case RUBY_T_ARRAY:
|
|
1020
|
-
return Convertible::
|
|
1020
|
+
return Convertible::Exact;
|
|
1021
1021
|
default:
|
|
1022
1022
|
return Convertible::None;
|
|
1023
1023
|
}
|
|
@@ -1058,12 +1058,12 @@ public:
|
|
|
1058
1058
|
|
|
1059
1059
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
1060
1060
|
|
|
1061
|
-
|
|
1061
|
+
double is_convertible(VALUE value) {
|
|
1062
1062
|
switch (rb_type(value)) {
|
|
1063
1063
|
case RUBY_T_DATA:
|
|
1064
1064
|
return Data_Type<numo::Bit>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
1065
1065
|
case RUBY_T_ARRAY:
|
|
1066
|
-
return Convertible::
|
|
1066
|
+
return Convertible::Exact;
|
|
1067
1067
|
default:
|
|
1068
1068
|
return Convertible::None;
|
|
1069
1069
|
}
|
|
@@ -1104,12 +1104,12 @@ public:
|
|
|
1104
1104
|
|
|
1105
1105
|
explicit From_Ruby(Arg* arg) : arg_(arg) { }
|
|
1106
1106
|
|
|
1107
|
-
|
|
1107
|
+
double is_convertible(VALUE value) {
|
|
1108
1108
|
switch (rb_type(value)) {
|
|
1109
1109
|
case RUBY_T_DATA:
|
|
1110
1110
|
return Data_Type<numo::RObject>::is_descendant(value) ? Convertible::Exact : Convertible::None;
|
|
1111
1111
|
case RUBY_T_ARRAY:
|
|
1112
|
-
return Convertible::
|
|
1112
|
+
return Convertible::Exact;
|
|
1113
1113
|
default:
|
|
1114
1114
|
return Convertible::None;
|
|
1115
1115
|
}
|
data/lib/faiss/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: faiss
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '4.
|
|
18
|
+
version: '4.8'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '4.
|
|
25
|
+
version: '4.8'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: numo-narray
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -407,7 +407,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
407
407
|
- !ruby/object:Gem::Version
|
|
408
408
|
version: '0'
|
|
409
409
|
requirements: []
|
|
410
|
-
rubygems_version:
|
|
410
|
+
rubygems_version: 4.0.3
|
|
411
411
|
specification_version: 4
|
|
412
412
|
summary: Efficient similarity search and clustering for Ruby
|
|
413
413
|
test_files: []
|