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;
62 std::unordered_map<idx_t, idx_t> rev_map;
85 std::vector<Index*> shard_indexes;
98 bool successive_ids =
true);
100 void add_shard (
Index *);
104 void sync_with_shard_indexes ();
106 Index *at(
int i) {
return shard_indexes[i]; }
109 void add(
idx_t n,
const float* x)
override;
118 idx_t* labels)
const override;
122 void reset()
override;
134 std::vector<Index*> sub_indexes;
139 void add_sub_index (
Index *);
140 void sync_with_sub_indexes ();
142 void add(
idx_t n,
const float* x)
override;
149 idx_t* labels)
const override;
153 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 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