Struct faiss::IndexIDMap2Template

template<typename IndexT>
struct faiss::IndexIDMap2Template : public faiss::IndexIDMapTemplate<IndexT>

same as IndexIDMap but also provides an efficient reconstruction implementation via a 2-way index

Public Types

using idx_t = typename IndexT::idx_t
using component_t = typename IndexT::component_t
using distance_t = typename IndexT::distance_t

Public Functions

explicit IndexIDMap2Template(IndexT *index)
void construct_rev_map()

make the rev_map from scratch

void add_with_ids(idx_t n, const component_t *x, const idx_t *xids) override
size_t remove_ids(const IDSelector &sel) override
void reconstruct(idx_t key, component_t *recons) const override
inline ~IndexIDMap2Template() override
inline IndexIDMap2Template()
void add(idx_t n, const component_t *x) override

this will fail. Use add_with_ids

void search(idx_t n, const component_t *x, idx_t k, distance_t *distances, idx_t *labels) const override
void train(idx_t n, const component_t *x) override
void reset() override
void range_search(idx_t n, const component_t *x, distance_t radius, RangeSearchResult *result) const override

Public Members

std::unordered_map<idx_t, idx_t> rev_map
IndexT *index
bool own_fields

! the sub-index

std::vector<idx_t> id_map

! whether pointers are deleted in destructo