12 #ifndef FAISS_INDEX_PQ_H
13 #define FAISS_INDEX_PQ_H
20 #include "ProductQuantizer.h"
21 #include "PolysemousTraining.h"
51 void add(
idx_t n,
const float* x)
override;
58 idx_t* labels)
const override;
60 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;
149 idx_t* labels)
const override;
152 void add(
idx_t n,
const float* x)
override;
153 void reset()
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
void hamming_distance_histogram(idx_t n, const float *x, idx_t nb, const float *xb, long *dist_histogram)
Search_type_t
how to perform the search in search_core
Filter on generalized Hamming.
long idx_t
all indices are this type
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 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
MetricType
Some algorithms support both an inner product vetsion and a L2 search version.