10 #ifndef FAISS_INDEX_PQ_H
11 #define FAISS_INDEX_PQ_H
18 #include "ProductQuantizer.h"
19 #include "PolysemousTraining.h"
49 void add(
idx_t n,
const float* x)
override;
56 idx_t* labels)
const override;
58 void reset()
override;
94 void search_core_polysemous (
idx_t n,
const float *x,
idx_t k,
95 float *distances,
idx_t *labels)
const;
102 idx_t nb,
const float *xb,
103 long *dist_histogram);
123 size_t n_hamming_pass;
146 float* distances,
idx_t* labels)
const override;
149 void add(
idx_t n,
const float* x)
override;
150 void reset()
override;
167 int d,
size_t M,
size_t nbits,
172 Index *assign_index_0,
173 Index *assign_index_1);
179 float* distances,
idx_t* labels)
const override;
std::vector< uint8_t > codes
Codes. Size ntotal * pq.code_size.
Hamming distance on codes.
bool do_polysemous_training
false = standard PQ
void train(idx_t n, const float *x) override
void reset() override
removes all elements from the database.
void train(idx_t n, const float *x) override
long idx_t
all indices are this type
void hamming_distance_histogram(idx_t n, const float *x, idx_t nb, const float *xb, long *dist_histogram)
void train(idx_t n, const float *x) override
Search_type_t
how to perform the search in search_core
long remove_ids(const IDSelector &sel) override
Filter on generalized Hamming.
ProductQuantizer pq
The product quantizer used to encode the vectors.
void add(idx_t n, const float *x) override
optimizes the order of indices in a ProductQuantizer
void hamming_distance_table(idx_t n, const float *x, int32_t *dis) const
void search(idx_t n, const float *x, idx_t k, float *distances, idx_t *labels) const override
void reconstruct(idx_t key, float *recons) const override
void reconstruct_n(idx_t i0, idx_t ni, float *recons) const override
asymmetric product quantizer (default)
void reconstruct(idx_t key, float *recons) const override
HE filter (using ht) + PQ combination.
void search(idx_t n, const float *x, idx_t k, float *distances, idx_t *labels) const override
void add(idx_t n, const float *x) override
add and reset will crash at runtime
void reset() override
removes all elements from the database.
void search(idx_t n, const float *x, idx_t k, float *distances, idx_t *labels) const override
symmetric product quantizer (SDC)
int polysemous_ht
Hamming threshold used for polysemy.
PolysemousTraining polysemous_training
parameters used for the polysemous training
std::vector< Index * > assign_indexes
M Indexes on d / M dimensions.
MetricType
Some algorithms support both an inner product version and a L2 search version.