12 #include "IndexFlat.h"
13 #include "FaissAssert.h"
21 FAISS_ASSERT (!
"range search not implemented");
26 float * distances =
new float[n * k];
27 search (n, x, k, distances, labels);
34 FAISS_ASSERT (!
"add_with_ids not implemented for this type of index");
40 FAISS_ASSERT (!
"remove_ids not implemented for this type of index");
46 FAISS_ASSERT (!
"Can not compute reconstruct without knowing howto\n");
51 for (
idx_t i = 0; i < ni; i++) {
59 float * residual,
idx_t key)
const {
61 for (
size_t i = 0; i <
d; i++)
62 residual[i] = x[i] - residual[i];
67 printf (
"Index: %s -> %ld elements\n",
typeid (*this).name(),
ntotal);
void assign(idx_t n, const float *x, idx_t *labels, idx_t k=1)
virtual void add_with_ids(idx_t n, const float *x, const long *xids)
virtual void reconstruct_n(idx_t i0, idx_t ni, float *recons) const
long idx_t
all indices are this type
idx_t ntotal
total nb of indexed vectors
virtual long remove_ids(const IDSelector &sel)
virtual void search(idx_t n, const float *x, idx_t k, float *distances, idx_t *labels) const =0
virtual void range_search(idx_t n, const float *x, float radius, RangeSearchResult *result) const
void compute_residual(const float *x, float *residual, idx_t key) const
virtual void reconstruct(idx_t key, float *recons) const