结构体 faiss::ITQTransform

struct ITQTransform : public faiss::VectorTransform

完整的ITQ变换,包括归一化和PCA变换

公共函数

explicit ITQTransform(int d_in = 0, int d_out = 0, bool do_pca = false)
virtual void train(idx_t n, const float *x) override

在一组有代表性的向量上执行训练。默认情况下不执行任何操作。

参数:
  • n – 训练向量的数量

  • x – 训练向量,大小为 n * d

virtual void apply_noalloc(idx_t n, const float *x, float *xt) const override

应用变换,并在提供的矩阵中返回结果

参数:
  • n – 要变换的向量数

  • x – 输入向量,大小为 n * d_in

  • xt – 输出向量,大小为 n * d_out

virtual void check_identical(const VectorTransform &other) const override
float *apply(idx_t n, const float *x) const

应用变换,并在分配的指针中返回结果

参数:
  • n – 要变换的向量数

  • x – 输入向量,大小为 n * d_in

返回值:

输出向量,大小为 n * d_out

virtual void reverse_transform(idx_t n, const float *xt, float *x) const

反向变换。可能未实现,或者可能返回近似结果

公共成员

std::vector<float> mean
bool do_pca
ITQMatrix itq
int max_train_per_dim

每个维度的最大训练点数

LinearTransform pca_then_itq
int d_in
int d_out

! 输入维度

bool is_trained

设置 VectorTransform 是否不需要训练,或者是否已完成训练