15 #ifndef FAISS_AUX_INDEX_STRUCTURES_H
16 #define FAISS_AUX_INDEX_STRUCTURES_H
20 #if __cplusplus >= 201103L
21 #include <unordered_set>
60 virtual bool is_member (idx_t
id)
const = 0;
71 virtual bool is_member (idx_t
id)
const override;
85 #if __cplusplus >= 201103L
86 std::unordered_set<idx_t> set;
91 typedef unsigned char uint8_t;
92 std::vector<uint8_t> bloom;
97 virtual bool is_member (idx_t
id)
const override;
120 std::vector<Buffer> buffers;
128 void append_buffer ();
130 inline void add (idx_t
id,
float dis)
132 if (
wp == buffer_size) {
135 Buffer & buf = buffers.back();
144 idx_t * dest_ids,
float *dest_dis);
161 inline void add (
float dis, idx_t
id) {
167 std::vector<QueryResult> queries;
result structure for a single query
void copy_range(size_t ofs, size_t n, idx_t *dest_ids, float *dest_dis)
void set_result(bool incremental=false)
called by range_search after do_allocation
void set_lims()
called by range_search before do_allocation
size_t wp
write pointer in the last buffer.
RangeSearchResult(size_t nq)
lims must be allocated on input to range_search.
float * distances
corresponding distances (not sorted)
long idx_t
all indices are this type
QueryResult & new_result(idx_t qno)
begin a new result
virtual void do_allocation()
the entries in the buffers are split per query
size_t buffer_size
size of the result buffers used
size_t * lims
size (nq + 1)
idx_t * labels
result for query i is labels[lims[i]:lims[i+1]]