Struct faiss::ReconstructFromNeighbors

struct faiss::ReconstructFromNeighbors

Public Types

typedef Index::idx_t idx_t
typedef HNSW::storage_idx_t storage_idx_t

Public Functions

explicit ReconstructFromNeighbors(const IndexHNSW &index, size_t k = 256, size_t nsq = 1)
void add_codes(size_t n, const float *x)

codes must be added in the correct order and the IndexHNSW must be populated and sorted

size_t compute_distances(size_t n, const idx_t *shortlist, const float *query, float *distances) const
void estimate_code(const float *x, storage_idx_t i, uint8_t *code) const

called by add_codes

void reconstruct(storage_idx_t i, float *x, float *tmp) const

called by compute_distances

void reconstruct_n(storage_idx_t n0, storage_idx_t ni, float *x) const
void get_neighbor_table(storage_idx_t i, float *out) const

get the M+1 -by-d table for neighbor coordinates for vector i

Public Members

const IndexHNSW &index
size_t M
size_t k
size_t nsq
size_t code_size
int k_reorder
std::vector<float> codebook
std::vector<uint8_t> codes
size_t ntotal
size_t d
size_t dsub