hnswlib 0.3.0 → 0.4.0

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: 7823039ef0a73f79011cbbb4dd8bb90f56549d82c93cee311725a2e728ab8809
4
- data.tar.gz: be1846136d1d87c63d3aa49c404f9148c8d04d8c0ba4af65d6297096b5683150
3
+ metadata.gz: 99f5f1403a51083df75ef842a11b996fe6c159f95c3798f217a076cb5f535254
4
+ data.tar.gz: f9972ac4e644727a126e937e81494cc11bc051bc7ff0daf57139845aed1e7719
5
5
  SHA512:
6
- metadata.gz: 5ddd709e8bd403b959c7ab8bc21b17b6e264da0976a2d85a4acd7edeb057b7771d53fac337d3a6dfdd2718dcd499efd2b0f8633170241dd01269cd34753be10a
7
- data.tar.gz: 11fd6ee5ca94949665fa30a106e926283c9e190030b47b6b001b0fd755ff5512f8b913b02bb79f1b51cb851c50867d0dca1a861fb2f09b6805e4d0b74bb033b5
6
+ metadata.gz: c4f96fceab228e3cffd9f2b77e513b86fe71ec3156cdff10c0bc9206ad7951f87c507531088f91f45a940c399102bff6a2dedc5fee8b09b37a5f5739e9a02b6c
7
+ data.tar.gz: 8297e1e0d1f6753b3e8900b07b80dba271276a14303b102cd8084e480ec491da269baac1fc8be08ab350976fc22cb859583745dc219d73d6f56b33fe7502ac2b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.4.0] - 2021-09-12
2
+
3
+ - Add type declaration file.
4
+
1
5
  ## [0.3.0] - 2021-08-08
2
6
 
3
7
  - Rename `Hnswlib::Index` to `Hnswlib::HnswIndex` (for compatibility, `Hnswlib::Index` has been an alis for `Hnswlib::HnswIndex`).
data/Gemfile CHANGED
@@ -8,3 +8,5 @@ gemspec
8
8
  gem 'rake', '~> 13.0'
9
9
  gem 'rake-compiler', '~> 1.1'
10
10
  gem 'rspec', '~> 3.0'
11
+ gem 'rbs', '~> 1.2'
12
+ gem 'steep', '~> 0.44'
data/Steepfile ADDED
@@ -0,0 +1,27 @@
1
+ # D = Steep::Diagnostic
2
+ #
3
+ target :lib do
4
+ signature "sig"
5
+ #
6
+ check "lib" # Directory name
7
+ # check "Gemfile" # File name
8
+ # check "app/models/**/*.rb" # Glob
9
+ # # ignore "lib/templates/*.rb"
10
+ #
11
+ # # library "pathname", "set" # Standard libraries
12
+ # # library "strong_json" # Gems
13
+ #
14
+ # # configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
15
+ # # configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
16
+ # # configure_code_diagnostics do |hash| # You can setup everything yourself
17
+ # # hash[D::Ruby::NoMethod] = :information
18
+ # # end
19
+ end
20
+
21
+ # target :test do
22
+ # signature "sig", "sig-private"
23
+ #
24
+ # check "test"
25
+ #
26
+ # # library "pathname", "set" # Standard libraries
27
+ # end
@@ -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.3.0'
6
+ VERSION = '0.4.0'
7
7
 
8
8
  # The version of Hnswlib included with gem.
9
9
  HSWLIB_VERSION = '0.5.2'
