Struct faiss::ZnSphereCodecRec

struct ZnSphereCodecRec : public faiss::EnumeratedVectors

recursive sphere codec

Uses a recursive decomposition on the dimensions to encode centroids found by the ZnSphereSearch. The codes are not compatible with the ones of ZnSpehreCodec

Public Functions

ZnSphereCodecRec(int dim, int r2)
uint64_t encode_centroid(const float *c) const
virtual void decode(uint64_t code, float *c) const override

decode it

virtual uint64_t encode(const float *x) const override

vectors need to be centroids (does not work on arbitrary vectors)

uint64_t get_nv(int ld, int r2a) const
uint64_t get_nv_cum(int ld, int r2t, int r2a) const
void set_nv_cum(int ld, int r2t, int r2a, uint64_t v)
void encode_multi(size_t nc, const float *c, uint64_t *codes) const
void decode_multi(size_t nc, const uint64_t *codes, float *c) const
void find_nn(size_t n, const uint64_t *codes, size_t nq, const float *xq, int64_t *idx, float *dis)

Public Members

int r2
int log2_dim
int code_size
std::vector<uint64_t> all_nv
std::vector<uint64_t> all_nv_cum
int decode_cache_ld
std::vector<std::vector<float>> decode_cache
uint64_t nv

size of the collection

int dim