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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -0
- data/Steepfile +27 -0
- data/lib/hnswlib/version.rb +1 -1
- data/sig/hnswlib.rbs +69 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99f5f1403a51083df75ef842a11b996fe6c159f95c3798f217a076cb5f535254
|
4
|
+
data.tar.gz: f9972ac4e644727a126e937e81494cc11bc051bc7ff0daf57139845aed1e7719
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4f96fceab228e3cffd9f2b77e513b86fe71ec3156cdff10c0bc9206ad7951f87c507531088f91f45a940c399102bff6a2dedc5fee8b09b37a5f5739e9a02b6c
|
7
|
+
data.tar.gz: 8297e1e0d1f6753b3e8900b07b80dba271276a14303b102cd8084e480ec491da269baac1fc8be08ab350976fc22cb859583745dc219d73d6f56b33fe7502ac2b
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
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
|
data/lib/hnswlib/version.rb
CHANGED
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.
|
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-
|
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
|