1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Faiss: /data/users/matthijs/github_faiss/faiss/ProductQuantizer.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Faiss
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Friends</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">/data/users/matthijs/github_faiss/faiss/ProductQuantizer.h</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/**</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * Copyright (c) 2015-present, Facebook, Inc.</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> * All rights reserved.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * This source code is licensed under the BSD+Patents license found in the</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * LICENSE file in the root directory of this source tree.</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> </div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment">// Copyright 2004-present Facebook. All Rights Reserved.</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">// -*- c++ -*-</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> </div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#ifndef FAISS_PRODUCT_QUANTIZER_H</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor"></span><span class="preprocessor">#define FAISS_PRODUCT_QUANTIZER_H</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor"></span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include <stdint.h></span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include <vector></span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> </div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include "Clustering.h"</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="preprocessor">#include "Heap.h"</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> </div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="keyword">namespace </span>faiss {</div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment"></span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="comment">/** Product Quantizer. Implemented only for METRIC_L2 */</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html"> 25</a></span> <span class="keyword">struct </span><a class="code" href="structfaiss_1_1ProductQuantizer.html">ProductQuantizer</a> {</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> </div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a567cd512438f9e3404d9339a232d7695"> 27</a></span>  <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a567cd512438f9e3404d9339a232d7695">d</a>; <span class="comment">///< size of the input vectors</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a83600e328893ce5f41fe459f5a3acf41"> 28</a></span> <span class="comment"></span> <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a83600e328893ce5f41fe459f5a3acf41">M</a>; <span class="comment">///< number of subquantizers</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#ac920fea11f02e8407d12cc99a09f5ea5"> 29</a></span> <span class="comment"></span> <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#ac920fea11f02e8407d12cc99a09f5ea5">nbits</a>; <span class="comment">///< number of bits per quantization index</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="comment"></span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="comment">// values derived from the above</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a467b451ca203544e42c250e4be65b983"> 32</a></span>  <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a467b451ca203544e42c250e4be65b983">dsub</a>; <span class="comment">///< dimensionality of each subvector</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a13bf69a0dc7b4e45792d10f458e4a92d"> 33</a></span> <span class="comment"></span> <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a13bf69a0dc7b4e45792d10f458e4a92d">byte_per_idx</a>; <span class="comment">///< nb bytes per code component (1 or 2)</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#aa61330eadb84772b71018b093773a5f9"> 34</a></span> <span class="comment"></span> <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#aa61330eadb84772b71018b093773a5f9">code_size</a>; <span class="comment">///< byte per indexed vector</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a0feee45e4151547b7a0444c14bad398f"> 35</a></span> <span class="comment"></span> <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a0feee45e4151547b7a0444c14bad398f">ksub</a>; <span class="comment">///< number of centroids for each subquantizer</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a1e4056fa3938ed8c9fe701e90d94ad95"> 36</a></span> <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a1e4056fa3938ed8c9fe701e90d94ad95">verbose</a>; <span class="comment">///< verbose during training?</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="comment"></span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="comment"></span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="comment"> /// initialization</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35"> 40</a></span> <span class="comment"></span> <span class="keyword">enum</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35">train_type_t</a> {</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  Train_default,</div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a4960d143d2aa49cf92028cf3470c47a0"> 42</a></span>  <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a4960d143d2aa49cf92028cf3470c47a0">Train_hot_start</a>, <span class="comment">///< the centroids are already initialized</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35aa1aefc6c08f0ca974de9f59d9557aa0d"> 43</a></span> <span class="comment"></span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35aa1aefc6c08f0ca974de9f59d9557aa0d">Train_shared</a>, <span class="comment">///< share dictionary accross PQ segments</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35ac8040c8792a014a2ea7188583575013e"> 44</a></span> <span class="comment"></span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35ac8040c8792a014a2ea7188583575013e">Train_hypercube</a>, <span class="comment">///< intialize centroids with nbits-D hypercube</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a6b330bc2cfa02a402d002d657f214931"> 45</a></span> <span class="comment"></span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a6b330bc2cfa02a402d002d657f214931">Train_hypercube_pca</a>, <span class="comment">///< intialize centroids with nbits-D hypercube</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="comment"></span> };</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35">train_type_t</a> train_type;</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#af265acf5aa1bcda60898002287e6a3d6"> 49</a></span>  <a class="code" href="structfaiss_1_1ClusteringParameters.html">ClusteringParameters</a> <a class="code" href="structfaiss_1_1ProductQuantizer.html#af265acf5aa1bcda60898002287e6a3d6">cp</a>; <span class="comment">///< parameters used during clustering</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> <span class="comment"></span><span class="comment"></span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span> <span class="comment"> /// if non-NULL, use this index for assignment (should be of size</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> <span class="comment"> /// d / M)</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a62def246cfef670f2973fdf4af1414e1"> 53</a></span> <span class="comment"></span> <a class="code" href="structfaiss_1_1Index.html">Index</a> *<a class="code" href="structfaiss_1_1ProductQuantizer.html#a62def246cfef670f2973fdf4af1414e1">assign_index</a>;</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span> <span class="comment"></span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span> <span class="comment"> /// Centroid table, size M * ksub * dsub</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae"> 56</a></span> <span class="comment"></span> std::vector<float> <a class="code" href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">centroids</a>;</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span> <span class="comment"></span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span> <span class="comment"> /// return the centroids associated with subvector m</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a4f0f33c011dffe633a1748a48a082c22"> 59</a></span> <span class="comment"></span> <span class="keywordtype">float</span> * <a class="code" href="structfaiss_1_1ProductQuantizer.html#a4f0f33c011dffe633a1748a48a082c22">get_centroids</a> (<span class="keywordtype">size_t</span> m, <span class="keywordtype">size_t</span> i) {</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keywordflow">return</span> &<a class="code" href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">centroids</a> [(m * <a class="code" href="structfaiss_1_1ProductQuantizer.html#a0feee45e4151547b7a0444c14bad398f">ksub</a> + i) * <a class="code" href="structfaiss_1_1ProductQuantizer.html#a467b451ca203544e42c250e4be65b983">dsub</a>];</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  }</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> * <a class="code" href="structfaiss_1_1ProductQuantizer.html#a4f0f33c011dffe633a1748a48a082c22">get_centroids</a> (<span class="keywordtype">size_t</span> m, <span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordflow">return</span> &<a class="code" href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">centroids</a> [(m * <a class="code" href="structfaiss_1_1ProductQuantizer.html#a0feee45e4151547b7a0444c14bad398f">ksub</a> + i) * <a class="code" href="structfaiss_1_1ProductQuantizer.html#a467b451ca203544e42c250e4be65b983">dsub</a>];</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  }</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="comment">// Train the product quantizer on a set of points. A clustering</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="comment">// can be set on input to define non-default clustering parameters</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keywordtype">void</span> train (<span class="keywordtype">int</span> n, <span class="keyword">const</span> <span class="keywordtype">float</span> *x);</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span> </div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  ProductQuantizer(<span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a567cd512438f9e3404d9339a232d7695">d</a>, <span class="comment">/* dimensionality of the input vectors */</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a83600e328893ce5f41fe459f5a3acf41">M</a>, <span class="comment">/* number of subquantizers */</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#ac920fea11f02e8407d12cc99a09f5ea5">nbits</a>); <span class="comment">/* number of bit per subvector index */</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> </div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  ProductQuantizer ();</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> <span class="comment"></span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span> <span class="comment"> /// compute derived values when d, M and nbits have been set</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#ab3067f333b26811537a8519fb08292ce">set_derived_values</a> ();</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="comment"></span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span> <span class="comment"> /// Define the centroids for subquantizer m</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#ad291f113c6d44a634ddc1972f9a3c775">set_params</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> * <a class="code" href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">centroids</a>, <span class="keywordtype">int</span> m);</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> <span class="comment"></span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span> <span class="comment"> /// Quantize one vector with the product quantizer</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a08b130e3a21f2699a4e3bbec121fb838">compute_code</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> * x, uint8_t * code) <span class="keyword">const</span> ;</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> <span class="comment"></span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span> <span class="comment"> /// same as compute_code for several vectors</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#ae5a340ee5a4b1d35a565b167de2a2ef1">compute_codes</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  uint8_t * codes,</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keywordtype">size_t</span> n) <span class="keyword">const</span> ;</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span> <span class="comment"></span></div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="comment"> /// decode a vector from a given code (or n vectors if third argument)</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a7afbf9d96276f021981e99f064254208">decode</a> (<span class="keyword">const</span> uint8_t *code, <span class="keywordtype">float</span> *x) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a7afbf9d96276f021981e99f064254208">decode</a> (<span class="keyword">const</span> uint8_t *code, <span class="keywordtype">float</span> *x, <span class="keywordtype">size_t</span> n) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span> <span class="comment"></span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span> <span class="comment"> /// If we happen to have the distance tables precomputed, this is</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span> <span class="comment"> /// more efficient to compute the codes.</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a95060fedd7c09eb20e968fd2fdb4b316">compute_code_from_distance_table</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> *tab,</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  uint8_t *code) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span> </div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span> <span class="comment"></span></div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> <span class="comment"> /** Compute distance table for one vector.</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> <span class="comment"> * The distance table for x = [x_0 x_1 .. x_(M-1)] is a M * ksub</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span> <span class="comment"> * matrix that contains</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span> <span class="comment"> * dis_table (m, j) = || x_m - c_(m, j)||^2</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span> <span class="comment"> * for m = 0..M-1 and j = 0 .. ksub - 1</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span> <span class="comment"> * where c_(m, j) is the centroid no j of sub-quantizer m.</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span> <span class="comment"> * @param x input vector size d</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span> <span class="comment"> * @param dis_table output table, size M * ksub</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a36361f41bcd2fa698f3c39eb7111ed09">compute_distance_table</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="keywordtype">float</span> * dis_table) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span> </div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordtype">void</span> compute_inner_prod_table (<span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keywordtype">float</span> * dis_table) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span> </div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span> <span class="comment"></span></div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> <span class="comment"> /** compute distance table for several vectors</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span> <span class="comment"> * @param nx nb of input vectors</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span> <span class="comment"> * @param x input vector size nx * d</span></div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span> <span class="comment"> * @param dis_table output table, size nx * M * ksub</span></div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3521b9a36c28219fd6180cc7a9ce8207">compute_distance_tables</a> (<span class="keywordtype">size_t</span> nx,</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keywordtype">float</span> * dis_tables) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span> </div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="keywordtype">void</span> compute_inner_prod_tables (<span class="keywordtype">size_t</span> nx,</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="keywordtype">float</span> * dis_tables) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span> </div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span> <span class="comment"></span></div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span> <span class="comment"> /** perform a search (L2 distance)</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span> <span class="comment"> * @param x query vectors, size nx * d</span></div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span> <span class="comment"> * @param nx nb of queries</span></div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span> <span class="comment"> * @param codes database codes, size ncodes * byte_per_idx</span></div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span> <span class="comment"> * @param ncodes nb of nb vectors</span></div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span> <span class="comment"> * @param res heap array to store results (nh == nx)</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span> <span class="comment"> * @param init_finalize_heap initialize heap (input) and sort (output)?</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a1ae7892a15b9f6809a3ba1a123a7831b">search</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="keywordtype">size_t</span> nx,</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  <span class="keyword">const</span> uint8_t * codes,</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> ncodes,</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  float_maxheap_array_t *res,</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="keywordtype">bool</span> init_finalize_heap = <span class="keyword">true</span>) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span> <span class="comment"></span></div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span> <span class="comment"> /** same as search, but with inner product similarity */</span></div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a66be226806ca2abcaaf1653cdc690aa6">search_ip</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  <span class="keywordtype">size_t</span> nx,</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="keyword">const</span> uint8_t * codes,</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> ncodes,</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  float_minheap_array_t *res,</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  <span class="keywordtype">bool</span> init_finalize_heap = <span class="keyword">true</span>) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span> </div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span> <span class="comment"></span></div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span> <span class="comment"> /// Symmetric Distance Table</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a6bd65fb4407452f73acb7242931d09e4"> 159</a></span> <span class="comment"></span> std::vector<float> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a6bd65fb4407452f73acb7242931d09e4">sdc_table</a>;</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span> </div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="comment">// intitialize the SDC table from the centroids</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  <span class="keywordtype">void</span> compute_sdc_table ();</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span> </div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  <span class="keywordtype">void</span> search_sdc (<span class="keyword">const</span> uint8_t * qcodes,</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  <span class="keywordtype">size_t</span> nq,</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keyword">const</span> uint8_t * bcodes,</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> ncodes,</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  <a class="code" href="structfaiss_1_1HeapArray.html">float_maxheap_array_t</a> * res,</div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  <span class="keywordtype">bool</span> init_finalize_heap = <span class="keyword">true</span>) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span> </div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span> };</div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span> </div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span> </div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span> </div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span> } <span class="comment">// namespace faiss</span></div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span> </div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span> </div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span> <span class="preprocessor">#endif</span></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_ad291f113c6d44a634ddc1972f9a3c775"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#ad291f113c6d44a634ddc1972f9a3c775">faiss::ProductQuantizer::set_params</a></div><div class="ttdeci">void set_params(const float *centroids, int m)</div><div class="ttdoc">Define the centroids for subquantizer m. </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00179">ProductQuantizer.cpp:179</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a3a41c6286095e731be744548d9535a35a6b330bc2cfa02a402d002d657f214931"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a6b330bc2cfa02a402d002d657f214931">faiss::ProductQuantizer::Train_hypercube_pca</a></div><div class="ttdoc">intialize centroids with nbits-D hypercube </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00045">ProductQuantizer.h:45</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_ac920fea11f02e8407d12cc99a09f5ea5"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#ac920fea11f02e8407d12cc99a09f5ea5">faiss::ProductQuantizer::nbits</a></div><div class="ttdeci">size_t nbits</div><div class="ttdoc">number of bits per quantization index </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00029">ProductQuantizer.h:29</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a7afbf9d96276f021981e99f064254208"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a7afbf9d96276f021981e99f064254208">faiss::ProductQuantizer::decode</a></div><div class="ttdeci">void decode(const uint8_t *code, float *x) const </div><div class="ttdoc">decode a vector from a given code (or n vectors if third argument) </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00339">ProductQuantizer.cpp:339</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a13bf69a0dc7b4e45792d10f458e4a92d"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a13bf69a0dc7b4e45792d10f458e4a92d">faiss::ProductQuantizer::byte_per_idx</a></div><div class="ttdeci">size_t byte_per_idx</div><div class="ttdoc">nb bytes per code component (1 or 2) </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00033">ProductQuantizer.h:33</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a3a41c6286095e731be744548d9535a35ac8040c8792a014a2ea7188583575013e"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35ac8040c8792a014a2ea7188583575013e">faiss::ProductQuantizer::Train_hypercube</a></div><div class="ttdoc">intialize centroids with nbits-D hypercube </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00044">ProductQuantizer.h:44</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_ab3067f333b26811537a8519fb08292ce"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#ab3067f333b26811537a8519fb08292ce">faiss::ProductQuantizer::set_derived_values</a></div><div class="ttdeci">void set_derived_values()</div><div class="ttdoc">compute derived values when d, M and nbits have been set </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00166">ProductQuantizer.cpp:166</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a6bd65fb4407452f73acb7242931d09e4"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a6bd65fb4407452f73acb7242931d09e4">faiss::ProductQuantizer::sdc_table</a></div><div class="ttdeci">std::vector< float > sdc_table</div><div class="ttdoc">Symmetric Distance Table. </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00159">ProductQuantizer.h:159</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a3a41c6286095e731be744548d9535a35aa1aefc6c08f0ca974de9f59d9557aa0d"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35aa1aefc6c08f0ca974de9f59d9557aa0d">faiss::ProductQuantizer::Train_shared</a></div><div class="ttdoc">share dictionary accross PQ segments </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00043">ProductQuantizer.h:43</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a467b451ca203544e42c250e4be65b983"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a467b451ca203544e42c250e4be65b983">faiss::ProductQuantizer::dsub</a></div><div class="ttdeci">size_t dsub</div><div class="ttdoc">dimensionality of each subvector </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00032">ProductQuantizer.h:32</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a3521b9a36c28219fd6180cc7a9ce8207"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a3521b9a36c28219fd6180cc7a9ce8207">faiss::ProductQuantizer::compute_distance_tables</a></div><div class="ttdeci">void compute_distance_tables(size_t nx, const float *x, float *dis_tables) const </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00440">ProductQuantizer.cpp:440</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a95060fedd7c09eb20e968fd2fdb4b316"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a95060fedd7c09eb20e968fd2fdb4b316">faiss::ProductQuantizer::compute_code_from_distance_table</a></div><div class="ttdeci">void compute_code_from_distance_table(const float *tab, uint8_t *code) const </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00364">ProductQuantizer.cpp:364</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_ae5a340ee5a4b1d35a565b167de2a2ef1"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#ae5a340ee5a4b1d35a565b167de2a2ef1">faiss::ProductQuantizer::compute_codes</a></div><div class="ttdeci">void compute_codes(const float *x, uint8_t *codes, size_t n) const </div><div class="ttdoc">same as compute_code for several vectors </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00386">ProductQuantizer.cpp:386</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a36361f41bcd2fa698f3c39eb7111ed09"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a36361f41bcd2fa698f3c39eb7111ed09">faiss::ProductQuantizer::compute_distance_table</a></div><div class="ttdeci">void compute_distance_table(const float *x, float *dis_table) const </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00411">ProductQuantizer.cpp:411</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a1ae7892a15b9f6809a3ba1a123a7831b"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a1ae7892a15b9f6809a3ba1a123a7831b">faiss::ProductQuantizer::search</a></div><div class="ttdeci">void search(const float *x, size_t nx, const uint8_t *codes, const size_t ncodes, float_maxheap_array_t *res, bool init_finalize_heap=true) const </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00541">ProductQuantizer.cpp:541</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_aa61330eadb84772b71018b093773a5f9"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#aa61330eadb84772b71018b093773a5f9">faiss::ProductQuantizer::code_size</a></div><div class="ttdeci">size_t code_size</div><div class="ttdoc">byte per indexed vector </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00034">ProductQuantizer.h:34</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a62def246cfef670f2973fdf4af1414e1"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a62def246cfef670f2973fdf4af1414e1">faiss::ProductQuantizer::assign_index</a></div><div class="ttdeci">Index * assign_index</div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00053">ProductQuantizer.h:53</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a0feee45e4151547b7a0444c14bad398f"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a0feee45e4151547b7a0444c14bad398f">faiss::ProductQuantizer::ksub</a></div><div class="ttdeci">size_t ksub</div><div class="ttdoc">number of centroids for each subquantizer </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00035">ProductQuantizer.h:35</a></div></div>
<div class="ttc" id="structfaiss_1_1HeapArray_html"><div class="ttname"><a href="structfaiss_1_1HeapArray.html">faiss::HeapArray</a></div><div class="ttdef"><b>Definition:</b> <a href="Heap_8h_source.html#l00350">Heap.h:350</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a66be226806ca2abcaaf1653cdc690aa6"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a66be226806ca2abcaaf1653cdc690aa6">faiss::ProductQuantizer::search_ip</a></div><div class="ttdeci">void search_ip(const float *x, size_t nx, const uint8_t *codes, const size_t ncodes, float_minheap_array_t *res, bool init_finalize_heap=true) const </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00566">ProductQuantizer.cpp:566</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a08b130e3a21f2699a4e3bbec121fb838"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a08b130e3a21f2699a4e3bbec121fb838">faiss::ProductQuantizer::compute_code</a></div><div class="ttdeci">void compute_code(const float *x, uint8_t *code) const </div><div class="ttdoc">Quantize one vector with the product quantizer. </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00312">ProductQuantizer.cpp:312</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a3a41c6286095e731be744548d9535a35a4960d143d2aa49cf92028cf3470c47a0"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a4960d143d2aa49cf92028cf3470c47a0">faiss::ProductQuantizer::Train_hot_start</a></div><div class="ttdoc">the centroids are already initialized </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00042">ProductQuantizer.h:42</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_af265acf5aa1bcda60898002287e6a3d6"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#af265acf5aa1bcda60898002287e6a3d6">faiss::ProductQuantizer::cp</a></div><div class="ttdeci">ClusteringParameters cp</div><div class="ttdoc">parameters used during clustering </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00049">ProductQuantizer.h:49</a></div></div>
<div class="ttc" id="structfaiss_1_1ClusteringParameters_html"><div class="ttname"><a href="structfaiss_1_1ClusteringParameters.html">faiss::ClusteringParameters</a></div><div class="ttdef"><b>Definition:</b> <a href="Clustering_8h_source.html#l00024">Clustering.h:24</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a83600e328893ce5f41fe459f5a3acf41"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a83600e328893ce5f41fe459f5a3acf41">faiss::ProductQuantizer::M</a></div><div class="ttdeci">size_t M</div><div class="ttdoc">number of subquantizers </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00028">ProductQuantizer.h:28</a></div></div>
<div class="ttc" id="structfaiss_1_1Index_html"><div class="ttname"><a href="structfaiss_1_1Index.html">faiss::Index</a></div><div class="ttdef"><b>Definition:</b> <a href="Index_8h_source.html#l00060">Index.h:60</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html">faiss::ProductQuantizer</a></div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00025">ProductQuantizer.h:25</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a4f0f33c011dffe633a1748a48a082c22"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a4f0f33c011dffe633a1748a48a082c22">faiss::ProductQuantizer::get_centroids</a></div><div class="ttdeci">float * get_centroids(size_t m, size_t i)</div><div class="ttdoc">return the centroids associated with subvector m </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00059">ProductQuantizer.h:59</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a567cd512438f9e3404d9339a232d7695"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a567cd512438f9e3404d9339a232d7695">faiss::ProductQuantizer::d</a></div><div class="ttdeci">size_t d</div><div class="ttdoc">size of the input vectors </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00027">ProductQuantizer.h:27</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a1e4056fa3938ed8c9fe701e90d94ad95"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a1e4056fa3938ed8c9fe701e90d94ad95">faiss::ProductQuantizer::verbose</a></div><div class="ttdeci">bool verbose</div><div class="ttdoc">verbose during training? </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00036">ProductQuantizer.h:36</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_aab1109a29ba0544358e274d727b23cae"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">faiss::ProductQuantizer::centroids</a></div><div class="ttdeci">std::vector< float > centroids</div><div class="ttdoc">Centroid table, size M * ksub * dsub. </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00056">ProductQuantizer.h:56</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a3a41c6286095e731be744548d9535a35"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35">faiss::ProductQuantizer::train_type_t</a></div><div class="ttdeci">train_type_t</div><div class="ttdoc">initialization </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00040">ProductQuantizer.h:40</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>