data/sig/hnswlib.rbs ADDED
@@ -0,0 +1,69 @@
1
+ module Hnswlib
2
+ VERSION: ::String
3
+ HSWLIB_VERSION: ::String
4
+
5
+ class HnswIndex
6
+ attr_reader metric: String
7
+
8
+ def initialize: (n_features: Integer n_features, max_item: Integer max_item, ?metric: ::String metric, ?m: ::Integer m, ?ef_construction: ::Integer ef_construction, ?random_seed: ::Integer random_seed) -> void
9
+ def add_item: (Integer i, Array[Float] v) -> bool
10
+ def get_item: (Integer i) -> Array[Float]
11
+ def remove_item: (Integer i) -> void
12
+ def get_nns_by_item: (Integer i, Integer n, ?include_distances: (true | false) include_distances) -> ([Array[Integer], Array[Float]] | Array[Integer])
13
+ def get_nns_by_vector: (Array[Float] v, Integer n, ?include_distances: (true | false) include_distances) -> ([Array[Integer], Array[Float]] | Array[Integer])
14
+ def resize_index: (Integer new_max_item) -> void
15
+ def set_ef: (Integer ef) -> void
16
+ def save: (String filename) -> void
17
+ def load: (String filename) -> void
18
+ def get_distance: (Integer i, Integer j) -> Float
19
+ def n_items: () -> Integer
20
+ def n_features: () -> Integer
21
+ def max_item: () -> Integer
22
+ end
23
+
24
+ Index: untyped
25
+
26
+ class L2Space
27
+ attr_accessor dim: Integer
28
+
29
+ def initialize: (Integer dim) -> void
30
+ def distance: (Array[Float] a, Array[Float] b) -> Float
31
+ end
32
+
33
+ class InnerProductSpace
34
+ attr_accessor dim: Integer
35
+
36
+ def initialize: (Integer dim) -> void
37
+ def distance: (Array[Float] a, Array[Float] b) -> Float
38
+ end
39
+
40
+ class BruteforceSearch
41
+ attr_accessor space: (::Hnswlib::L2Space | ::Hnswlib::InnerProductSpace)
42
+
43
+ def initialize: (space: (::Hnswlib::L2Space | ::Hnswlib::InnerProductSpace) space, max_elements: Integer max_elements) -> void
44
+ def add_point: (Array[Float] arr, Integer idx) -> bool
45
+ def current_count: () -> Integer
46
+ def load_index: (String filename) -> void
47
+ def max_elements: () -> Integer
48
+ def remove_point: (Integer idx) -> void
49
+ def save_index: (String filename) -> void
50
+ def search_knn: (Array[Float] arr, Integer k) -> [Array[Integer], Array[Float]]
51
+ end
52
+
53
+ class HierarchicalNSW
54
+ attr_accessor space: (::Hnswlib::L2Space | ::Hnswlib::InnerProductSpace)
55
+
56
+ def initialize: (space: (::Hnswlib::L2Space | ::Hnswlib::InnerProductSpace) space, max_elements: Integer max_elements, ?m: Integer m, ?ef_construction: Integer ef_construction, ?random_seed: Integer random_seed) -> void
57
+ def add_point: (Array[Float] arr, Integer idx) -> bool
58
+ def current_count: () -> Integer
59
+ def get_ids: () -> Array[Integer]
60
+ def get_point: (Integer idx) -> Array[Float]
61
+ def load_index: (String filename) -> void
62
+ def mark_deleted: (Integer idx) -> void
63
+ def max_elements: () -> Integer
64
+ def resize_index: (Integer new_max_elements) -> void
65
+ def save_index: (String filename) -> void
66
+ def search_knn: (Array[Float] arr, Integer k) -> [Array[Integer], Array[Float]]
67
+ def set_ef: (Integer ef) -> void
68
+ end
69
+ end
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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-08 00:00:00.000000000 Z
11
+ date: 2021-09-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Hnswlib.rb provides Ruby bindings for the Hnswlib.
14
14
  email:
@@ -27,6 +27,7 @@ files:
27
27
  - LICENSE.txt
28
28
  - README.md
29
29
  - Rakefile
30
+ - Steepfile
30
31
  - ext/hnswlib/extconf.rb
31
32
  - ext/hnswlib/hnswlibext.cpp
32
33
  - ext/hnswlib/hnswlibext.hpp
@@ -40,6 +41,7 @@ files:
40
41
  - hnswlib.gemspec
41
42
  - lib/hnswlib.rb
42
43
  - lib/hnswlib/version.rb
44
+ - sig/hnswlib.rbs
43
45
  homepage: https://github.com/yoshoku/hnswlib.rb
44
46
  licenses:
45
47
  - Apache-2.0