faiss 0.4.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57303540dbb2c3de9e0d34e8a3ffcbb7c31ed44bb71ece9cafeb8de80594660d
4
- data.tar.gz: 31c77390c331a0622c230bb245751ab3799196b0918f542fb4ba49b7582f28c9
3
+ metadata.gz: 94cc2ecdeb397dfce274b08f07006ec7d6d13290f4149d8fca0b9d1a3f2312c6
4
+ data.tar.gz: a32b28f7bc57f9bad918b0411855617951ce8013af7f1ca9dfc72978f5eb1f78
5
5
  SHA512:
6
- metadata.gz: 2879d2d866bf10d1dc745841b5047933f43d9e84003b8b3c49a9ac5862be48c9fae31d042d2b39f2aaf188e1f110aa1ffd05b050c0f6510a35670724f890652c
7
- data.tar.gz: 92dcbf603c5fab0b5f3fadfe377b91ec92e40840d91169cabb86f7c32d87f3b611937f4ad2423fe76abdc787af418de02bd23467a78a9b15633dd06a3c9d8187
6
+ metadata.gz: 317786c14bbd6803a8abd506881e7072dbd8bfaacce3968c8c26705de45f1840177f5fb3ce189b464e5f1bbffd07a277d6f454a977e1e2aef72bdfb7d7cd04a7
7
+ data.tar.gz: 4de11b05b094b18beaa0326e5d4bf2d7a71c1928b7bd7d12f28f430f7b40b023c6c7b7a4da73f74bc39b0be44c85677113597cf6b60ae4029a96bd11a41f706c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.4.1 (2025-06-18)
2
+
3
+ - Fixed error with Rice 4.6
4
+
1
5
  ## 0.4.0 (2025-04-25)
2
6
 
3
7
  - Updated Faiss to 1.11.0
data/ext/faiss/ext.cpp CHANGED
@@ -1,4 +1,4 @@
1
- #include "utils.h"
1
+ #include <rice/rice.hpp>
2
2
 
3
3
  void init_index(Rice::Module& m);
4
4
  void init_index_binary(Rice::Module& m);
@@ -7,8 +7,7 @@ void init_pca_matrix(Rice::Module& m);
7
7
  void init_product_quantizer(Rice::Module& m);
8
8
 
9
9
  extern "C"
10
- void Init_ext()
11
- {
10
+ void Init_ext() {
12
11
  auto m = Rice::define_module("Faiss");
13
12
 
14
13
  init_index(m);
data/ext/faiss/index.cpp CHANGED
@@ -1,3 +1,6 @@
1
+ #include <string>
2
+
3
+ #include <faiss/AutoTune.h>
1
4
  #include <faiss/Index.h>
2
5
  #include <faiss/IndexFlat.h>
3
6
  #include <faiss/IndexHNSW.h>
@@ -9,20 +12,20 @@
9
12
  #include <faiss/IndexIVFPQ.h>
10
13
  #include <faiss/IndexIVFPQR.h>
11
14
  #include <faiss/index_io.h>
12
- #include <faiss/AutoTune.h>
15
+ #include <rice/rice.hpp>
16
+ #include <rice/stl.hpp>
13
17
 
18
+ #include "numo.hpp"
14
19
  #include "utils.h"
15
20
 
16
21
  namespace Rice::detail {
17
22
  template<>
18
- struct Type<faiss::MetricType>
19
- {
23
+ struct Type<faiss::MetricType> {
20
24
  static bool verify() { return true; }
21
25
  };
22
26
 
23
27
  template<>
24
- class From_Ruby<faiss::MetricType>
25
- {
28
+ class From_Ruby<faiss::MetricType> {
26
29
  public:
27
30
  From_Ruby() = default;
28
31
 
@@ -30,8 +33,7 @@ namespace Rice::detail {
30
33
 
31
34
  Convertible is_convertible(VALUE value) { return Convertible::Cast; }
32
35
 
33
- faiss::MetricType convert(VALUE x)
34
- {
36
+ faiss::MetricType convert(VALUE x) {
35
37
  if (x == Qnil && this->arg_ && this->arg_->hasDefaultValue()) {
36
38
  return this->arg_->defaultValue<faiss::MetricType>();
37
39
  }
@@ -51,19 +53,16 @@ namespace Rice::detail {
51
53
  };
52
54
 
53
55
  template<>
54
- struct Type<faiss::ScalarQuantizer::QuantizerType>
55
- {
56
+ struct Type<faiss::ScalarQuantizer::QuantizerType> {
56
57
  static bool verify() { return true; }
57
58
  };
58
59
 
59
60
  template<>
60
- class From_Ruby<faiss::ScalarQuantizer::QuantizerType>
61
- {
61
+ class From_Ruby<faiss::ScalarQuantizer::QuantizerType> {
62
62
  public:
63
63
  Convertible is_convertible(VALUE value) { return Convertible::Cast; }
64
64
 
65
- faiss::ScalarQuantizer::QuantizerType convert(VALUE x)
66
- {
65
+ faiss::ScalarQuantizer::QuantizerType convert(VALUE x) {
67
66
  auto s = Object(x).to_s().str();
68
67
  if (s == "qt_8bit") {
69
68
  return faiss::ScalarQuantizer::QT_8bit;
@@ -84,7 +83,7 @@ namespace Rice::detail {
84
83
  }
85
84
  }
86
85
  };
87
- }
86
+ } // namespace Rice::detail
88
87
 
89
88
  void init_index(Rice::Module& m) {
90
89
  Rice::define_class_under<faiss::Index>(m, "Index")
@@ -3,7 +3,9 @@
3
3
  #include <faiss/IndexBinaryIVF.h>
4
4
  #include <faiss/index_factory.h>
5
5
  #include <faiss/index_io.h>
6
+ #include <rice/rice.hpp>
6
7
 
8
+ #include "numo.hpp"
7
9
  #include "utils.h"
8
10
 
9
11
  void init_index_binary(Rice::Module& m) {
data/ext/faiss/kmeans.cpp CHANGED
@@ -1,6 +1,8 @@
1
1
  #include <faiss/Clustering.h>
2
2
  #include <faiss/IndexFlat.h>
3
+ #include <rice/rice.hpp>
3
4
 
5
+ #include "numo.hpp"
4
6
  #include "utils.h"
5
7
 
6
8
  void init_kmeans(Rice::Module& m) {
@@ -1,5 +1,7 @@
1
1
  #include <faiss/VectorTransform.h>
2
+ #include <rice/rice.hpp>
2
3
 
4
+ #include "numo.hpp"
3
5
  #include "utils.h"
4
6
 
5
7
  void init_pca_matrix(Rice::Module& m) {
@@ -1,6 +1,8 @@
1
1
  #include <faiss/impl/ProductQuantizer.h>
2
2
  #include <faiss/index_io.h>
3
+ #include <rice/rice.hpp>
3
4
 
5
+ #include "numo.hpp"
4
6
  #include "utils.h"
5
7
 
6
8
  void init_product_quantizer(Rice::Module& m) {
data/ext/faiss/utils.cpp CHANGED
@@ -1,3 +1,6 @@
1
+ #include <rice/rice.hpp>
2
+
3
+ #include "numo.hpp"
1
4
  #include "utils.h"
2
5
 
3
6
  size_t check_shape(const numo::NArray& objects, size_t k) {
data/lib/faiss/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Faiss
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane