<divclass="line"><aname="l00005"></a><spanclass="lineno"> 5</span> <spanclass="comment"> * This source code is licensed under the CC-by-NC 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="l00030"></a><spanclass="lineno"> 30</span> <spanclass="comment">/** The objective is to have a simple result structure while</span></div>
<divclass="line"><aname="l00031"></a><spanclass="lineno"> 31</span> <spanclass="comment"> * minimizing the number of mem copies in the result. The method</span></div>
<divclass="line"><aname="l00032"></a><spanclass="lineno"> 32</span> <spanclass="comment"> * do_allocation can be overloaded to allocate the result tables in</span></div>
<divclass="line"><aname="l00033"></a><spanclass="lineno"> 33</span> <spanclass="comment"> * the matrix type of a srcipting language like Lua or Python. */</span></div>
<divclass="line"><aname="l00035"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1RangeSearchResult.html#a29269b98c33af874d379ca4f62408b90"> 35</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="l00040"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1RangeSearchResult.html#aa8ff848474a4cc16c5464cc4ec187824"> 40</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="l00043"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1RangeSearchResult.html#a39342ad2e9ad8b90f6e95dafd3287f49"> 43</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="l00045"></a><spanclass="lineno"> 45</span> <spanclass="comment"> /// lims must be allocated on input to range_search.</span></div>
<divclass="line"><aname="l00048"></a><spanclass="lineno"> 48</span> <spanclass="comment"> /// called when lims contains the nb of elements result entries</span></div>
<divclass="line"><aname="l00049"></a><spanclass="lineno"> 49</span> <spanclass="comment"> /// for each query</span></div>
<divclass="line"><aname="l00075"></a><spanclass="lineno"> 75</span> <spanclass="comment">/** Remove ids from a set. Repetitions of ids in the indices set</span></div>
<divclass="line"><aname="l00076"></a><spanclass="lineno"> 76</span> <spanclass="comment"> * passed to the constructor does not hurt performance. The hash</span></div>
<divclass="line"><aname="l00077"></a><spanclass="lineno"> 77</span> <spanclass="comment"> * function used for the bloom filter and GCC's implementation of</span></div>
<divclass="line"><aname="l00078"></a><spanclass="lineno"> 78</span> <spanclass="comment"> * unordered_set are just the least significant bits of the id. This</span></div>
<divclass="line"><aname="l00079"></a><spanclass="lineno"> 79</span> <spanclass="comment"> * works fine for random ids or ids in sequences but will produce many</span></div>
<divclass="line"><aname="l00080"></a><spanclass="lineno"> 80</span> <spanclass="comment"> * hash collisions if lsb's are always the same */</span></div>
<divclass="line"><aname="l00090"></a><spanclass="lineno"> 90</span>  std::vector<uint8_t> bloom; <spanclass="comment">// assumes low bits of id are a good hash value</span></div>
<divclass="line"><aname="l00100"></a><spanclass="lineno"> 100</span> <spanclass="comment">// Below are structures used only by Index implementations</span></div>
<divclass="line"><aname="l00104"></a><spanclass="lineno"> 104</span> <spanclass="comment">/** List of temporary buffers used to store results before they are</span></div>
<divclass="line"><aname="l00105"></a><spanclass="lineno"> 105</span> <spanclass="comment"> * copied to the RangeSearchResult object. */</span></div>
<divclass="line"><aname="l00118"></a><spanclass="lineno"><aclass="line"href="structfaiss_1_1BufferList.html#af4d7ddcd77f328a12a7da89d8febe5d9"> 118</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="l00129"></a><spanclass="lineno"> 129</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="l00138"></a><spanclass="lineno"> 138</span> <spanclass="comment"> /// copy elemnts ofs:ofs+n-1 seen as linear data in the buffers to</span></div>
<divclass="line"><aname="l00147"></a><spanclass="lineno"> 147</span> <spanclass="comment">/// the entries in the buffers are split per query</span></div>
<divclass="line"><aname="l00173"></a><spanclass="lineno"> 173</span> <spanclass="comment"> /// called by range_search before do_allocation</span></div>
<divclass="line"><aname="l00176"></a><spanclass="lineno"> 176</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#l00035">AuxIndexStructures.h:35</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#l00154">AuxIndexStructures.h:154</a></div></div>
<divclass="ttc"id="structfaiss_1_1BufferList_html_a78b70417a9ba5b27553b3134f1190958"><divclass="ttname"><ahref="structfaiss_1_1BufferList.html#a78b70417a9ba5b27553b3134f1190958">faiss::BufferList::copy_range</a></div><divclass="ttdeci">void copy_range(size_t ofs, size_t n, idx_t *dest_ids, float *dest_dis)</div><divclass="ttdef"><b>Definition:</b><ahref="AuxIndexStructures_8cpp_source.html#l00081">AuxIndexStructures.cpp:81</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#l00118">AuxIndexStructures.h:118</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#l00148">AuxIndexStructures.h:148</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#l00043">AuxIndexStructures.h:43</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#l00040">AuxIndexStructures.h:40</a></div></div>