Struct faiss::ZnSphereCodec

struct ZnSphereCodec : public faiss::ZnSphereSearch, public faiss::EnumeratedVectors

codec that can return ids for the encoded vectors

uses the ZnSphereSearch to encode the vector by encoding the permutation and signs. Depends on ZnSphereSearch because it uses the atom numbers

Subclassed by faiss::ZnSphereCodecAlt

Public Functions

ZnSphereCodec(int dim, int r2)
uint64_t search_and_encode(const float *x) const
virtual void decode(uint64_t code, float *c) const override

decode it

virtual uint64_t encode(const float *x) const override

takes vectors that do not need to be centroids

float search(const float *x, float *c) const

find nearest centroid. x does not need to be normalized

float search(const float *x, float *c, float *tmp, int *tmp_int, int *ibest_out = nullptr) const

full call. Requires externally-allocated temp space

void search_multi(int n, const float *x, float *c_out, float *dp_out)
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

std::vector<CodeSegment> code_segments
uint64_t nv
size_t code_size
int dimS
int r2
int natom
std::vector<float> voc

size dim * ntatom

int dim
struct CodeSegment : public faiss::Repeats

Public Functions

inline explicit CodeSegment(const Repeats &r)
uint64_t count() const
uint64_t encode(const float *c) const
void decode(uint64_t code, float *c) const

Public Members

uint64_t c0
int signbits
int dim
std::vector<Repeat> repeats