Struct faiss::NormalizationTransformΒΆ

struct NormalizationTransform : public faiss::VectorTransform

per-vector normalization

Public Types

typedef Index::idx_t idx_t

Public Functions

explicit NormalizationTransform(int d, float norm = 2.0)
virtual void apply_noalloc(idx_t n, const float *x, float *xt) const override

same as apply, but result is pre-allocated

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

Identity transform since norm is not revertible.

virtual void train(idx_t n, const float *x)

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

  • n – nb of training vectors

  • x – training vecors, size n * d

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

Public Members

float norm
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