<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"> * Throughout the library, vectors are provided as float * pointers.</span></div>
<divclass="line"><aname="l00028"></a><spanclass="lineno"> 28</span> <spanclass="comment"> * Most algorithms can be optimized when several vectors are processed</span></div>
<divclass="line"><aname="l00029"></a><spanclass="lineno"> 29</span> <spanclass="comment"> * (added/searched) together in a batch. In this case, they are passed</span></div>
<divclass="line"><aname="l00030"></a><spanclass="lineno"> 30</span> <spanclass="comment"> * in as a matrix. When n vectors of size d are provided as float * x,</span></div>
<divclass="line"><aname="l00031"></a><spanclass="lineno"> 31</span> <spanclass="comment"> * component j of vector i is</span></div>
<divclass="line"><aname="l00035"></a><spanclass="lineno"> 35</span> <spanclass="comment"> * where 0 <= i < n and 0 <= j < d. In other words, matrices are</span></div>
<divclass="line"><aname="l00036"></a><spanclass="lineno"> 36</span> <spanclass="comment"> * always compact. When specifying the size of the matrix, we call it</span></div>
<divclass="line"><aname="l00037"></a><spanclass="lineno"> 37</span> <spanclass="comment"> * an n*d matrix, which implies a row-major storage.</span></div>
<divclass="line"><aname="l00044"></a><spanclass="lineno"> 44</span> <spanclass="comment">/// Some algorithms support both an inner product version and a L2 search version.</span></div>
<divclass="line"><aname="l00059"></a><spanclass="lineno"> 59</span> <spanclass="comment"> * Currently only asymmetric queries are supported:</span></div>
<divclass="line"><aname="l00060"></a><spanclass="lineno"> 60</span> <spanclass="comment"> * database-to-database queries are not implemented.</span></div>
<divclass="line"><aname="l00064"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4"> 64</a></span> <spanclass="keyword">typedef</span><spanclass="keywordtype">long</span><aclass="code"href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a>; <spanclass="comment">///< all indices are this type</span></div>
<divclass="line"><aname="l00067"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1Index.html#a6970683faa021b7a6f1a0865c0d4eccd"> 67</a></span> <spanclass="comment"></span><aclass="code"href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a><aclass="code"href="structfaiss_1_1Index.html#a6970683faa021b7a6f1a0865c0d4eccd">ntotal</a>; <spanclass="comment">///< total nb of indexed vectors</span></div>
<divclass="line"><aname="l00070"></a><spanclass="lineno"> 70</span> <spanclass="comment"> /// set if the Index does not require training, or if training is done already</span></div>
<divclass="line"><aname="l00073"></a><spanclass="lineno"> 73</span> <spanclass="comment"> /// type of metric this index uses for search</span></div>
<divclass="line"><aname="l00086"></a><spanclass="lineno"> 86</span> <spanclass="comment"> /** Perform training on a representative set of vectors</span></div>
<divclass="line"><aname="l00091"></a><spanclass="lineno"> 91</span> <spanclass="keyword">virtual</span><spanclass="keywordtype">void</span><aclass="code"href="structfaiss_1_1Index.html#abf601502bdbfa02b9d7bcd7b3671b71d">train</a>(idx_t n, <spanclass="keyword">const</span><spanclass="keywordtype">float</span>* x);</div>
<divclass="line"><aname="l00093"></a><spanclass="lineno"> 93</span> <spanclass="comment"> /** Add n vectors of dimension d to the index.</span></div>
<divclass="line"><aname="l00095"></a><spanclass="lineno"> 95</span> <spanclass="comment"> * Vectors are implicitly assigned labels ntotal .. ntotal + n - 1</span></div>
<divclass="line"><aname="l00096"></a><spanclass="lineno"> 96</span> <spanclass="comment"> * This function slices the input vectors in chuncks smaller than</span></div>
<divclass="line"><aname="l00097"></a><spanclass="lineno"> 97</span> <spanclass="comment"> * blocksize_add and calls add_core.</span></div>
<divclass="line"><aname="l00098"></a><spanclass="lineno"> 98</span> <spanclass="comment"> * @param x input matrix, size n * d</span></div>
<divclass="line"><aname="l00102"></a><spanclass="lineno"> 102</span> <spanclass="comment"> /** Same as add, but stores xids instead of sequential ids.</span></div>
<divclass="line"><aname="l00104"></a><spanclass="lineno"> 104</span> <spanclass="comment"> * The default implementation fails with an assertion, as it is</span></div>
<divclass="line"><aname="l00105"></a><spanclass="lineno"> 105</span> <spanclass="comment"> * not supported by all indexes.</span></div>
<divclass="line"><aname="l00107"></a><spanclass="lineno"> 107</span> <spanclass="comment"> * @param xids if non-null, ids to store for the vectors (size n)</span></div>
<divclass="line"><aname="l00111"></a><spanclass="lineno"> 111</span> <spanclass="comment"> /** query n vectors of dimension d to the index.</span></div>
<divclass="line"><aname="l00113"></a><spanclass="lineno"> 113</span> <spanclass="comment"> * return at most k vectors. If there are not enough results for a</span></div>
<divclass="line"><aname="l00114"></a><spanclass="lineno"> 114</span> <spanclass="comment"> * query, the result array is padded with -1s.</span></div>
<divclass="line"><aname="l00116"></a><spanclass="lineno"> 116</span> <spanclass="comment"> * @param x input vectors to search, size n * d</span></div>
<divclass="line"><aname="l00117"></a><spanclass="lineno"> 117</span> <spanclass="comment"> * @param labels output labels of the NNs, size n*k</span></div>
<divclass="line"><aname="l00123"></a><spanclass="lineno"> 123</span> <spanclass="comment"> /** query n vectors of dimension d to the index.</span></div>
<divclass="line"><aname="l00125"></a><spanclass="lineno"> 125</span> <spanclass="comment"> * return all vectors with distance < radius. Note that many</span></div>
<divclass="line"><aname="l00126"></a><spanclass="lineno"> 126</span> <spanclass="comment"> * indexes do not implement the range_search (only the k-NN search</span></div>
<divclass="line"><aname="l00127"></a><spanclass="lineno"> 127</span> <spanclass="comment"> * is mandatory).</span></div>
<divclass="line"><aname="l00129"></a><spanclass="lineno"> 129</span> <spanclass="comment"> * @param x input vectors to search, size n * d</span></div>
<divclass="line"><aname="l00136"></a><spanclass="lineno"> 136</span> <spanclass="comment"> /** return the indexes of the k vectors closest to the query x.</span></div>
<divclass="line"><aname="l00138"></a><spanclass="lineno"> 138</span> <spanclass="comment"> * This function is identical as search but only return labels of neighbors.</span></div>
<divclass="line"><aname="l00139"></a><spanclass="lineno"> 139</span> <spanclass="comment"> * @param x input vectors to search, size n * d</span></div>
<divclass="line"><aname="l00140"></a><spanclass="lineno"> 140</span> <spanclass="comment"> * @param labels output labels of the NNs, size n*k</span></div>
<divclass="line"><aname="l00144"></a><spanclass="lineno"> 144</span> <spanclass="comment"> /// removes all elements from the database.</span></div>
<divclass="line"><aname="l00147"></a><spanclass="lineno"> 147</span> <spanclass="comment"> /** removes IDs from the index. Not supported by all indexes</span></div>
<divclass="line"><aname="l00151"></a><spanclass="lineno"> 151</span> <spanclass="comment"> /** Reconstruct a stored vector (or an approximation if lossy coding)</span></div>
<divclass="line"><aname="l00153"></a><spanclass="lineno"> 153</span> <spanclass="comment"> * this function may not be defined for some indexes</span></div>
<divclass="line"><aname="l00154"></a><spanclass="lineno"> 154</span> <spanclass="comment"> * @param key id of the vector to reconstruct</span></div>
<divclass="line"><aname="l00162"></a><spanclass="lineno"> 162</span> <spanclass="comment"> * this function may not be defined for some indexes</span></div>
<divclass="line"><aname="l00167"></a><spanclass="lineno"> 167</span> <spanclass="comment"> /** Similar to search, but also reconstructs the stored vectors (or an</span></div>
<divclass="line"><aname="l00168"></a><spanclass="lineno"> 168</span> <spanclass="comment"> * approximation in the case of lossy coding) for the search results.</span></div>
<divclass="line"><aname="l00170"></a><spanclass="lineno"> 170</span> <spanclass="comment"> * If there are not enough results for a query, the resulting arrays</span></div>
<divclass="line"><aname="l00171"></a><spanclass="lineno"> 171</span> <spanclass="comment"> * is padded with -1s.</span></div>
<divclass="line"><aname="l00179"></a><spanclass="lineno"> 179</span> <spanclass="comment"> /** Computes a residual vector after indexing encoding.</span></div>
<divclass="line"><aname="l00181"></a><spanclass="lineno"> 181</span> <spanclass="comment"> * The residual vector is the difference between a vector and the</span></div>
<divclass="line"><aname="l00182"></a><spanclass="lineno"> 182</span> <spanclass="comment"> * reconstruction that can be decoded from its representation in</span></div>
<divclass="line"><aname="l00183"></a><spanclass="lineno"> 183</span> <spanclass="comment"> * the index. The residual can be used for multiple-stage indexing</span></div>
<divclass="line"><aname="l00184"></a><spanclass="lineno"> 184</span> <spanclass="comment"> * methods, like IndexIVF's methods.</span></div>
<divclass="line"><aname="l00188"></a><spanclass="lineno"> 188</span> <spanclass="comment"> * @param key encoded index, as returned by search and assign</span></div>
<divclass="line"><aname="l00192"></a><spanclass="lineno"> 192</span> <spanclass="comment"> /** Display the actual class name and some more info */</span></div>
<divclass="ttc"id="structfaiss_1_1Index_html_a849361f5f0ab0aba8d419c86f2594191"><divclass="ttname"><ahref="structfaiss_1_1Index.html#a849361f5f0ab0aba8d419c86f2594191">faiss::Index::reset</a></div><divclass="ttdeci">virtual void reset()=0</div><divclass="ttdoc">removes all elements from the database. </div></div>
<divclass="ttc"id="structfaiss_1_1Index_html_abf601502bdbfa02b9d7bcd7b3671b71d"><divclass="ttname"><ahref="structfaiss_1_1Index.html#abf601502bdbfa02b9d7bcd7b3671b71d">faiss::Index::train</a></div><divclass="ttdeci">virtual void train(idx_t n, const float *x)</div><divclass="ttdef"><b>Definition:</b><ahref="Index_8cpp_source.html#l00024">Index.cpp:24</a></div></div>
<divclass="ttc"id="structfaiss_1_1Index_html_aa6931dfe054b33b02c842ff75f7a0c7f"><divclass="ttname"><ahref="structfaiss_1_1Index.html#aa6931dfe054b33b02c842ff75f7a0c7f">faiss::Index::add_with_ids</a></div><divclass="ttdeci">virtual void add_with_ids(idx_t n, const float *x, const long *xids)</div><divclass="ttdef"><b>Definition:</b><ahref="Index_8cpp_source.html#l00042">Index.cpp:42</a></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_1Index_html_a6970683faa021b7a6f1a0865c0d4eccd"><divclass="ttname"><ahref="structfaiss_1_1Index.html#a6970683faa021b7a6f1a0865c0d4eccd">faiss::Index::ntotal</a></div><divclass="ttdeci">idx_t ntotal</div><divclass="ttdoc">total nb of indexed vectors </div><divclass="ttdef"><b>Definition:</b><ahref="Index_8h_source.html#l00067">Index.h:67</a></div></div>
<divclass="ttc"id="structfaiss_1_1Index_html_af8bf7bd97aeed8ad5fc48b242379a68a"><divclass="ttname"><ahref="structfaiss_1_1Index.html#af8bf7bd97aeed8ad5fc48b242379a68a">faiss::Index::remove_ids</a></div><divclass="ttdeci">virtual long remove_ids(const IDSelector &sel)</div><divclass="ttdef"><b>Definition:</b><ahref="Index_8cpp_source.html#l00049">Index.cpp:49</a></div></div>
<divclass="ttc"id="structfaiss_1_1Index_html_a8e18f641854b2bde83ecff0a2f9a6f4e"><divclass="ttname"><ahref="structfaiss_1_1Index.html#a8e18f641854b2bde83ecff0a2f9a6f4e">faiss::Index::metric_type</a></div><divclass="ttdeci">MetricType metric_type</div><divclass="ttdoc">type of metric this index uses for search </div><divclass="ttdef"><b>Definition:</b><ahref="Index_8h_source.html#l00074">Index.h:74</a></div></div>
<divclass="ttc"id="structfaiss_1_1Index_html_a6e92732617c4dbe364e7678dd8773a7f"><divclass="ttname"><ahref="structfaiss_1_1Index.html#a6e92732617c4dbe364e7678dd8773a7f">faiss::Index::is_trained</a></div><divclass="ttdeci">bool is_trained</div><divclass="ttdoc">set if the Index does not require training, or if training is done already </div><divclass="ttdef"><b>Definition:</b><ahref="Index_8h_source.html#l00071">Index.h:71</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>