结构体 faiss::Level1Quantizer
-
struct Level1Quantizer
封装 IndexIVF 的量化器对象
该类隔离了独立于列表存储的字段(特别是训练)
被 faiss::IndexIVFInterface, faiss::IndexShardsIVF 继承
公共函数
-
void train_q1(size_t n, const float *x, bool verbose, MetricType metric_type)
训练量化器并调用 train_residual 来训练子量化器。
-
size_t coarse_code_size() const
计算存储列表 IDs 所需的字节数
-
void encode_listno(idx_t list_no, uint8_t *code) const
-
idx_t decode_listno(const uint8_t *code) const
-
Level1Quantizer(Index *quantizer, size_t nlist)
-
Level1Quantizer()
-
~Level1Quantizer()
公共成员
-
Index *quantizer = nullptr
将向量映射到倒排列表的量化器
-
size_t nlist = 0
倒排列表的数量
-
char quantizer_trains_alone = 0
>= 0: 将量化器用作 kmeans 训练中的索引 = 1: 只需将训练集传递给量化器的 train() = 2: 在平面索引上进行 kmeans 训练 + 将质心添加到量化器
-
bool own_fields = false
对象是否拥有量化器
-
ClusteringParameters cp
用于覆盖默认聚类参数
-
Index *clustering_index = nullptr
用于覆盖聚类期间使用的索引
-
void train_q1(size_t n, const float *x, bool verbose, MetricType metric_type)