<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="l00009"></a><spanclass="lineno"> 9</span> <spanclass="comment">// Copyright 2004-present Facebook. All Rights Reserved</span></div>
<divclass="line"><aname="l00010"></a><spanclass="lineno"> 10</span> <spanclass="comment">// -*- c++ -*-</span></div>
<divclass="line"><aname="l00011"></a><spanclass="lineno"> 11</span> <spanclass="comment">// Auxiliary index structures, that are used in indexes but that can</span></div>
<divclass="line"><aname="l00012"></a><spanclass="lineno"> 12</span> <spanclass="comment">// be forward-declared</span></div>
<divclass="line"><aname="l00025"></a><spanclass="lineno"> 25</span> <spanclass="comment">/** The objective is to have a simple result structure while</span></div>
<divclass="line"><aname="l00026"></a><spanclass="lineno"> 26</span> <spanclass="comment"> * minimizing the number of mem copies in the result. The method</span></div>
<divclass="line"><aname="l00027"></a><spanclass="lineno"> 27</span> <spanclass="comment"> * do_allocation can be overloaded to allocate the result tables in</span></div>
<divclass="line"><aname="l00028"></a><spanclass="lineno"> 28</span> <spanclass="comment"> * the matrix type of a srcipting language like Lua or Python. */</span></div>
<divclass="line"><aname="l00030"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1RangeSearchResult.html#a29269b98c33af874d379ca4f62408b90"> 30</a></span> <spanclass="keywordtype">size_t</span><aclass="code"href="structfaiss_1_1RangeSearchResult.html#a29269b98c33af874d379ca4f62408b90">nq</a>; <spanclass="comment">///< nb of queries</span></div>
<divclass="line"><aname="l00035"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1RangeSearchResult.html#aa8ff848474a4cc16c5464cc4ec187824"> 35</a></span>  idx_t *<aclass="code"href="structfaiss_1_1RangeSearchResult.html#aa8ff848474a4cc16c5464cc4ec187824">labels</a>; <spanclass="comment">///< result for query i is labels[lims[i]:lims[i+1]]</span></div>
<divclass="line"><aname="l00038"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1RangeSearchResult.html#a39342ad2e9ad8b90f6e95dafd3287f49"> 38</a></span> <spanclass="keywordtype">size_t</span><aclass="code"href="structfaiss_1_1RangeSearchResult.html#a39342ad2e9ad8b90f6e95dafd3287f49">buffer_size</a>; <spanclass="comment">///< size of the result buffers used</span></div>
<divclass="line"><aname="l00040"></a><spanclass="lineno"> 40</span> <spanclass="comment"> /// lims must be allocated on input to range_search.</span></div>
<divclass="line"><aname="l00043"></a><spanclass="lineno"> 43</span> <spanclass="comment"> /// called when lims contains the nb of elements result entries</span></div>
<divclass="line"><aname="l00044"></a><spanclass="lineno"> 44</span> <spanclass="comment"> /// for each query</span></div>
<divclass="line"><aname="l00070"></a><spanclass="lineno"> 70</span> <spanclass="comment">/** Remove ids from a set. Repetitions of ids in the indices set</span></div>
<divclass="line"><aname="l00071"></a><spanclass="lineno"> 71</span> <spanclass="comment"> * passed to the constructor does not hurt performance. The hash</span></div>
<divclass="line"><aname="l00072"></a><spanclass="lineno"> 72</span> <spanclass="comment"> * function used for the bloom filter and GCC's implementation of</span></div>
<divclass="line"><aname="l00073"></a><spanclass="lineno"> 73</span> <spanclass="comment"> * unordered_set are just the least significant bits of the id. This</span></div>
<divclass="line"><aname="l00074"></a><spanclass="lineno"> 74</span> <spanclass="comment"> * works fine for random ids or ids in sequences but will produce many</span></div>
<divclass="line"><aname="l00075"></a><spanclass="lineno"> 75</span> <spanclass="comment"> * hash collisions if lsb's are always the same */</span></div>
<divclass="line"><aname="l00081"></a><spanclass="lineno"> 81</span>  std::vector<uint8_t> bloom; <spanclass="comment">// assumes low bits of id are a good hash value</span></div>
<divclass="line"><aname="l00091"></a><spanclass="lineno"> 91</span> <spanclass="comment">// Below are structures used only by Index implementations</span></div>
<divclass="line"><aname="l00095"></a><spanclass="lineno"> 95</span> <spanclass="comment">/** List of temporary buffers used to store results before they are</span></div>
<divclass="line"><aname="l00096"></a><spanclass="lineno"> 96</span> <spanclass="comment"> * copied to the RangeSearchResult object. */</span></div>
<divclass="line"><aname="l00109"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1BufferList.html#af4d7ddcd77f328a12a7da89d8febe5d9"> 109</a></span> <spanclass="keywordtype">size_t</span><aclass="code"href="structfaiss_1_1BufferList.html#af4d7ddcd77f328a12a7da89d8febe5d9">wp</a>; <spanclass="comment">///< write pointer in the last buffer.</span></div>
<divclass="line"><aname="l00120"></a><spanclass="lineno"> 120</span> <spanclass="keywordflow">if</span> (<aclass="code"href="structfaiss_1_1BufferList.html#af4d7ddcd77f328a12a7da89d8febe5d9">wp</a> == buffer_size) { <spanclass="comment">// need new buffer</span></div>
<divclass="line"><aname="l00129"></a><spanclass="lineno"> 129</span> <spanclass="comment"> /// copy elemnts ofs:ofs+n-1 seen as linear data in the buffers to</span></div>
<divclass="line"><aname="l00138"></a><spanclass="lineno"> 138</span> <spanclass="comment">/// the entries in the buffers are split per query</span></div>
<divclass="line"><aname="l00164"></a><spanclass="lineno"> 164</span> <spanclass="comment"> /// called by range_search before do_allocation</span></div>
<divclass="line"><aname="l00167"></a><spanclass="lineno"> 167</span> <spanclass="comment"> /// called by range_search after do_allocation</span></div>
<divclass="ttc"id="structfaiss_1_1RangeSearchResult_html_a29269b98c33af874d379ca4f62408b90"><divclass="ttname"><ahref="structfaiss_1_1RangeSearchResult.html#a29269b98c33af874d379ca4f62408b90">faiss::RangeSearchResult::nq</a></div><divclass="ttdeci">size_t nq</div><divclass="ttdoc">nb of queries </div><divclass="ttdef"><b>Definition:</b><ahref="AuxIndexStructures_8h_source.html#l00030">AuxIndexStructures.h:30</a></div></div>
<divclass="ttc"id="structfaiss_1_1RangeSearchPartialResult_1_1QueryResult_html"><divclass="ttname"><ahref="structfaiss_1_1RangeSearchPartialResult_1_1QueryResult.html">faiss::RangeSearchPartialResult::QueryResult</a></div><divclass="ttdoc">result structure for a single query </div><divclass="ttdef"><b>Definition:</b><ahref="AuxIndexStructures_8h_source.html#l00145">AuxIndexStructures.h:145</a></div></div>
<divclass="ttc"id="structfaiss_1_1RangeSearchPartialResult_html_aa6639358995ac081f8a931a7790d0caf"><divclass="ttname"><ahref="structfaiss_1_1RangeSearchPartialResult.html#aa6639358995ac081f8a931a7790d0caf">faiss::RangeSearchPartialResult::set_result</a></div><divclass="ttdeci">void set_result(bool incremental=false)</div><divclass="ttdoc">called by range_search after do_allocation </div><divclass="ttdef"><b>Definition:</b><ahref="AuxIndexStructures_8cpp_source.html#l00144">AuxIndexStructures.cpp:144</a></div></div>
<divclass="ttc"id="structfaiss_1_1RangeSearchPartialResult_html_ab6a385008493c7b630e4e7bc56e3da74"><divclass="ttname"><ahref="structfaiss_1_1RangeSearchPartialResult.html#ab6a385008493c7b630e4e7bc56e3da74">faiss::RangeSearchPartialResult::set_lims</a></div><divclass="ttdeci">void set_lims()</div><divclass="ttdoc">called by range_search before do_allocation </div><divclass="ttdef"><b>Definition:</b><ahref="AuxIndexStructures_8cpp_source.html#l00135">AuxIndexStructures.cpp:135</a></div></div>
<divclass="ttc"id="structfaiss_1_1BufferList_html_af4d7ddcd77f328a12a7da89d8febe5d9"><divclass="ttname"><ahref="structfaiss_1_1BufferList.html#af4d7ddcd77f328a12a7da89d8febe5d9">faiss::BufferList::wp</a></div><divclass="ttdeci">size_t wp</div><divclass="ttdoc">write pointer in the last buffer. </div><divclass="ttdef"><b>Definition:</b><ahref="AuxIndexStructures_8h_source.html#l00109">AuxIndexStructures.h:109</a></div></div>
<divclass="ttc"id="structfaiss_1_1RangeSearchResult_html_a46e9fa31c3e232249cef508f357d856c"><divclass="ttname"><ahref="structfaiss_1_1RangeSearchResult.html#a46e9fa31c3e232249cef508f357d856c">faiss::RangeSearchResult::RangeSearchResult</a></div><divclass="ttdeci">RangeSearchResult(size_t nq)</div><divclass="ttdoc">lims must be allocated on input to range_search. </div><divclass="ttdef"><b>Definition:</b><ahref="AuxIndexStructures_8cpp_source.html#l00023">AuxIndexStructures.cpp:23</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#l00062">Index.h:62</a></div></div>
<divclass="ttc"id="structfaiss_1_1RangeSearchPartialResult_html_a954c26beebb561a6c2b0f399c48a9db3"><divclass="ttname"><ahref="structfaiss_1_1RangeSearchPartialResult.html#a954c26beebb561a6c2b0f399c48a9db3">faiss::RangeSearchPartialResult::new_result</a></div><divclass="ttdeci">QueryResult & new_result(idx_t qno)</div><divclass="ttdoc">begin a new result </div><divclass="ttdef"><b>Definition:</b><ahref="AuxIndexStructures_8cpp_source.html#l00113">AuxIndexStructures.cpp:113</a></div></div>
<divclass="ttc"id="structfaiss_1_1RangeSearchPartialResult_html"><divclass="ttname"><ahref="structfaiss_1_1RangeSearchPartialResult.html">faiss::RangeSearchPartialResult</a></div><divclass="ttdoc">the entries in the buffers are split per query </div><divclass="ttdef"><b>Definition:</b><ahref="AuxIndexStructures_8h_source.html#l00139">AuxIndexStructures.h:139</a></div></div>
<divclass="ttc"id="structfaiss_1_1RangeSearchResult_html_a39342ad2e9ad8b90f6e95dafd3287f49"><divclass="ttname"><ahref="structfaiss_1_1RangeSearchResult.html#a39342ad2e9ad8b90f6e95dafd3287f49">faiss::RangeSearchResult::buffer_size</a></div><divclass="ttdeci">size_t buffer_size</div><divclass="ttdoc">size of the result buffers used </div><divclass="ttdef"><b>Definition:</b><ahref="AuxIndexStructures_8h_source.html#l00038">AuxIndexStructures.h:38</a></div></div>
<divclass="ttc"id="structfaiss_1_1RangeSearchResult_html_aa8ff848474a4cc16c5464cc4ec187824"><divclass="ttname"><ahref="structfaiss_1_1RangeSearchResult.html#aa8ff848474a4cc16c5464cc4ec187824">faiss::RangeSearchResult::labels</a></div><divclass="ttdeci">idx_t * labels</div><divclass="ttdoc">result for query i is labels[lims[i]:lims[i+1]] </div><divclass="ttdef"><b>Definition:</b><ahref="AuxIndexStructures_8h_source.html#l00035">AuxIndexStructures.h:35</a></div></div>