Struct faiss::Level1Quantizer

struct faiss::Level1Quantizer

Encapsulates a quantizer object for the IndexIVF

The class isolates the fields that are independent of the storage of the lists (especially training)

Subclassed by faiss::IndexIVF

Public Functions

void train_q1(size_t n, const float *x, bool verbose, MetricType metric_type)

Trains the quantizer and calls train_residual to train sub-quantizers.

size_t coarse_code_size() const

compute the number of bytes required to store list ids

void encode_listno(Index::idx_t list_no, uint8_t *code) const
Index::idx_t decode_listno(const uint8_t *code) const
Level1Quantizer(Index *quantizer, size_t nlist)
Level1Quantizer()
~Level1Quantizer()

Public Members

Index *quantizer

quantizer that maps vectors to inverted lists

size_t nlist

number of possible key values

char quantizer_trains_alone

= 0: use the quantizer as index in a kmeans training = 1: just pass on the training set to the train() of the quantizer = 2: kmeans training on a flat index + add the centroids to the quantizer

bool own_fields

whether object owns the quantizer (false by default)

ClusteringParameters cp

to override default clustering params

Index *clustering_index

to override index used during clustering