Struct faiss::Quantizer

struct Quantizer

General interface for quantizer objects

Subclassed by faiss::AdditiveQuantizer, faiss::ProductQuantizer, faiss::ScalarQuantizer

Public Functions

inline explicit Quantizer(size_t d = 0, size_t code_size = 0)
virtual void train(size_t n, const float *x) = 0

Train the quantizer

Parameters:

x – training vectors, size n * d

virtual void compute_codes(const float *x, uint8_t *codes, size_t n) const = 0

Quantize a set of vectors

Parameters:
  • x – input vectors, size n * d

  • codes – output codes, size n * code_size

virtual void decode(const uint8_t *code, float *x, size_t n) const = 0

Decode a set of vectors

Parameters:
  • codes – input codes, size n * code_size

  • x – output vectors, size n * d

inline virtual ~Quantizer()

Public Members

size_t d

size of the input vectors

size_t code_size

bytes per indexed vector