11 #include "IndexFlat.h"
12 #include "FaissAssert.h"
20 FAISS_THROW_MSG (
"range search not implemented");
25 float * distances =
new float[n * k];
27 search (n, x, k, distances, labels);
33 FAISS_THROW_MSG (
"add_with_ids not implemented for this type of index");
39 FAISS_THROW_MSG (
"remove_ids not implemented for this type of index");
45 FAISS_THROW_MSG (
"Can not compute reconstruct without "
46 "knowing how to do so");
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