13 #ifndef FAISS_VECTOR_TRANSFORM_H
14 #define FAISS_VECTOR_TRANSFORM_H
52 virtual void train (idx_t n,
const float *x);
58 float *
apply (idx_t n,
const float * x)
const;
92 bool have_bias =
false);
104 size_t max_points_per_d;
108 const float *maybe_subsample_train_set (
Index::idx_t *n,
const float *x);
128 float *x)
const override;
168 float *x)
const override;
199 explicit OPQMatrix (
int d = 0,
int M = 1,
int d2 = -1);
204 float *x)
const override;
226 float *xt)
const override;
230 float *x)
const override;
240 std::vector<VectorTransform *> chain;
254 virtual void set_typename ()
override;
256 virtual void train (
idx_t n,
const float *x)
override;
258 virtual void add (
idx_t n,
const float *x)
override;
264 virtual void reset ()
override;
272 float *distances,
idx_t *labels)
const override;
Randomly rotate a set of vectors.
int niter
Number of outer training iterations.
RandomRotationMatrix(int d_in, int d_out)
both d_in > d_out and d_out < d_in are supported
void init(int seed)
must be called before the transform is used
int niter_pq
Number of training iterations for the PQ.
virtual void train(Index::idx_t n, const float *x) override
std::vector< float > mean
Mean, size d_in.
std::vector< float > PCAMat
PCA matrix, size d_in * d_in.
int max_points_per_d
if there are too many training points, resample
virtual void train(Index::idx_t n, const float *x) override
int balanced_bins
try to distribute output eigenvectors in this many bins
long idx_t
all indices are this type
virtual void reverse_transform(idx_t n, const float *xt, float *x) const override
virtual void reverse_transform(idx_t n, const float *xt, float *x) const override
virtual void reverse_transform(idx_t n, const float *xt, float *x) const override
void copy_from(const PCAMatrix &other)
copy pre-trained PCA matrix
OPQMatrix(int d=0, int M=1, int d2=-1)
if d2 != -1, output vectors of this dimension
void prepare_Ab()
called after mean, PCAMat and eigenvalues are computed
std::vector< float > eigenvalues
eigenvalues of covariance matrix (= squared singular values)
bool random_rotation
random rotation after PCA