Struct faiss::VectorTransform

struct VectorTransform

Any transformation applied on a set of vectors

Subclassed by faiss::CenteringTransform, faiss::ITQTransform, faiss::LinearTransform, faiss::NormalizationTransform, faiss::RemapDimensionsTransform

Public Functions

inline explicit VectorTransform(int d_in = 0, int d_out = 0)

! output dimension

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

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

Parameters:
  • n – nb of training vectors

  • x – training vecors, size n * d

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

apply the transformation and return the result in an allocated pointer

Parameters:
  • n – number of vectors to transform

  • x – input vectors, size n * d_in

Returns:

output vectors, size n * d_out

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

apply the transformation and return the result in a provided matrix

Parameters:
  • n – number of vectors to transform

  • x – input vectors, size n * d_in

  • xt – output vectors, 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

virtual void check_identical(const VectorTransform &other) const = 0
inline virtual ~VectorTransform()

Public Members

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