11 #ifndef META_INDEXES_H
12 #define META_INDEXES_H
16 #include <unordered_map>
37 void add(
idx_t n,
const float* x)
override;
44 idx_t* labels)
const override;
48 void reset()
override;
64 std::unordered_map<idx_t, idx_t> rev_map;
71 void add_with_ids(idx_t n,
const float* x,
const long* xids)
override;
75 void reconstruct (idx_t key,
float * recons)
const override;
87 std::vector<Index*> shard_indexes;
100 bool successive_ids =
true);
102 void add_shard (
Index *);
106 void sync_with_shard_indexes ();
108 Index *at(
int i) {
return shard_indexes[i]; }
111 void add(idx_t n,
const float* x)
override;
124 void add_with_ids(idx_t n,
const float* x,
const long* xids)
override;
131 idx_t* labels)
const override;
133 void train(idx_t n,
const float* x)
override;
135 void reset()
override;
147 std::vector<Index*> sub_indexes;
152 void add_sub_index (
Index *);
153 void sync_with_sub_indexes ();
155 void add(
idx_t n,
const float* x)
override;
162 idx_t* labels)
const override;
166 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