annoy-rb 0.7.0 → 0.7.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 +4 -4
 - data/CHANGELOG.md +4 -0
 - data/ext/annoy/annoyext.hpp +6 -6
 - data/lib/annoy/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d1f1b7326f096ef01be709b819e6fcac709776e5561d931b8b8a5b022aed1dc2
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e767849b0970773b1c01307b830d6bbf15c250d86a4716d809867dc0cf8f211d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: da4627d3414ed6ba062a3fb5d9ba546a32dced3e11d42ab4756badc219c29813b9d5389cbcb2159c027ad9a3b43c58f23f0f19660836c557d12c2c1b2a37330f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f195b96f9010a67ccc01088006a09e1ec5f857e7226f3d6b7c58a9ab5205757365061bbd1eb571715bfcd24a8f47c00e6aea7fcc1d7024f8cb6e511b7cb37255
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/ext/annoy/annoyext.hpp
    CHANGED
    
    | 
         @@ -111,7 +111,7 @@ private: 
     | 
|
| 
       111 
111 
     | 
    
         | 
| 
       112 
112 
     | 
    
         
             
                F* vec = (F*)ruby_xmalloc(n_dims * sizeof(F));
         
     | 
| 
       113 
113 
     | 
    
         
             
                for (int i = 0; i < n_dims; i++) {
         
     | 
| 
       114 
     | 
    
         
            -
                  vec[i] = typeid(F) == typeid( 
     | 
| 
      
 114 
     | 
    
         
            +
                  vec[i] = (F)(typeid(F) == typeid(uint64_t) ? NUM2UINT(rb_ary_entry(arr, i)) : NUM2DBL(rb_ary_entry(arr, i)));
         
     | 
| 
       115 
115 
     | 
    
         
             
                }
         
     | 
| 
       116 
116 
     | 
    
         | 
| 
       117 
117 
     | 
    
         
             
                char* error;
         
     | 
| 
         @@ -195,7 +195,7 @@ private: 
     | 
|
| 
       195 
195 
     | 
    
         
             
                  const int sz_distances = distances.size();
         
     | 
| 
       196 
196 
     | 
    
         
             
                  VALUE distances_arr = rb_ary_new2(sz_distances);
         
     | 
| 
       197 
197 
     | 
    
         
             
                  for (int i = 0; i < sz_distances; i++) {
         
     | 
| 
       198 
     | 
    
         
            -
                    rb_ary_store(distances_arr, i, typeid(F) == typeid( 
     | 
| 
      
 198 
     | 
    
         
            +
                    rb_ary_store(distances_arr, i, typeid(F) == typeid(uint64_t) ? UINT2NUM(distances[i]) : DBL2NUM(distances[i]));
         
     | 
| 
       199 
199 
     | 
    
         
             
                  }
         
     | 
| 
       200 
200 
     | 
    
         
             
                  VALUE res = rb_ary_new2(2);
         
     | 
| 
       201 
201 
     | 
    
         
             
                  rb_ary_store(res, 0, neighbors_arr);
         
     | 
| 
         @@ -222,7 +222,7 @@ private: 
     | 
|
| 
       222 
222 
     | 
    
         | 
| 
       223 
223 
     | 
    
         
             
                F* vec = (F*)ruby_xmalloc(n_dims * sizeof(F));
         
     | 
| 
       224 
224 
     | 
    
         
             
                for (int i = 0; i < n_dims; i++) {
         
     | 
| 
       225 
     | 
    
         
            -
                  vec[i] = typeid(F) == typeid( 
     | 
| 
      
 225 
     | 
    
         
            +
                  vec[i] = (F)(typeid(F) == typeid(uint64_t) ? NUM2UINT(rb_ary_entry(_vec, i)) : NUM2DBL(rb_ary_entry(_vec, i)));
         
     | 
| 
       226 
226 
     | 
    
         
             
                }
         
     | 
| 
       227 
227 
     | 
    
         | 
| 
       228 
228 
     | 
    
         
             
                const int n_neighbors = NUM2INT(_n_neighbors);
         
     | 
| 
         @@ -246,7 +246,7 @@ private: 
     | 
|
| 
       246 
246 
     | 
    
         
             
                  const int sz_distances = distances.size();
         
     | 
| 
       247 
247 
     | 
    
         
             
                  VALUE distances_arr = rb_ary_new2(sz_distances);
         
     | 
| 
       248 
248 
     | 
    
         
             
                  for (int i = 0; i < sz_distances; i++) {
         
     | 
| 
       249 
     | 
    
         
            -
                    rb_ary_store(distances_arr, i, typeid(F) == typeid( 
     | 
| 
      
 249 
     | 
    
         
            +
                    rb_ary_store(distances_arr, i, typeid(F) == typeid(uint64_t) ? UINT2NUM(distances[i]) : DBL2NUM(distances[i]));
         
     | 
| 
       250 
250 
     | 
    
         
             
                  }
         
     | 
| 
       251 
251 
     | 
    
         
             
                  VALUE res = rb_ary_new2(2);
         
     | 
| 
       252 
252 
     | 
    
         
             
                  rb_ary_store(res, 0, neighbors_arr);
         
     | 
| 
         @@ -266,7 +266,7 @@ private: 
     | 
|
| 
       266 
266 
     | 
    
         
             
                get_annoy_index(self)->get_item(idx, vec);
         
     | 
| 
       267 
267 
     | 
    
         | 
| 
       268 
268 
     | 
    
         
             
                for (int i = 0; i < n_dims; i++) {
         
     | 
| 
       269 
     | 
    
         
            -
                  rb_ary_store(arr, i, typeid(F) == typeid( 
     | 
| 
      
 269 
     | 
    
         
            +
                  rb_ary_store(arr, i, typeid(F) == typeid(uint64_t) ? UINT2NUM(vec[i]) : DBL2NUM(vec[i]));
         
     | 
| 
       270 
270 
     | 
    
         
             
                }
         
     | 
| 
       271 
271 
     | 
    
         | 
| 
       272 
272 
     | 
    
         
             
                ruby_xfree(vec);
         
     | 
| 
         @@ -277,7 +277,7 @@ private: 
     | 
|
| 
       277 
277 
     | 
    
         
             
                const int32_t i = (int32_t)NUM2INT(_i);
         
     | 
| 
       278 
278 
     | 
    
         
             
                const int32_t j = (int32_t)NUM2INT(_j);
         
     | 
| 
       279 
279 
     | 
    
         
             
                const F dist = get_annoy_index(self)->get_distance(i, j);
         
     | 
| 
       280 
     | 
    
         
            -
                return typeid(F) == typeid( 
     | 
| 
      
 280 
     | 
    
         
            +
                return typeid(F) == typeid(uint64_t) ? UINT2NUM(dist) : DBL2NUM(dist);
         
     | 
| 
       281 
281 
     | 
    
         
             
              };
         
     | 
| 
       282 
282 
     | 
    
         | 
| 
       283 
283 
     | 
    
         
             
              static VALUE _annoy_index_get_n_items(VALUE self) {
         
     | 
    
        data/lib/annoy/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: annoy-rb
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.7. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.7.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - yoshoku
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-09-30 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: Annoy.rb provides Ruby bindings for the Annoy (Approximate Nearest Neighbors
         
     | 
| 
       14 
14 
     | 
    
         
             
              Oh Yeah).
         
     |