Classes | |
| struct | DistanceComputer |
Public Types | |
| typedef int | storage_idx_t |
| internal storage of vectors (32 bits: this is expensive) | |
| typedef faiss::Index::idx_t | idx_t |
| Faiss results are 64-bit. | |
Public Member Functions | |
| void | set_default_probas (int M, float levelMult) |
| void | set_nb_neighbors (int level_no, int n) |
| set nb of neighbors for this level (before adding anything) | |
| int | nb_neighbors (int layer_no) const |
| nb of neighbors for this level | |
| int | cum_nb_neighbors (int layer_no) const |
| cumumlative nb up to (and excluding) this level | |
| void | neighbor_range (idx_t no, int layer_no, size_t *begin, size_t *end) const |
| range of entries in the neighbors table of vertex no at layer_no | |
| HNSW (int M=32) | |
| only mandatory parameter: nb of neighbors | |
| int | random_level () |
| pick a random level for a new point | |
| void | fill_with_random_links (size_t n) |
| add n random levels to table (for debugging...) | |
| void | add_with_locks (DistanceComputer &ptdis, int pt_level, int pt_id, std::vector< omp_lock_t > &locks, VisitedTable &vt) |
| void | search (DistanceComputer &qdis, int k, idx_t *I, float *D, VisitedTable &vt) const |
| search interface | |
| void | reset () |
| void | clear_neighbor_tables (int level) |
| void | print_neighbor_stats (int level) const |
Public Attributes | |
| std::vector< double > | assign_probas |
| assignment probability to each layer (sum=1) | |
| std::vector< int > | cum_nneighbor_per_level |
| std::vector< int > | levels |
| level of each vector (base level = 1), size = ntotal | |
| std::vector< size_t > | offsets |
| std::vector< storage_idx_t > | neighbors |
| storage_idx_t | entry_point |
| entry point in the search structure (one of the points with maximum level | |
| faiss::RandomGenerator | rng |
| int | max_level |
| maximum level | |
| int | efConstruction |
| expansion factor at construction time | |
| int | efSearch |
| expansion factor at search time | |
| bool | check_relative_distance |
| during search: do we check whether the next best distance is good enough? | |
| int | upper_beam |
| number of entry points in levels > 0. | |
Definition at line 40 of file IndexHNSW.h.
| void faiss::HNSW::add_with_locks | ( | DistanceComputer & | ptdis, |
| int | pt_level, | ||
| int | pt_id, | ||
| std::vector< omp_lock_t > & | locks, | ||
| VisitedTable & | vt | ||
| ) |
add point pt_id on all levels <= pt_level and build the link structure for them.
Definition at line 657 of file IndexHNSW.cpp.
| void faiss::HNSW::set_default_probas | ( | int | M, |
| float | levelMult | ||
| ) |
initialize the assign_probas and cum_nneighbor_per_level to have 2*M links on level 0 and M links on levels > 0
Definition at line 553 of file IndexHNSW.cpp.
| std::vector<int> faiss::HNSW::cum_nneighbor_per_level |
number of neighbors stored per layer (cumulative), should not be changed after first add
Definition at line 74 of file IndexHNSW.h.
| std::vector<storage_idx_t> faiss::HNSW::neighbors |
neighbors[offsets[i]:offsets[i+1]] is the list of neighbors of vector i for all levels. this is where all storage goes.
Definition at line 85 of file IndexHNSW.h.
| std::vector<size_t> faiss::HNSW::offsets |
offsets[i] is the offset in the neighbors array where vector i is stored size ntotal + 1
Definition at line 81 of file IndexHNSW.h.
1.8.5