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