Struct faiss::ScalarQuantizer::SQDistanceComputer

struct SQDistanceComputer : public faiss::FlatCodesDistanceComputer

Public Functions

inline SQDistanceComputer()
virtual float query_to_code(const uint8_t *code) const = 0
inline virtual float distance_to_code(const uint8_t *code) final

compute distance of current query to an encoded vector

inline virtual float operator()(idx_t i) override

compute distance of vector i to current query

virtual void set_query(const float *x) = 0

called before computing distances. Pointer x should remain valid while operator () is called

inline virtual void distances_batch_4(const idx_t idx0, const idx_t idx1, const idx_t idx2, const idx_t idx3, float &dis0, float &dis1, float &dis2, float &dis3)

compute distances of current query to 4 stored vectors. certain DistanceComputer implementations may benefit heavily from this.

virtual float symmetric_dis(idx_t i, idx_t j) = 0

compute distance between two stored vectors

Public Members

const float *q
const uint8_t *codes
size_t code_size