Skip to content

Commit

Permalink
add comments for ivfflat getIteratorNext()
Browse files Browse the repository at this point in the history
Signed-off-by: min.tian <[email protected]>
  • Loading branch information
alwayslove2013 committed Feb 2, 2024
1 parent 2e15952 commit 20bc9fd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion thirdparty/faiss/faiss/IndexIVFFlat.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct IndexIVFFlat : IndexIVF {
void restore_codes(const uint8_t* raw_data, const size_t raw_size);

// Be careful with overriding this function, because
// renormalized x may be used inside.
// renormalized x may be used inside.
// Overridden by IndexIVFFlatDedup.
void train(idx_t n, const float* x) override;

Expand Down Expand Up @@ -88,6 +88,12 @@ struct IndexIVFFlat : IndexIVF {
const float* query_data,
const IVFSearchParameters* ivfsearchParams) const;

// Unlike regular knn-search, the iterator does not know the size `k` of the
// returned result.
// The workspace will maintain a heap of at least (nprobe/nlist) nodes for
// iterator `Next()` operation.
// When there are not enough nodes in the heap, iterator will scan the
// next coarse list.
std::optional<std::pair<float, idx_t>> getIteratorNext(
IVFFlatIteratorWorkspace* workspace) const;
};
Expand Down

0 comments on commit 20bc9fd

Please sign in to comment.