faiss 0.2.5 → 0.2.6

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: bdc2effbe6e2d827ffe473531be0864cf710ae6f3ad34f8324087695c367d140
4
- data.tar.gz: 6e5b80b1f4281766b17d208af58b44e768576d259de1c6edb25630c700215c10
3
+ metadata.gz: 5a12656e91180940d60fdd412b6f179cd0faa8a6b473aaadfa0bc4a371131464
4
+ data.tar.gz: 1076b01164ff1702abc8a9184410e0f8417199056698628ff2b0e5bf641cf168
5
5
  SHA512:
6
- metadata.gz: 404d064f14734a23d946ad0fc0576673e5e685d1001884981453e3bec23ecf6ba7b75857e578b47ef5303fde27342dfb25e85bbb7a60883d6ba09a964049bbfa
7
- data.tar.gz: 536f403109d3773a3cd0ca27b4b46bfa26eaeedd8d5e2f4e6fa116e3b922d21f8a964a2d6aa1cbbff951da9444e9184bf7c60955263ed68c91ba91342f3f9196
6
+ metadata.gz: 1298e0ed4b4455c478ee94384dbd02b4a029ea96409d66cf0b0e4292e51acde782d6bd875470c093a07198b99e222a366878d7019b6dc499221ee8b126a95cd7
7
+ data.tar.gz: 4b61b0fa059d240b568e176abdffff5b56a06e16598c185795e4d437bb0581a1cafb36794dd799168512b010ba71858837a30f3197be9b781510e50d3d4a268b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.2.6 (2023-04-11)
2
+
3
+ - Added `add_with_ids` method
4
+ - Added `IndexIDMap`
5
+
1
6
  ## 0.2.5 (2022-12-27)
2
7
 
3
8
  - Updated Faiss to 1.7.3
data/LICENSE.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  MIT License
2
2
 
3
3
  Copyright (c) Facebook, Inc. and its affiliates.
4
- Copyright (c) 2020-2022 Andrew Kane
4
+ Copyright (c) 2020-2023 Andrew Kane
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  of this software and associated documentation files (the "Software"), to deal
data/ext/faiss/index.cpp CHANGED
@@ -1,6 +1,7 @@
1
1
  #include <faiss/Index.h>
2
2
  #include <faiss/IndexFlat.h>
3
3
  #include <faiss/IndexHNSW.h>
4
+ #include <faiss/IndexIDMap.h>
4
5
  #include <faiss/IndexIVFFlat.h>
5
6
  #include <faiss/IndexLSH.h>
6
7
  #include <faiss/IndexScalarQuantizer.h>
@@ -118,6 +119,15 @@ void init_index(Rice::Module& m) {
118
119
  auto n = check_shape(objects, self.d);
119
120
  self.add(n, objects.read_ptr());
120
121
  })
122
+ .define_method(
123
+ "add_with_ids",
124
+ [](faiss::Index &self, numo::SFloat objects, numo::Int64 ids) {
125
+ auto n = check_shape(objects, self.d);
126
+ if (ids.ndim() != 1 || ids.shape()[0] != n) {
127
+ throw Rice::Exception(rb_eArgError, "expected ids to be 1d array with size %d", n);
128
+ }
129
+ self.add_with_ids(n, objects.read_ptr(), ids.read_ptr());
130
+ })
121
131
  .define_method(
122
132
  "search",
123
133
  [](faiss::Index &self, numo::SFloat objects, size_t k) {
@@ -186,4 +196,7 @@ void init_index(Rice::Module& m) {
186
196
  [](faiss::ParameterSpace& self, faiss::Index* index, const std::string& name, double val) {
187
197
  self.set_index_parameter(index, name, val);
188
198
  });
199
+
200
+ Rice::define_class_under<faiss::IndexIDMap, faiss::Index>(m, "IndexIDMap")
201
+ .define_constructor(Rice::Constructor<faiss::IndexIDMap, faiss::Index*>());
189
202
  }
data/lib/faiss/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Faiss
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faiss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-27 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rice
@@ -319,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
319
  - !ruby/object:Gem::Version
320
320
  version: '0'
321
321
  requirements: []
322
- rubygems_version: 3.4.1
322
+ rubygems_version: 3.4.10
323
323
  signing_key:
324
324
  specification_version: 4
325
325
  summary: Efficient similarity search and clustering for Ruby