hnswlib 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 293c9038e57db28357f77c753988b593ef921a2d8caf7234f4a547547580f2cb
4
- data.tar.gz: 668eba08220e29d970f886b91382a335834ac746d9a208d9add986f2ff21fbfc
3
+ metadata.gz: fc8a40172623a3439b17c8b1854017c845bf4dc23f4e1714e9427e4b6b701c9b
4
+ data.tar.gz: 95fa48d791f000bf48809e7067efaba9a654ab0dd517c626f689c66af3668d0e
5
5
  SHA512:
6
- metadata.gz: 1a748a2d3f8291453221b60b55f184b152f56aa35ec5a0830d7b6c6f82adb90e09d757737f0b0527e3404f30c61d7da7f8567c1a7d087045fada991e6152a333
7
- data.tar.gz: 4f5fbf6a8b14e4179862f3e9030bf8e08fa971e874e518141261e2f83942fdb96b68217adcb0dbd2a26b12b5684ef7b645fd7b7fa8025b03fc6e08694a14d9c9
6
+ metadata.gz: 07c449031cc7afbf80803ae15c8094589a146b59b1852ea72e88fcd39067def572bbdd58277e3a85c47c537e8dc6eef645f9f404a2b874e4e217b559adc38054
7
+ data.tar.gz: 4b71a7f4fe0ffb3c15124e32c9c8fbba9eb6f82e6f0b95f5d91dd35c6b10be8aeba25d7313eabeaa5078b051b3410195415843ecd600b58ec1b0b36532b7ae1d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.6.2] - 2022-06-25
2
+
3
+ - Refactor codes and configs with RuboCop and clang-format.
4
+ - Change to raise ArgumentError when non-array object is given to distance method.
5
+
1
6
  ## [0.6.1] - 2022-04-30
2
7
 
3
8
  - Change the `search_knn` method of `BruteforceSearch` to output warning message instead of rasing RuntimeError
@@ -20,8 +20,7 @@
20
20
 
21
21
  VALUE rb_mHnswlib;
22
22
 
23
- extern "C"
24
- void Init_hnswlibext(void) {
23
+ extern "C" void Init_hnswlibext(void) {
25
24
  rb_mHnswlib = rb_define_module("Hnswlib");
26
25
  RbHnswlibL2Space::define_class(rb_mHnswlib);
27
26
  RbHnswlibInnerProductSpace::define_class(rb_mHnswlib);
@@ -70,6 +70,10 @@ private:
70
70
 
71
71
  static VALUE _hnsw_l2space_distance(VALUE self, VALUE arr_a, VALUE arr_b) {
72
72
  const int dim = NUM2INT(rb_iv_get(self, "@dim"));
73
+ if (!RB_TYPE_P(arr_a, T_ARRAY) || !RB_TYPE_P(arr_b, T_ARRAY)) {
74
+ rb_raise(rb_eArgError, "Expect input vector to be Ruby Array.");
75
+ return Qnil;
76
+ }
73
77
  if (dim != RARRAY_LEN(arr_a) || dim != RARRAY_LEN(arr_b)) {
74
78
  rb_raise(rb_eArgError, "Array size does not match to space dimensionality.");
75
79
  return Qnil;
@@ -142,6 +146,10 @@ private:
142
146
 
143
147
  static VALUE _hnsw_ipspace_distance(VALUE self, VALUE arr_a, VALUE arr_b) {
144
148
  const int dim = NUM2INT(rb_iv_get(self, "@dim"));
149
+ if (!RB_TYPE_P(arr_a, T_ARRAY) || !RB_TYPE_P(arr_b, T_ARRAY)) {
150
+ rb_raise(rb_eArgError, "Expect input vector to be Ruby Array.");
151
+ return Qnil;
152
+ }
145
153
  if (dim != RARRAY_LEN(arr_a) || dim != RARRAY_LEN(arr_b)) {
146
154
  rb_raise(rb_eArgError, "Array size does not match to space dimensionality.");
147
155
  return Qnil;
@@ -3,7 +3,7 @@
3
3
  # Hnswlib.rb provides Ruby bindings for the Hnswlib.
4
4
  module Hnswlib
5
5
  # The version of Hnswlib.rb you install.
6
- VERSION = '0.6.1'
6
+ VERSION = '0.6.2'
7
7
 
8
8
  # The version of Hnswlib included with gem.
9
9
  HSWLIB_VERSION = '0.6.2'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hnswlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-30 00:00:00.000000000 Z
11
+ date: 2022-06-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Hnswlib.rb provides Ruby bindings for the Hnswlib.
14
14
  email:
@@ -41,6 +41,7 @@ metadata:
41
41
  homepage_uri: https://github.com/yoshoku/hnswlib.rb
42
42
  source_code_uri: https://github.com/yoshoku/hnswlib.rb
43
43
  changelog_uri: https://github.com/yoshoku/hnswlib.rb/blob/main/CHANGELOG.md
44
+ rubygems_mfa_required: 'true'
44
45
  post_install_message:
45
46
  rdoc_options: []
46
47
  require_paths:
@@ -56,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
57
  - !ruby/object:Gem::Version
57
58
  version: '0'
58
59
  requirements: []
59
- rubygems_version: 3.3.7
60
+ rubygems_version: 3.2.33
60
61
  signing_key:
61
62
  specification_version: 4
62
63
  summary: Ruby bindings for the Hnswlib.