Skip to content

Commit a17a631

Browse files
author
Lucas Hosseini
authored
Sync 20200323. (#1157)
* Sync 20200323. * Bump version. * Remove warning filter.
1 parent fc2a1c1 commit a17a631

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3528
-361
lines changed

Clustering.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ struct ClusteringParameters {
3434

3535
int seed; ///< seed for the random number generator
3636

37-
size_t decode_block_size; /// < how many vectors at a time to decode
37+
size_t decode_block_size; ///< how many vectors at a time to decode
3838

3939
/// sets reasonable defaults
4040
ClusteringParameters ();
4141
};
4242

4343

4444
struct ClusteringIterationStats {
45-
float obj; /// objective values (sum of distances reported by index)
46-
double time; /// seconds for iteration
47-
double time_search; /// seconds for just search
48-
double imbalance_factor; /// imbalance factor of iteration
49-
int nsplit; /// number of cluster splits
45+
float obj; ///< objective values (sum of distances reported by index)
46+
double time; ///< seconds for iteration
47+
double time_search; ///< seconds for just search
48+
double imbalance_factor; ///< imbalance factor of iteration
49+
int nsplit; ///< number of cluster splits
5050
};
5151

5252

Index.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#define FAISS_VERSION_MAJOR 1
2020
#define FAISS_VERSION_MINOR 6
21-
#define FAISS_VERSION_PATCH 2
21+
#define FAISS_VERSION_PATCH 3
2222

2323
/**
2424
* @namespace faiss
@@ -44,12 +44,10 @@ struct IDSelector;
4444
struct RangeSearchResult;
4545
struct DistanceComputer;
4646

47-
/** Abstract structure for an index
47+
/** Abstract structure for an index, supports adding vectors and searching them.
4848
*
49-
* Supports adding vertices and searching them.
50-
*
51-
* Currently only asymmetric queries are supported:
52-
* database-to-database queries are not implemented.
49+
* All vectors provided at add or search time are 32-bit float arrays,
50+
* although the internal representation may vary.
5351
*/
5452
struct Index {
5553
using idx_t = int64_t; ///< all indices are this type

IndexBinary.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,13 @@ struct IndexBinary {
9999

100100
/** Query n vectors of dimension d to the index.
101101
*
102-
* return all vectors with distance < radius. Note that many
103-
* indexes do not implement the range_search (only the k-NN search
104-
* is mandatory).
102+
* return all vectors with distance < radius. Note that many indexes
103+
* do not implement the range_search (only the k-NN search is
104+
* mandatory). The distances are converted to float to reuse the
105+
* RangeSearchResult structure, but they are integer. By convention,
106+
* only distances < radius (strict comparison) are returned,
107+
* ie. radius = 0 does not return any result and 1 returns only
108+
* exact same vectors.
105109
*
106110
* @param x input vectors to search, size n * d / 8
107111
* @param radius search radius

IndexBinaryFlat.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,10 @@ void IndexBinaryFlat::reconstruct(idx_t key, uint8_t *recons) const {
7979
memcpy(recons, &(xb[code_size * key]), sizeof(*recons) * code_size);
8080
}
8181

82+
void IndexBinaryFlat::range_search(idx_t n, const uint8_t *x, int radius,
83+
RangeSearchResult *result) const
84+
{
85+
hamming_range_search (x, xb.data(), n, ntotal, radius, code_size, result);
86+
}
8287

8388
} // namespace faiss

IndexBinaryFlat.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ struct IndexBinaryFlat : IndexBinary {
3838
void search(idx_t n, const uint8_t *x, idx_t k,
3939
int32_t *distances, idx_t *labels) const override;
4040

41+
void range_search(idx_t n, const uint8_t *x, int radius,
42+
RangeSearchResult *result) const override;
43+
4144
void reconstruct(idx_t key, uint8_t *recons) const override;
4245

4346
/** Remove some ids. Note that because of the indexing structure,

0 commit comments

Comments
 (0)