Public Member Functions | |
| IndexIVFFlatDedup (Index *quantizer, size_t d, size_t nlist_, MetricType=METRIC_L2) | |
| void | train (idx_t n, const float *x) override |
| also dedups the training set | |
| void | add_with_ids (idx_t n, const float *x, const long *xids) override |
| implemented for all IndexIVF* classes | |
| void | search_preassigned (idx_t n, const float *x, idx_t k, const idx_t *assign, const float *centroid_dis, float *distances, idx_t *labels, bool store_pairs, const IVFSearchParameters *params=nullptr) const override |
| long | remove_ids (const IDSelector &sel) override |
| Dataset manipulation functions. | |
| void | range_search (idx_t n, const float *x, float radius, RangeSearchResult *result) const override |
| not implemented | |
| void | update_vectors (int nv, idx_t *idx, const float *v) override |
| not implemented | |
| void | reconstruct_from_offset (long list_no, long offset, float *recons) const override |
| not implemented | |
Public Member Functions inherited from faiss::IndexIVFFlat | |
| IndexIVFFlat (Index *quantizer, size_t d, size_t nlist_, MetricType=METRIC_L2) | |
| virtual void | add_core (idx_t n, const float *x, const long *xids, const long *precomputed_idx) |
| same as add_with_ids, with precomputed coarse quantizer | |
| void | encode_vectors (idx_t n, const float *x, const idx_t *list_nos, uint8_t *codes) const override |
| InvertedListScanner * | get_InvertedListScanner (bool store_pairs) const override |
| get a scanner for this index (store_pairs means ignore labels) | |
Public Member Functions inherited from faiss::IndexIVF | |
| IndexIVF (Index *quantizer, size_t d, size_t nlist, size_t code_size, MetricType metric=METRIC_L2) | |
| void | reset () override |
| removes all elements from the database. | |
| void | add (idx_t n, const float *x) override |
| Calls add_with_ids with NULL ids. | |
| virtual void | train_residual (idx_t n, const float *x) |
| virtual void | search (idx_t n, const float *x, idx_t k, float *distances, idx_t *labels) const override |
| void | reconstruct (idx_t key, float *recons) const override |
| void | reconstruct_n (idx_t i0, idx_t ni, float *recons) const override |
| void | search_and_reconstruct (idx_t n, const float *x, idx_t k, float *distances, idx_t *labels, float *recons) const override |
| void | check_compatible_for_merge (const IndexIVF &other) const |
| virtual void | merge_from (IndexIVF &other, idx_t add_id) |
| virtual void | copy_subset_to (IndexIVF &other, int subset_type, long a1, long a2) const |
| size_t | get_list_size (size_t list_no) const |
| void | make_direct_map (bool new_maintain_direct_map=true) |
| double | imbalance_factor () const |
| 1= perfectly balanced, >1: imbalanced | |
| void | print_stats () const |
| display some stats about the inverted lists | |
| void | replace_invlists (InvertedLists *il, bool own=false) |
| replace the inverted lists, old one is deallocated if own_invlists | |
Public Member Functions inherited from faiss::Index | |
| Index (idx_t d=0, MetricType metric=METRIC_L2) | |
| void | assign (idx_t n, const float *x, idx_t *labels, idx_t k=1) |
| void | compute_residual (const float *x, float *residual, idx_t key) const |
| void | display () const |
Public Member Functions inherited from faiss::Level1Quantizer | |
| void | train_q1 (size_t n, const float *x, bool verbose, MetricType metric_type) |
| Trains the quantizer and calls train_residual to train sub-quantizers. | |
| Level1Quantizer (Index *quantizer, size_t nlist) | |
Public Attributes | |
| std::unordered_multimap< idx_t, idx_t > | instances |
Public Attributes inherited from faiss::IndexIVF | |
| InvertedLists * | invlists |
| Acess to the actual data. | |
| bool | own_invlists |
| size_t | code_size |
| code size per vector in bytes | |
| size_t | nprobe |
| number of probes at query time | |
| size_t | max_codes |
| max nb of codes to visit to do a query | |
| bool | maintain_direct_map |
| map for direct access to the elements. Enables reconstruct(). | |
| std::vector< long > | direct_map |
Public Attributes inherited from faiss::Index | |
| int | d |
| vector dimension | |
| idx_t | ntotal |
| total nb of indexed vectors | |
| bool | verbose |
| verbosity level | |
| bool | is_trained |
| set if the Index does not require training, or if training is done already | |
| MetricType | metric_type |
| type of metric this index uses for search | |
Public Attributes inherited from faiss::Level1Quantizer | |
| Index * | quantizer |
| quantizer that maps vectors to inverted lists | |
| size_t | nlist |
| number of possible key values | |
| char | quantizer_trains_alone |
| bool | own_fields |
| whether object owns the quantizer | |
| ClusteringParameters | cp |
| to override default clustering params | |
| Index * | clustering_index |
| to override index used during clustering | |
Additional Inherited Members | |
Public Types inherited from faiss::Index | |
| typedef long | idx_t |
| all indices are this type | |
Definition at line 77 of file IndexIVFFlat.h.
|
overridevirtual |
search a set of vectors, that are pre-quantized by the IVF quantizer. Fill in the corresponding heaps with the query results. The default implementation uses InvertedListScanners to do the search.
| n | nb of vectors to query |
| x | query vectors, size nx * d |
| assign | coarse quantization indices, size nx * nprobe |
| centroid_dis | distances to coarse centroids, size nx * nprobe |
| distance | output distances, size n * k |
| labels | output labels, size n * k |
| store_pairs | store inv list index + inv list offset instead in upper/lower 32 bit of result, instead of ids (used for reranking). |
| params | used to override the object's search parameters |
Reimplemented from faiss::IndexIVF.
Definition at line 371 of file IndexIVFFlat.cpp.
Maps ids stored in the index to the ids of vectors that are the same. When a vector is unique, it does not appear in the instances map
Definition at line 82 of file IndexIVFFlat.h.
1.8.5