ngt 0.1.0 → 0.1.1

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: 967a8b449269b1d56539e294015f925791ca960a8bfe622aeff171d0d3170069
4
- data.tar.gz: 2bc6884f36fe47ddf06cfcc6850dbd3b31d1b2044a11e477ea0684a72d325145
3
+ metadata.gz: d97bd9eb8a0db31ece99f2ad749e00b9b46ae5929f4d4be4863aae7f68bc2167
4
+ data.tar.gz: 64bef298d58ed4e5c8c7215d7bc19e7b918b51a2f83113277da3a8c7d08080a4
5
5
  SHA512:
6
- metadata.gz: 399e1cb7a347da8ef610ff394fbd84f73d29edc9408563327bb1a58877c9cb5e255394417642fe84a08e4ee09b15083dc7a789a30192ae3ce25474a6b4211a23
7
- data.tar.gz: 92b97b7a9d32bf85bf016e81b83fea70f9292a5fda829f4e1433ca8402b9e1c0f7f48b91279898a80e4bbe61ca91e913e83e4805740939a179d85790d618daa0
6
+ metadata.gz: 1ef9696c68b051f1f225cdb2bcdce06859ea4d6321382a0702e4c32915d3d347caa4d4a697b54ada8f1956602b158f0f5bcb2006561052d0e9b0acd2962fc68c
7
+ data.tar.gz: f6f027ec3f216660482323bb44a822f8bcca59ff5e0bf35ce3f27dbb7331e933bf700de73a20a0094790f758fc5b3a946378ec8b8ad69444b472bbf6a9a9a21d
@@ -1,3 +1,7 @@
1
+ ## 0.1.1
2
+
3
+ - Fixed `unable to resolve type 'uint32_t'` error on Ubuntu
4
+
1
5
  ## 0.1.0
2
6
 
3
7
  - First release
data/README.md CHANGED
@@ -2,9 +2,15 @@
2
2
 
3
3
  [NGT](https://github.com/yahoojapan/NGT) - high-speed approximate nearest neighbors - for Ruby
4
4
 
5
+ [![Build Status](https://travis-ci.org/ankane/ngt.svg?branch=master)](https://travis-ci.org/ankane/ngt)
6
+
5
7
  ## Installation
6
8
 
7
- First, [install NGT](https://github.com/yahoojapan/NGT/blob/master/README.md#Installation).
9
+ First, [install NGT](https://github.com/yahoojapan/NGT/blob/master/README.md#Installation). For Homebrew, use:
10
+
11
+ ```sh
12
+ brew install ngt
13
+ ```
8
14
 
9
15
  Add this line to your application’s Gemfile:
10
16
 
@@ -51,7 +57,7 @@ index.save
51
57
  Load an index
52
58
 
53
59
  ```ruby
54
- Ngt::Index.new(path)
60
+ index = Ngt::Index.new(path)
55
61
  ```
56
62
 
57
63
  Get an object by id
@@ -96,8 +102,7 @@ result = index.search(query, size: 3)
96
102
 
97
103
  result.each do |res|
98
104
  puts "#{res[:id]}, #{res[:distance]}"
99
- object = index.object(res[:id])
100
- p object
105
+ p index.object(res[:id])
101
106
  end
102
107
  ```
103
108
 
@@ -12,6 +12,9 @@ module Ngt
12
12
  # https://github.com/yahoojapan/NGT/blob/master/lib/NGT/Capi.h
13
13
  # keep same order
14
14
 
15
+ # use uint32 instead of uint32_t
16
+ # to prevent "unable to resolve type" error on Ubuntu
17
+
15
18
  class ObjectDistance < ::FFI::Struct
16
19
  layout :id, :int,
17
20
  :distance, :float
@@ -36,15 +39,15 @@ module Ngt
36
39
  attach_function :ngt_set_property_distance_type_hamming, %i[pointer pointer], :bool
37
40
  attach_function :ngt_set_property_distance_type_jaccard, %i[pointer pointer], :bool
38
41
  attach_function :ngt_set_property_distance_type_cosine, %i[pointer pointer], :bool
39
- attach_function :ngt_batch_insert_index, %i[pointer pointer uint32_t pointer pointer], :bool
40
- attach_function :ngt_create_index, %i[pointer uint32_t pointer], :bool
42
+ attach_function :ngt_batch_insert_index, %i[pointer pointer uint32 pointer pointer], :bool
43
+ attach_function :ngt_create_index, %i[pointer uint32 pointer], :bool
41
44
  attach_function :ngt_remove_index, %i[pointer int pointer], :bool
42
- attach_function :ngt_insert_index, %i[pointer pointer uint32_t pointer], :int
43
- attach_function :ngt_insert_index_as_float, %i[pointer pointer uint32_t pointer], :int
45
+ attach_function :ngt_insert_index, %i[pointer pointer uint32 pointer], :int
46
+ attach_function :ngt_insert_index_as_float, %i[pointer pointer uint32 pointer], :int
44
47
  attach_function :ngt_create_empty_results, %i[pointer], :pointer
45
- attach_function :ngt_search_index, %i[pointer pointer int32_t size_t float float pointer pointer], :bool
46
- attach_function :ngt_get_result_size, %i[pointer pointer], :uint32_t
47
- attach_function :ngt_get_result, %i[pointer uint32_t pointer], ObjectDistance.by_value
48
+ attach_function :ngt_search_index, %i[pointer pointer int32 size_t float float pointer pointer], :bool
49
+ attach_function :ngt_get_result_size, %i[pointer pointer], :uint32
50
+ attach_function :ngt_get_result, %i[pointer uint32 pointer], ObjectDistance.by_value
48
51
  attach_function :ngt_get_object_space, %i[pointer pointer], :pointer
49
52
  attach_function :ngt_get_object_as_float, %i[pointer int pointer], :pointer
50
53
  attach_function :ngt_get_object_as_integer, %i[pointer int pointer], :pointer
@@ -29,7 +29,7 @@ module Ngt
29
29
  obj = ::FFI::MemoryPointer.new(:float, flat_objects.size)
30
30
  obj.write_array_of_float(flat_objects)
31
31
 
32
- ids = ::FFI::MemoryPointer.new(:uint32_t, objects.size)
32
+ ids = ::FFI::MemoryPointer.new(:uint32, objects.size)
33
33
  ffi(:ngt_batch_insert_index, @index, obj, objects.size, ids)
34
34
 
35
35
  build_index(num_threads: num_threads)
@@ -1,3 +1,3 @@
1
1
  module Ngt
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ngt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-22 00:00:00.000000000 Z
11
+ date: 2019-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi