#include <IndexReplicas.h>
Public Types | |
| using | idx_t = typename IndexT::idx_t |
| using | component_t = typename IndexT::component_t |
| using | distance_t = typename IndexT::distance_t |
Public Member Functions | |
| IndexReplicasTemplate (bool threaded=true) | |
| IndexReplicasTemplate (idx_t d, bool threaded=true) | |
| IndexReplicasTemplate (int d, bool threaded=true) | |
| void | add_replica (IndexT *index) |
| Alias for addIndex() | |
| void | remove_replica (IndexT *index) |
| Alias for removeIndex() | |
| void | train (idx_t n, const component_t *x) override |
| void | add (idx_t n, const component_t *x) override |
| void | search (idx_t n, const component_t *x, idx_t k, distance_t *distances, idx_t *labels) const override |
| void | reconstruct (idx_t, component_t *v) const override |
| reconstructs from the first index | |
Public Member Functions inherited from faiss::ThreadedIndex< IndexT > | |
| ThreadedIndex (bool threaded) | |
| ThreadedIndex (int d, bool threaded) | |
| void | addIndex (IndexT *index) |
| void | removeIndex (IndexT *index) |
| void | runOnIndex (std::function< void(int, IndexT *)> f) |
| void | runOnIndex (std::function< void(int, const IndexT *)> f) const |
| void | reset () override |
| int | count () const |
| Returns the number of sub-indices. | |
| IndexT * | at (int i) |
| Returns the i-th sub-index. | |
| const IndexT * | at (int i) const |
| Returns the i-th sub-index (const version) | |
Protected Member Functions | |
| void | onAfterAddIndex (IndexT *index) override |
| Called just after an index is added. | |
Protected Member Functions inherited from faiss::ThreadedIndex< IndexT > | |
| virtual void | onAfterRemoveIndex (IndexT *index) |
| Called just after an index is removed. | |
Additional Inherited Members | |
Public Attributes inherited from faiss::ThreadedIndex< IndexT > | |
| bool | own_fields |
| Whether or not we are responsible for deleting our contained indices. | |
Static Protected Member Functions inherited from faiss::ThreadedIndex< IndexT > | |
| static void | waitAndHandleFutures (std::vector< std::future< bool >> &v) |
Protected Attributes inherited from faiss::ThreadedIndex< IndexT > | |
|
std::vector< std::pair< IndexT *, std::unique_ptr < WorkerThread > > > | indices_ |
| Collection of Index instances, with their managing worker thread if any. | |
| bool | isThreaded_ |
| Is this index multi-threaded? | |
Takes individual faiss::Index instances, and splits queries for sending to each Index instance, and joins the results together when done. Each index is managed by a separate CPU thread.
Definition at line 21 of file IndexReplicas.h.
|
explicit |
The dimension that all sub-indices must share will be the dimension of the first sub-index added
| threaded | do we use one thread per sub-index or do queries sequentially? |
Definition at line 14 of file IndexReplicas.cpp.
|
explicit |
| d | the dimension that all sub-indices must share |
| threaded | do we use one thread per sub index or do queries sequentially? |
Definition at line 19 of file IndexReplicas.cpp.
|
explicit |
int version due to the implicit bool conversion ambiguity of int as dimension
Definition at line 24 of file IndexReplicas.cpp.
|
override |
faiss::Index API All indices receive the same call
Definition at line 63 of file IndexReplicas.cpp.
|
override |
faiss::Index API Query is partitioned into a slice for each sub-index split by ceil(n / #indices) for our sub-indices
Definition at line 79 of file IndexReplicas.cpp.
|
override |
faiss::Index API All indices receive the same call
Definition at line 57 of file IndexReplicas.cpp.
1.8.5