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);
34 FAISS_THROW_MSG (
"add_with_ids not implemented for this type of index");
38 FAISS_THROW_MSG (
"remove_ids not implemented for this type of index");
44 FAISS_THROW_MSG (
"reconstruct not implemented for this type of index");
49 for (
idx_t i = 0; i < ni; i++) {
57 float * residual,
idx_t key)
const {
59 for (
size_t i = 0; i <
d; i++)
60 residual[i] = x[i] - residual[i];
65 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