Struct faiss::IDSelectorBatch

struct IDSelectorBatch : public faiss::IDSelector

Ids from a set.

Repetitions of ids in the indices set passed to the constructor does not hurt performance.

The hash function used for the bloom filter and GCC’s implementation of unordered_set are just the least significant bits of the id. This works fine for random ids or ids in sequences but will produce many hash collisions if lsb’s are always the same

Public Functions

IDSelectorBatch(size_t n, const idx_t *indices)

Construct with an array of ids to process

Parameters:
  • n – number of ids to store

  • ids – elements to store. The pointer can be released after construction

virtual bool is_member(idx_t id) const final
inline ~IDSelectorBatch() override

Public Members

std::unordered_set<idx_t> set
std::vector<uint8_t> bloom
int nbits
idx_t mask