<divclass="line"><aname="l00005"></a><spanclass="lineno"> 5</span> <spanclass="comment"> * This source code is licensed under the BSD+Patents license found in the</span></div>
<divclass="line"><aname="l00006"></a><spanclass="lineno"> 6</span> <spanclass="comment"> * LICENSE file in the root directory of this source tree.</span></div>
<divclass="line"><aname="l00027"></a><spanclass="lineno"> 27</span> <spanclass="comment">/** Encapsulates a quantizer object for the IndexIVF</span></div>
<divclass="line"><aname="l00029"></a><spanclass="lineno"> 29</span> <spanclass="comment"> * The class isolates the fields that are independent of the storage</span></div>
<divclass="line"><aname="l00030"></a><spanclass="lineno"> 30</span> <spanclass="comment"> * of the lists (especially training)</span></div>
<divclass="line"><aname="l00033"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1Level1Quantizer.html#a3cf99e2ee92b8558a066f821efab95d5"> 33</a></span> <aclass="code"href="structfaiss_1_1Index.html">Index</a> * <aclass="code"href="structfaiss_1_1Level1Quantizer.html#a3cf99e2ee92b8558a066f821efab95d5">quantizer</a>; <spanclass="comment">///< quantizer that maps vectors to inverted lists</span></div>
<divclass="line"><aname="l00034"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1Level1Quantizer.html#a1c4fc9d874d9492ee0ea27a5be388fa7"> 34</a></span> <spanclass="comment"></span><spanclass="keywordtype">size_t</span><aclass="code"href="structfaiss_1_1Level1Quantizer.html#a1c4fc9d874d9492ee0ea27a5be388fa7">nlist</a>; <spanclass="comment">///< number of possible key values</span></div>
<divclass="line"><aname="l00037"></a><spanclass="lineno"> 37</span> <spanclass="comment"> * = 0: use the quantizer as index in a kmeans training</span></div>
<divclass="line"><aname="l00038"></a><spanclass="lineno"> 38</span> <spanclass="comment"> * = 1: just pass on the training set to the train() of the quantizer</span></div>
<divclass="line"><aname="l00039"></a><spanclass="lineno"> 39</span> <spanclass="comment"> * = 2: kmeans training on a flat index + add the centroids to the quantizer</span></div>
<divclass="line"><aname="l00044"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1Level1Quantizer.html#abb7097ed40b15ba0af08af6d03608f72"> 44</a></span> <aclass="code"href="structfaiss_1_1ClusteringParameters.html">ClusteringParameters</a><aclass="code"href="structfaiss_1_1Level1Quantizer.html#abb7097ed40b15ba0af08af6d03608f72">cp</a>; <spanclass="comment">///< to override default clustering params</span></div>
<divclass="line"><aname="l00045"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1Level1Quantizer.html#a45d29dd6a5c53789c08e5ceb3f63d989"> 45</a></span> <spanclass="comment"></span><aclass="code"href="structfaiss_1_1Index.html">Index</a> *<aclass="code"href="structfaiss_1_1Level1Quantizer.html#a45d29dd6a5c53789c08e5ceb3f63d989">clustering_index</a>; <spanclass="comment">///< to override index used during clustering</span></div>
<divclass="line"><aname="l00047"></a><spanclass="lineno"> 47</span> <spanclass="comment"> /// Trains the quantizer and calls train_residual to train sub-quantizers</span></div>
<divclass="line"><aname="l00048"></a><spanclass="lineno"> 48</span> <spanclass="comment"></span><spanclass="keywordtype">void</span><aclass="code"href="structfaiss_1_1Level1Quantizer.html#a0069a6ee1e32c2e0c1c7df9a95740dd4">train_q1</a> (<spanclass="keywordtype">size_t</span> n, <spanclass="keyword">const</span><spanclass="keywordtype">float</span> *x, <spanclass="keywordtype">bool</span> verbose,</div>
<divclass="line"><aname="l00062"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1IVFSearchParameters.html#a1183c0b7d9ffd5154b32765175f2a9cc"> 62</a></span> <spanclass="keywordtype">size_t</span><aclass="code"href="structfaiss_1_1IVFSearchParameters.html#a1183c0b7d9ffd5154b32765175f2a9cc">nprobe</a>; <spanclass="comment">///< number of probes at query time</span></div>
<divclass="line"><aname="l00063"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1IVFSearchParameters.html#ac3e01728f6376ad727340525b2138782"> 63</a></span> <spanclass="comment"></span><spanclass="keywordtype">size_t</span><aclass="code"href="structfaiss_1_1IVFSearchParameters.html#ac3e01728f6376ad727340525b2138782">max_codes</a>; <spanclass="comment">///< max nb of codes to visit to do a query</span></div>
<divclass="line"><aname="l00073"></a><spanclass="lineno"> 73</span> <spanclass="comment"> * In the inverted file, the quantizer (an Index instance) provides a</span></div>
<divclass="line"><aname="l00074"></a><spanclass="lineno"> 74</span> <spanclass="comment"> * quantization index for each vector to be added. The quantization</span></div>
<divclass="line"><aname="l00075"></a><spanclass="lineno"> 75</span> <spanclass="comment"> * index maps to a list (aka inverted list or posting list), where the</span></div>
<divclass="line"><aname="l00076"></a><spanclass="lineno"> 76</span> <spanclass="comment"> * id of the vector is stored.</span></div>
<divclass="line"><aname="l00078"></a><spanclass="lineno"> 78</span> <spanclass="comment"> * The inverted list object is required only after trainng. If none is</span></div>
<divclass="line"><aname="l00079"></a><spanclass="lineno"> 79</span> <spanclass="comment"> * set externally, an ArrayInvertedLists is used automatically.</span></div>
<divclass="line"><aname="l00081"></a><spanclass="lineno"> 81</span> <spanclass="comment"> * At search time, the vector to be searched is also quantized, and</span></div>
<divclass="line"><aname="l00082"></a><spanclass="lineno"> 82</span> <spanclass="comment"> * only the list corresponding to the quantization index is</span></div>
<divclass="line"><aname="l00083"></a><spanclass="lineno"> 83</span> <spanclass="comment"> * searched. This speeds up the search by making it</span></div>
<divclass="line"><aname="l00084"></a><spanclass="lineno"> 84</span> <spanclass="comment"> * non-exhaustive. This can be relaxed using multi-probe search: a few</span></div>
<divclass="line"><aname="l00085"></a><spanclass="lineno"> 85</span> <spanclass="comment"> * (nprobe) quantization indices are selected and several inverted</span></div>
<divclass="line"><aname="l00086"></a><spanclass="lineno"> 86</span> <spanclass="comment"> * lists are visited.</span></div>
<divclass="line"><aname="l00088"></a><spanclass="lineno"> 88</span> <spanclass="comment"> * Sub-classes implement a post-filtering of the index that refines</span></div>
<divclass="line"><aname="l00089"></a><spanclass="lineno"> 89</span> <spanclass="comment"> * the distance estimation from the query to databse vectors.</span></div>
<divclass="line"><aname="l00096"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1IndexIVF.html#a46d1aeddb60643c5b3f096147c3e028f"> 96</a></span> <spanclass="keywordtype">size_t</span><aclass="code"href="structfaiss_1_1IndexIVF.html#a46d1aeddb60643c5b3f096147c3e028f">code_size</a>; <spanclass="comment">///< code size per vector in bytes</span></div>
<divclass="line"><aname="l00098"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1IndexIVF.html#affed235eadf27a13d753ee4d33a1dc58"> 98</a></span> <spanclass="keywordtype">size_t</span><aclass="code"href="structfaiss_1_1IndexIVF.html#affed235eadf27a13d753ee4d33a1dc58">nprobe</a>; <spanclass="comment">///< number of probes at query time</span></div>
<divclass="line"><aname="l00099"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1IndexIVF.html#a7f2dd34f66f8770acba74a0a591fa4a8"> 99</a></span> <spanclass="comment"></span><spanclass="keywordtype">size_t</span><aclass="code"href="structfaiss_1_1IndexIVF.html#a7f2dd34f66f8770acba74a0a591fa4a8">max_codes</a>; <spanclass="comment">///< max nb of codes to visit to do a query</span></div>
<divclass="line"><aname="l00101"></a><spanclass="lineno"> 101</span> <spanclass="comment"> /// map for direct access to the elements. Enables reconstruct().</span></div>
<divclass="line"><aname="l00105"></a><spanclass="lineno"> 105</span> <spanclass="comment"> /** The Inverted file takes a quantizer (an Index) on input,</span></div>
<divclass="line"><aname="l00106"></a><spanclass="lineno"> 106</span> <spanclass="comment"> * which implements the function mapping a vector to a list</span></div>
<divclass="line"><aname="l00107"></a><spanclass="lineno"> 107</span> <spanclass="comment"> * identifier. The pointer is borrowed: the quantizer should not</span></div>
<divclass="line"><aname="l00108"></a><spanclass="lineno"> 108</span> <spanclass="comment"> * be deleted while the IndexIVF is in use.</span></div>
<divclass="line"><aname="l00116"></a><spanclass="lineno"> 116</span> <spanclass="comment"> /// Trains the quantizer and calls train_residual to train sub-quantizers</span></div>
<divclass="line"><aname="l00117"></a><spanclass="lineno"> 117</span> <spanclass="comment"></span><spanclass="keywordtype">void</span><aclass="code"href="structfaiss_1_1IndexIVF.html#a7a1d5eec194db0977b2318c6ed6a2b86">train</a>(<aclass="code"href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> n, <spanclass="keyword">const</span><spanclass="keywordtype">float</span>* x) <spanclass="keyword">override</span>;</div>
<divclass="line"><aname="l00122"></a><spanclass="lineno"> 122</span> <spanclass="comment"> /** Encodes a set of vectors as they would appear in the inverted lists</span></div>
<divclass="line"><aname="l00124"></a><spanclass="lineno"> 124</span> <spanclass="comment"> * @param list_nos inverted list ids as returned by the</span></div>
<divclass="line"><aname="l00125"></a><spanclass="lineno"> 125</span> <spanclass="comment"> * quantizer (size n). -1s are ignored.</span></div>
<divclass="line"><aname="l00128"></a><spanclass="lineno"> 128</span> <spanclass="keyword">virtual</span><spanclass="keywordtype">void</span><aclass="code"href="structfaiss_1_1IndexIVF.html#a2f16f939a418d8e58ff43f4ee0dc17cc">encode_vectors</a>(<aclass="code"href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> n, <spanclass="keyword">const</span><spanclass="keywordtype">float</span>* x,</div>
<divclass="line"><aname="l00132"></a><spanclass="lineno"> 132</span> <spanclass="comment"> /// Sub-classes that encode the residuals can train their encoders here</span></div>
<divclass="line"><aname="l00133"></a><spanclass="lineno"> 133</span> <spanclass="comment"> /// does nothing by default</span></div>
<divclass="line"><aname="l00134"></a><spanclass="lineno"> 134</span> <spanclass="comment"></span><spanclass="keyword">virtual</span><spanclass="keywordtype">void</span><aclass="code"href="structfaiss_1_1IndexIVF.html#a567ef760fd09d09ce2ee4f4e6c2d7280">train_residual</a> (<aclass="code"href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> n, <spanclass="keyword">const</span><spanclass="keywordtype">float</span> *x);</div>
<divclass="line"><aname="l00136"></a><spanclass="lineno"> 136</span> <spanclass="comment"> /** search a set of vectors, that are pre-quantized by the IVF</span></div>
<divclass="line"><aname="l00137"></a><spanclass="lineno"> 137</span> <spanclass="comment"> * quantizer. Fill in the corresponding heaps with the query</span></div>
<divclass="line"><aname="l00138"></a><spanclass="lineno"> 138</span> <spanclass="comment"> * results. The default implementation uses InvertedListScanners</span></div>
<divclass="line"><aname="l00139"></a><spanclass="lineno"> 139</span> <spanclass="comment"> * to do the search.</span></div>
<divclass="line"><aname="l00149"></a><spanclass="lineno"> 149</span> <spanclass="comment"> * @param store_pairs store inv list index + inv list offset</span></div>
<divclass="line"><aname="l00150"></a><spanclass="lineno"> 150</span> <spanclass="comment"> * instead in upper/lower 32 bit of result,</span></div>
<divclass="line"><aname="l00151"></a><spanclass="lineno"> 151</span> <spanclass="comment"> * instead of ids (used for reranking).</span></div>
<divclass="line"><aname="l00152"></a><spanclass="lineno"> 152</span> <spanclass="comment"> * @param params used to override the object's search parameters</span></div>
<divclass="line"><aname="l00162"></a><spanclass="lineno"> 162</span> <spanclass="comment"> /** assign the vectors, then call search_preassign */</span></div>
<divclass="line"><aname="l00163"></a><spanclass="lineno"> 163</span> <spanclass="keyword">virtual</span><spanclass="keywordtype">void</span><aclass="code"href="structfaiss_1_1IndexIVF.html#ae2fd47b7d52603659e269aa8f6abb613">search</a> (<aclass="code"href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> n, <spanclass="keyword">const</span><spanclass="keywordtype">float</span> *x, <aclass="code"href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> k,</div>
<divclass="line"><aname="l00166"></a><spanclass="lineno"> 166</span> <spanclass="comment"> /// get a scanner for this index (store_pairs means ignore labels)</span></div>
<divclass="line"><aname="l00174"></a><spanclass="lineno"> 174</span> <spanclass="comment"> /** Reconstruct a subset of the indexed vectors.</span></div>
<divclass="line"><aname="l00185"></a><spanclass="lineno"> 185</span> <spanclass="comment"> /** Similar to search, but also reconstructs the stored vectors (or an</span></div>
<divclass="line"><aname="l00186"></a><spanclass="lineno"> 186</span> <spanclass="comment"> * approximation in the case of lossy coding) for the search results.</span></div>
<divclass="line"><aname="l00188"></a><spanclass="lineno"> 188</span> <spanclass="comment"> * Overrides default implementation to avoid having to maintain direct_map</span></div>
<divclass="line"><aname="l00189"></a><spanclass="lineno"> 189</span> <spanclass="comment"> * and instead fetch the code offsets through the `store_pairs` flag in</span></div>
<divclass="line"><aname="l00198"></a><spanclass="lineno"> 198</span> <spanclass="comment"> /** Reconstruct a vector given the location in terms of (inv list index +</span></div>
<divclass="line"><aname="l00199"></a><spanclass="lineno"> 199</span> <spanclass="comment"> * inv list offset) instead of the id.</span></div>
<divclass="line"><aname="l00201"></a><spanclass="lineno"> 201</span> <spanclass="comment"> * Useful for reconstructing when the direct_map is not maintained and</span></div>
<divclass="line"><aname="l00202"></a><spanclass="lineno"> 202</span> <spanclass="comment"> * the inv list offset is computed by search_preassigned() with</span></div>
<divclass="line"><aname="l00213"></a><spanclass="lineno"> 213</span> <spanclass="comment"> /** check that the two indexes are compatible (ie, they are</span></div>
<divclass="line"><aname="l00214"></a><spanclass="lineno"> 214</span> <spanclass="comment"> * trained in the same way and have the same</span></div>
<divclass="line"><aname="l00218"></a><spanclass="lineno"> 218</span> <spanclass="comment"> /** moves the entries from another dataset to self. On output,</span></div>
<divclass="line"><aname="l00219"></a><spanclass="lineno"> 219</span> <spanclass="comment"> * other is empty. add_id is added to all moved ids (for</span></div>
<divclass="line"><aname="l00220"></a><spanclass="lineno"> 220</span> <spanclass="comment"> * sequential ids, this would be this->ntotal */</span></div>
<divclass="line"><aname="l00223"></a><spanclass="lineno"> 223</span> <spanclass="comment"> /** copy a subset of the entries index to the other index</span></div>
<divclass="line"><aname="l00225"></a><spanclass="lineno"> 225</span> <spanclass="comment"> * if subset_type == 0: copies ids in [a1, a2)</span></div>
<divclass="line"><aname="l00226"></a><spanclass="lineno"> 226</span> <spanclass="comment"> * if subset_type == 1: copies ids if id % a1 == a2</span></div>
<divclass="line"><aname="l00227"></a><spanclass="lineno"> 227</span> <spanclass="comment"> * if subset_type == 2: copies inverted lists such that a1</span></div>
<divclass="line"><aname="l00228"></a><spanclass="lineno"> 228</span> <spanclass="comment"> * elements are left before and a2 elements are after</span></div>
<divclass="line"><aname="l00240"></a><spanclass="lineno"> 240</span> <spanclass="comment"> * @param new_maintain_direct_map if true, create a direct map,</span></div>
<divclass="line"><aname="l00248"></a><spanclass="lineno"> 248</span> <spanclass="comment"> /// display some stats about the inverted lists</span></div>
<divclass="line"><aname="l00251"></a><spanclass="lineno"> 251</span> <spanclass="comment"> /// replace the inverted lists, old one is deallocated if own_invlists</span></div>
<divclass="line"><aname="l00257"></a><spanclass="lineno"> 257</span> <spanclass="comment">/** Object that handles a query. The inverted lists to scan are</span></div>
<divclass="line"><aname="l00258"></a><spanclass="lineno"> 258</span> <spanclass="comment"> * provided externally. The object has a lot of state, but</span></div>
<divclass="line"><aname="l00259"></a><spanclass="lineno"> 259</span> <spanclass="comment"> * distance_to_code and scan_codes can be called in multiple</span></div>
<divclass="line"><aname="l00268"></a><spanclass="lineno"> 268</span> <spanclass="comment"> /// following codes come from this inverted list</span></div>
<divclass="line"><aname="l00271"></a><spanclass="lineno"> 271</span> <spanclass="comment"> /// compute a single query-to-code distance</span></div>
<divclass="line"><aname="l00274"></a><spanclass="lineno"> 274</span> <spanclass="comment"> /** compute the distances to codes. (distances, labels) should be</span></div>
<divclass="line"><aname="l00275"></a><spanclass="lineno"> 275</span> <spanclass="comment"> * organized ad a min- or max-heap</span></div>
<divclass="line"><aname="l00296"></a><spanclass="lineno"> 296</span> <spanclass="keywordtype">size_t</span> nq; <spanclass="comment">// nb of queries run</span></div>
<divclass="line"><aname="l00297"></a><spanclass="lineno"> 297</span> <spanclass="keywordtype">size_t</span> nlist; <spanclass="comment">// nb of inverted lists scanned</span></div>
<divclass="line"><aname="l00298"></a><spanclass="lineno"> 298</span> <spanclass="keywordtype">size_t</span> ndis; <spanclass="comment">// nb of distancs computed</span></div>
<divclass="line"><aname="l00299"></a><spanclass="lineno"> 299</span> <spanclass="keywordtype">size_t</span> nheap_updates; <spanclass="comment">// nb of times the heap was updated</span></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_a2fc63f9bbfe64e05106366465ece2187"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#a2fc63f9bbfe64e05106366465ece2187">faiss::IndexIVF::copy_subset_to</a></div><divclass="ttdeci">virtual void copy_subset_to(IndexIVF &other, int subset_type, long a1, long a2) const </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8cpp_source.html#l00499">IndexIVF.cpp:499</a></div></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_aac87273dafff2027d4bcf706e1c7d83f"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#aac87273dafff2027d4bcf706e1c7d83f">faiss::IndexIVF::reconstruct_from_offset</a></div><divclass="ttdeci">virtual void reconstruct_from_offset(long list_no, long offset, float *recons) const </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8cpp_source.html#l00353">IndexIVF.cpp:353</a></div></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_affed235eadf27a13d753ee4d33a1dc58"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#affed235eadf27a13d753ee4d33a1dc58">faiss::IndexIVF::nprobe</a></div><divclass="ttdeci">size_t nprobe</div><divclass="ttdoc">number of probes at query time </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8h_source.html#l00098">IndexIVF.h:98</a></div></div>
<divclass="ttc"id="structfaiss_1_1Index_html_a8bc5d8d1cd0dd7b34b3c98a9f76b4a9c"><divclass="ttname"><ahref="structfaiss_1_1Index.html#a8bc5d8d1cd0dd7b34b3c98a9f76b4a9c">faiss::Index::assign</a></div><divclass="ttdeci">void assign(idx_t n, const float *x, idx_t *labels, idx_t k=1)</div><divclass="ttdef"><b>Definition:</b><ahref="Index_8cpp_source.html#l00035">Index.cpp:35</a></div></div>
<divclass="ttc"id="structfaiss_1_1InvertedLists_html_a9bd256053ee360473842105460fe285f"><divclass="ttname"><ahref="structfaiss_1_1InvertedLists.html#a9bd256053ee360473842105460fe285f">faiss::InvertedLists::list_size</a></div><divclass="ttdeci">virtual size_t list_size(size_t list_no) const =0</div><divclass="ttdoc">get the size of a list </div></div>
<divclass="ttc"id="structfaiss_1_1InvertedListScanner_html_ade9518f1b0ee00c2a43a2eb2ae350ae1"><divclass="ttname"><ahref="structfaiss_1_1InvertedListScanner.html#ade9518f1b0ee00c2a43a2eb2ae350ae1">faiss::InvertedListScanner::distance_to_code</a></div><divclass="ttdeci">virtual float distance_to_code(const uint8_t *code) const =0</div><divclass="ttdoc">compute a single query-to-code distance </div></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_a7a1d5eec194db0977b2318c6ed6a2b86"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#a7a1d5eec194db0977b2318c6ed6a2b86">faiss::IndexIVF::train</a></div><divclass="ttdeci">void train(idx_t n, const float *x) override</div><divclass="ttdoc">Trains the quantizer and calls train_residual to train sub-quantizers. </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8cpp_source.html#l00408">IndexIVF.cpp:408</a></div></div>
<divclass="ttc"id="structfaiss_1_1InvertedListScanner_html_ae801ea7ba0086a05ace3b779c3acf305"><divclass="ttname"><ahref="structfaiss_1_1InvertedListScanner.html#ae801ea7ba0086a05ace3b779c3acf305">faiss::InvertedListScanner::set_list</a></div><divclass="ttdeci">virtual void set_list(idx_t list_no, float coarse_dis)=0</div><divclass="ttdoc">following codes come from this inverted list </div></div>
<divclass="ttc"id="structfaiss_1_1Index_html_a040c6aed1f224f3ea7bf58eebc0c31a4"><divclass="ttname"><ahref="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">faiss::Index::idx_t</a></div><divclass="ttdeci">long idx_t</div><divclass="ttdoc">all indices are this type </div><divclass="ttdef"><b>Definition:</b><ahref="Index_8h_source.html#l00064">Index.h:64</a></div></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_a4eb943aeb7df30d44ad9b665452bfcf7"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#a4eb943aeb7df30d44ad9b665452bfcf7">faiss::IndexIVF::replace_invlists</a></div><divclass="ttdeci">void replace_invlists(InvertedLists *il, bool own=false)</div><divclass="ttdoc">replace the inverted lists, old one is deallocated if own_invlists </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8cpp_source.html#l00486">IndexIVF.cpp:486</a></div></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_a47a3b7665e9d2be41c6d3b2e9144b73f"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#a47a3b7665e9d2be41c6d3b2e9144b73f">faiss::IndexIVF::reset</a></div><divclass="ttdeci">void reset() override</div><divclass="ttdoc">removes all elements from the database. </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8cpp_source.html#l00360">IndexIVF.cpp:360</a></div></div>
<divclass="ttc"id="structfaiss_1_1Level1Quantizer_html_a45d29dd6a5c53789c08e5ceb3f63d989"><divclass="ttname"><ahref="structfaiss_1_1Level1Quantizer.html#a45d29dd6a5c53789c08e5ceb3f63d989">faiss::Level1Quantizer::clustering_index</a></div><divclass="ttdeci">Index * clustering_index</div><divclass="ttdoc">to override index used during clustering </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8h_source.html#l00045">IndexIVF.h:45</a></div></div>
<divclass="ttc"id="structfaiss_1_1Level1Quantizer_html_a0069a6ee1e32c2e0c1c7df9a95740dd4"><divclass="ttname"><ahref="structfaiss_1_1Level1Quantizer.html#a0069a6ee1e32c2e0c1c7df9a95740dd4">faiss::Level1Quantizer::train_q1</a></div><divclass="ttdeci">void train_q1(size_t n, const float *x, bool verbose, MetricType metric_type)</div><divclass="ttdoc">Trains the quantizer and calls train_residual to train sub-quantizers. </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8cpp_source.html#l00057">IndexIVF.cpp:57</a></div></div>
<divclass="ttc"id="structfaiss_1_1IVFSearchParameters_html_a1183c0b7d9ffd5154b32765175f2a9cc"><divclass="ttname"><ahref="structfaiss_1_1IVFSearchParameters.html#a1183c0b7d9ffd5154b32765175f2a9cc">faiss::IVFSearchParameters::nprobe</a></div><divclass="ttdeci">size_t nprobe</div><divclass="ttdoc">number of probes at query time </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8h_source.html#l00062">IndexIVF.h:62</a></div></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_a513dfec3a250f08a9fdd18a24178e6bb"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#a513dfec3a250f08a9fdd18a24178e6bb">faiss::IndexIVF::print_stats</a></div><divclass="ttdeci">void print_stats() const </div><divclass="ttdoc">display some stats about the inverted lists </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8cpp_source.html#l00440">IndexIVF.cpp:440</a></div></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_aa0e8fc5e04cbd8e0dde61f98bc7dd0bc"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#aa0e8fc5e04cbd8e0dde61f98bc7dd0bc">faiss::IndexIVF::invlists</a></div><divclass="ttdeci">InvertedLists * invlists</div><divclass="ttdoc">Acess to the actual data. </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8h_source.html#l00093">IndexIVF.h:93</a></div></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_a821002a9d3a1a74dc8d6f6072eca4075"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#a821002a9d3a1a74dc8d6f6072eca4075">faiss::IndexIVF::add</a></div><divclass="ttdeci">void add(idx_t n, const float *x) override</div><divclass="ttdoc">Calls add_with_ids with NULL ids. </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8cpp_source.html#l00139">IndexIVF.cpp:139</a></div></div>
<divclass="ttc"id="structfaiss_1_1IVFSearchParameters_html_ac3e01728f6376ad727340525b2138782"><divclass="ttname"><ahref="structfaiss_1_1IVFSearchParameters.html#ac3e01728f6376ad727340525b2138782">faiss::IVFSearchParameters::max_codes</a></div><divclass="ttdeci">size_t max_codes</div><divclass="ttdoc">max nb of codes to visit to do a query </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8h_source.html#l00063">IndexIVF.h:63</a></div></div>
<divclass="ttc"id="structfaiss_1_1Level1Quantizer_html_a3cf99e2ee92b8558a066f821efab95d5"><divclass="ttname"><ahref="structfaiss_1_1Level1Quantizer.html#a3cf99e2ee92b8558a066f821efab95d5">faiss::Level1Quantizer::quantizer</a></div><divclass="ttdeci">Index * quantizer</div><divclass="ttdoc">quantizer that maps vectors to inverted lists </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8h_source.html#l00033">IndexIVF.h:33</a></div></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_a7f2dd34f66f8770acba74a0a591fa4a8"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#a7f2dd34f66f8770acba74a0a591fa4a8">faiss::IndexIVF::max_codes</a></div><divclass="ttdeci">size_t max_codes</div><divclass="ttdoc">max nb of codes to visit to do a query </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8h_source.html#l00099">IndexIVF.h:99</a></div></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_a3fc6ef4f20616dd86323ec1f89e51217"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#a3fc6ef4f20616dd86323ec1f89e51217">faiss::IndexIVF::get_InvertedListScanner</a></div><divclass="ttdeci">virtual InvertedListScanner * get_InvertedListScanner(bool store_pairs=false) const </div><divclass="ttdoc">get a scanner for this index (store_pairs means ignore labels) </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8h_source.html#l00167">IndexIVF.h:167</a></div></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_aedd0c14b5654295b291638ec7f9f9517"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#aedd0c14b5654295b291638ec7f9f9517">faiss::IndexIVF::maintain_direct_map</a></div><divclass="ttdeci">bool maintain_direct_map</div><divclass="ttdoc">map for direct access to the elements. Enables reconstruct(). </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8h_source.html#l00102">IndexIVF.h:102</a></div></div>
<divclass="ttc"id="structfaiss_1_1InvertedListScanner_html_a97cab8fbf8203bdda6c42fc4b8f92319"><divclass="ttname"><ahref="structfaiss_1_1InvertedListScanner.html#a97cab8fbf8203bdda6c42fc4b8f92319">faiss::InvertedListScanner::set_query</a></div><divclass="ttdeci">virtual void set_query(const float *query_vector)=0</div><divclass="ttdoc">from now on we handle this query. </div></div>
<divclass="ttc"id="structfaiss_1_1Level1Quantizer_html_a1c4fc9d874d9492ee0ea27a5be388fa7"><divclass="ttname"><ahref="structfaiss_1_1Level1Quantizer.html#a1c4fc9d874d9492ee0ea27a5be388fa7">faiss::Level1Quantizer::nlist</a></div><divclass="ttdeci">size_t nlist</div><divclass="ttdoc">number of possible key values </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8h_source.html#l00034">IndexIVF.h:34</a></div></div>
<divclass="ttc"id="structfaiss_1_1IndexIVF_html_a46d1aeddb60643c5b3f096147c3e028f"><divclass="ttname"><ahref="structfaiss_1_1IndexIVF.html#a46d1aeddb60643c5b3f096147c3e028f">faiss::IndexIVF::code_size</a></div><divclass="ttdeci">size_t code_size</div><divclass="ttdoc">code size per vector in bytes </div><divclass="ttdef"><b>Definition:</b><ahref="IndexIVF_8h_source.html#l00096">IndexIVF.h:96</a></div></div>
<divclass="ttc"id="namespacefaiss_html_afd12191c638da74760ff397cf319752c"><divclass="ttname"><ahref="namespacefaiss.html#afd12191c638da74760ff397cf319752c">faiss::MetricType</a></div><divclass="ttdeci">MetricType</div><divclass="ttdoc">Some algorithms support both an inner product version and a L2 search version. </div><divclass="ttdef"><b>Definition:</b><ahref="Index_8h_source.html#l00045">Index.h:45</a></div></div>