#include <IndexScalarQuantizer.h>
Public Member Functions | |
| IndexIVFScalarQuantizer (Index *quantizer, size_t d, size_t nlist, ScalarQuantizer::QuantizerType qtype, MetricType metric=METRIC_L2) | |
| void | train_residual (idx_t n, const float *x) override |
| void | add_with_ids (idx_t n, const float *x, const long *xids) override |
| void | search (idx_t n, const float *x, idx_t k, float *distances, idx_t *labels) const override |
| void | merge_from_residuals (IndexIVF &other) override |
| IndexIVFScalarQuantizer (Index *quantizer, size_t d, size_t nlist, ScalarQuantizer::QuantizerType qtype, MetricType metric=METRIC_L2) | |
| void | train_residual (idx_t n, const float *x) override |
| void | add_with_ids (idx_t n, const float *x, const long *xids) override |
| void | search (idx_t n, const float *x, idx_t k, float *distances, idx_t *labels) const override |
| void | merge_from_residuals (IndexIVF &other) override |
Public Member Functions inherited from faiss::IndexIVF | |
| IndexIVF (Index *quantizer, size_t d, size_t nlist, MetricType metric=METRIC_INNER_PRODUCT) | |
| void | reset () override |
| removes all elements from the database. | |
| void | train (idx_t n, const float *x) override |
| Trains the quantizer and calls train_residual to train sub-quantizers. | |
| void | add (idx_t n, const float *x) override |
| Quantizes x and calls add_with_key. | |
| virtual void | merge_from (IndexIVF &other, idx_t add_id) |
| 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 | |
Public Member Functions inherited from faiss::Index | |
| Index (idx_t d=0, MetricType metric=METRIC_INNER_PRODUCT) | |
| virtual void | range_search (idx_t n, const float *x, float radius, RangeSearchResult *result) const |
| void | assign (idx_t n, const float *x, idx_t *labels, idx_t k=1) |
| virtual long | remove_ids (const IDSelector &sel) |
| virtual void | reconstruct (idx_t key, float *recons) const |
| virtual void | reconstruct_n (idx_t i0, idx_t ni, float *recons) const |
| void | compute_residual (const float *x, float *residual, idx_t key) const |
| void | display () const |
Public Attributes | |
| ScalarQuantizer | sq |
| size_t | code_size |
|
std::vector< std::vector < uint8_t > > | codes |
| inverted list codes. | |
Public Attributes inherited from faiss::IndexIVF | |
| size_t | nlist |
| number of possible key values | |
| size_t | nprobe |
| number of probes at query time | |
| Index * | quantizer |
| quantizer that maps vectors to inverted lists | |
| bool | quantizer_trains_alone |
| just pass over the trainset to quantizer | |
| bool | own_fields |
| whether object owns the quantizer | |
| ClusteringParameters | cp |
| to override default clustering params | |
| std::vector< std::vector< long > > | ids |
| Inverted lists for indexes. | |
| 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 | |
Additional Inherited Members | |
Public Types inherited from faiss::Index | |
| typedef long | idx_t |
| all indices are this type | |
An IVF implementation where the components of the residuals are encoded with a scalar uniform quantizer. All distance computations are asymmetric, so the encoded vectors are decoded and approximate distances are computed.
Definition at line 86 of file IndexIVFScalarQuantizer.h.
|
overridevirtual |
Same as add, but stores xids instead of sequential ids.
The default implementation fails with an assertion, as it is not supported by all indexes.
| xids | if non-null, ids to store for the vectors (size n) |
Reimplemented from faiss::Index.
Definition at line 733 of file IndexIVFScalarQuantizer.cpp.
|
overridevirtual |
Same as add, but stores xids instead of sequential ids.
The default implementation fails with an assertion, as it is not supported by all indexes.
| xids | if non-null, ids to store for the vectors (size n) |
Reimplemented from faiss::Index.
|
overridevirtual |
implemented by sub-classes
Implements faiss::IndexIVF.
Definition at line 882 of file IndexIVFScalarQuantizer.cpp.
|
overridevirtual |
implemented by sub-classes
Implements faiss::IndexIVF.
|
overridevirtual |
query n vectors of dimension d to the index.
return at most k vectors. If there are not enough results for a query, the result array is padded with -1s.
| x | input vectors to search, size n * d |
| labels | output labels of the NNs, size n*k |
| distances | output pairwise distances, size n*k |
Implements faiss::Index.
Definition at line 849 of file IndexIVFScalarQuantizer.cpp.
|
overridevirtual |
query n vectors of dimension d to the index.
return at most k vectors. If there are not enough results for a query, the result array is padded with -1s.
| x | input vectors to search, size n * d |
| labels | output labels of the NNs, size n*k |
| distances | output pairwise distances, size n*k |
Implements faiss::Index.
|
overridevirtual |
Sub-classes that encode the residuals can train their encoders here does nothing by default
Reimplemented from faiss::IndexIVF.
Definition at line 714 of file IndexIVFScalarQuantizer.cpp.
|
overridevirtual |
Sub-classes that encode the residuals can train their encoders here does nothing by default
Reimplemented from faiss::IndexIVF.
1.8.5