Struct faiss::ITQTransform

struct faiss::ITQTransform : public faiss::VectorTransform

The full ITQ transform, including normalizations and PCA transformation

Public Types

typedef Index::idx_t idx_t

Public Functions

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

Perform training on a representative set of vectors. Does nothing by default.

  • n – nb of training vectors

  • x – training vecors, size n * d

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

same as apply, but result is pre-allocated

float *apply(idx_t n, const float *x) const

apply the random rotation, return new allocated matrix


x – size n * d_in


size n * d_out

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

reverse transformation. May not be implemented or may return approximate result

Public Members

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

max training points per dimension

LinearTransform pca_then_itq
int d_in
int d_out

! input dimension

bool is_trained

set if the VectorTransform does not require training, or if training is done already