12 #ifndef META_INDEXES_H
13 #define META_INDEXES_H
17 #include <unordered_map>
38 void add(
idx_t n,
const float* x)
override;
45 idx_t* labels)
const override;
49 void reset()
override;
65 std::unordered_map<idx_t, idx_t> rev_map;
88 std::vector<Index*> shard_indexes;
101 bool successive_ids =
true);
103 void add_shard (
Index *);
107 void sync_with_shard_indexes ();
109 Index *at(
int i) {
return shard_indexes[i]; }
112 void add(
idx_t n,
const float* x)
override;
121 idx_t* labels)
const override;
125 void reset()
override;
137 std::vector<Index*> sub_indexes;
142 void add_sub_index (
Index *);
143 void sync_with_sub_indexes ();
145 void add(
idx_t n,
const float* x)
override;
152 idx_t* labels)
const override;
156 void reset()
override;
void train(idx_t n, const float *x) override
IndexShards(idx_t d, bool threaded=false, bool successive_ids=true)
void search(idx_t n, const float *x, idx_t k, float *distances, idx_t *labels) const override
void add_with_ids(idx_t n, const float *x, const long *xids) override
void search(idx_t n, const float *x, idx_t k, float *distances, idx_t *labels) const override
void add_with_ids(idx_t n, const float *x, const long *xids) override
void reset() override
removes all elements from the database.
void add(idx_t n, const float *x) override
this will fail. Use add_with_ids
std::vector< long > id_map
! whether pointers are deleted in destructo
void range_search(idx_t n, const float *x, float radius, RangeSearchResult *result) const override
void train(idx_t n, const float *x) override
void add(idx_t n, const float *x) override
supported only for sub-indices that implement add_with_ids
long idx_t
all indices are this type
void construct_rev_map()
make the rev_map from scratch
void add(idx_t n, const float *x) override
long remove_ids(const IDSelector &sel) override
remove ids adapted to IndexFlat
bool threaded
should the sub-indexes be deleted along with this?
void reset() override
removes all elements from the database.
void reset() override
removes all elements from the database.
void search(idx_t n, const float *x, idx_t k, float *distances, idx_t *labels) const override
long remove_ids(const IDSelector &sel) override
remove ids adapted to IndexFlat
void reconstruct(idx_t key, float *recons) const override
void train(idx_t n, const float *x) override
void add_with_ids(idx_t n, const float *x, const long *xids) override
IndexSplitVectors(idx_t d, bool threaded=false)
sum of dimensions seen so far
bool own_fields
! the sub-index