Faiss
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
/data/users/hoss/faiss/IndexBinaryFlat.h
1 /**
2  * Copyright (c) Facebook, Inc. and its affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 // -*- c++ -*-
9 
10 #ifndef INDEX_BINARY_FLAT_H
11 #define INDEX_BINARY_FLAT_H
12 
13 #include <vector>
14 
15 #include "IndexBinary.h"
16 
17 namespace faiss {
18 
19 
20 /** Index that stores the full vectors and performs exhaustive search. */
22  /// database vectors, size ntotal * d / 8
23  std::vector<uint8_t> xb;
24 
25  /** Select between using a heap or counting to select the k smallest values
26  * when scanning inverted lists.
27  */
28  bool use_heap = true;
29 
30  size_t query_batch_size = 32;
31 
32  explicit IndexBinaryFlat(idx_t d);
33 
34  void add(idx_t n, const uint8_t *x) override;
35 
36  void reset() override;
37 
38  void search(idx_t n, const uint8_t *x, idx_t k,
39  int32_t *distances, idx_t *labels) const override;
40 
41  void reconstruct(idx_t key, uint8_t *recons) const override;
42 
43  /** Remove some ids. Note that because of the indexing structure,
44  * the semantics of this operation are different from the usual ones:
45  * the new ids are shifted. */
46  long remove_ids(const IDSelector& sel) override;
47 
48  IndexBinaryFlat() {}
49 };
50 
51 
52 } // namespace faiss
53 
54 #endif // INDEX_BINARY_FLAT_H
void add(idx_t n, const uint8_t *x) override
long remove_ids(const IDSelector &sel) override
void search(idx_t n, const uint8_t *x, idx_t k, int32_t *distances, idx_t *labels) const override
void reconstruct(idx_t key, uint8_t *recons) const override
Index::idx_t idx_t
all indices are this type
Definition: IndexBinary.h:37
int d
vector dimension
Definition: IndexBinary.h:41
void reset() override
Removes all elements from the database.
std::vector< uint8_t > xb
database vectors, size ntotal * d / 8