mirror of
https://github.com/facebookresearch/faiss.git
synced 2025-06-03 21:54:02 +08:00
various bugfixes from github issues kmean with some frozen centroids GPU better tiling for large flat datasets default AVX for vector ops
444 lines
83 KiB
HTML
444 lines
83 KiB
HTML
<!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/VectorTransform.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/VectorTransform.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_VECTOR_TRANSFORM_H</span></div>
|
|
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor"></span><span class="preprocessor">#define FAISS_VECTOR_TRANSFORM_H</span></div>
|
|
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor"></span><span class="comment"></span></div>
|
|
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">/** Defines a few objects that apply transformations to a set of</span></div>
|
|
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * vectors Often these are pre-processing steps.</span></div>
|
|
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> */</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 <vector></span></div>
|
|
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div>
|
|
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include "Index.h"</span></div>
|
|
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div>
|
|
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> </div>
|
|
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="keyword">namespace </span>faiss {</div>
|
|
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> </div>
|
|
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="comment">/** Any transformation applied on a set of vectors */</span></div>
|
|
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="structfaiss_1_1VectorTransform.html"> 28</a></span> <span class="keyword">struct </span><a class="code" href="structfaiss_1_1VectorTransform.html">VectorTransform</a> {</div>
|
|
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div>
|
|
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="keyword">typedef</span> <a class="code" href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">Index::idx_t</a> idx_t;</div>
|
|
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div>
|
|
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <span class="keywordtype">int</span> d_in; <span class="comment">///! input dimension</span></div>
|
|
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="structfaiss_1_1VectorTransform.html#a589d612f7b1773614619a0cbecd728a9"> 33</a></span> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1VectorTransform.html#a589d612f7b1773614619a0cbecd728a9">d_out</a>; <span class="comment">///! output dimension</span></div>
|
|
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="structfaiss_1_1VectorTransform.html#a137f48bab695736f0b1d79a50cddc858"> 35</a></span>  <span class="keyword">explicit</span> <a class="code" href="structfaiss_1_1VectorTransform.html#a137f48bab695736f0b1d79a50cddc858">VectorTransform</a> (<span class="keywordtype">int</span> d_in = 0, <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1VectorTransform.html#a589d612f7b1773614619a0cbecd728a9">d_out</a> = 0):</div>
|
|
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  d_in(d_in), <a class="code" href="structfaiss_1_1VectorTransform.html#a589d612f7b1773614619a0cbecd728a9">d_out</a>(<a class="code" href="structfaiss_1_1VectorTransform.html#a589d612f7b1773614619a0cbecd728a9">d_out</a>), <a class="code" href="structfaiss_1_1VectorTransform.html#ab511f1ddf608c00204555881ca28cb02">is_trained</a>(true)</div>
|
|
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  {}</div>
|
|
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div>
|
|
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="comment"> /// set if the LinearTransform does not require training, or if</span></div>
|
|
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="comment"> /// training is done already</span></div>
|
|
<div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="structfaiss_1_1VectorTransform.html#ab511f1ddf608c00204555881ca28cb02"> 42</a></span> <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="structfaiss_1_1VectorTransform.html#ab511f1ddf608c00204555881ca28cb02">is_trained</a>;</div>
|
|
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> </div>
|
|
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="comment"> /** Perform training on a representative set of vectors. Does</span></div>
|
|
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span> <span class="comment"> * nothing by default.</span></div>
|
|
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span> <span class="comment"> *</span></div>
|
|
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span> <span class="comment"> * @param n nb of training vectors</span></div>
|
|
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span> <span class="comment"> * @param x training vecors, size n * d</span></div>
|
|
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> <span class="comment"> */</span></div>
|
|
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1VectorTransform.html#a7350d4dd28d60866d55ba4f75d2da84c">train</a> (idx_t n, <span class="keyword">const</span> <span class="keywordtype">float</span> *x);</div>
|
|
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> <span class="comment"> /** apply the random roation, return new allocated matrix</span></div>
|
|
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span> <span class="comment"> * @param x size n * d_in</span></div>
|
|
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span> <span class="comment"> * @return size n * d_out</span></div>
|
|
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span> <span class="comment"> */</span></div>
|
|
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordtype">float</span> *<a class="code" href="structfaiss_1_1VectorTransform.html#af3b3a8bf95911f4b28128001c83f91a5">apply</a> (idx_t n, <span class="keyword">const</span> <span class="keywordtype">float</span> * x) <span class="keyword">const</span>;</div>
|
|
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span> <span class="comment"> /// same as apply, but result is pre-allocated</span></div>
|
|
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span> <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1VectorTransform.html#a90f1a218c224c049f1bd8b77a78d6aa0">apply_noalloc</a> (idx_t n, <span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
|
|
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="keywordtype">float</span> *xt) <span class="keyword">const</span> = 0;</div>
|
|
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span> <span class="comment"> /// reverse transformation. May not be implemented or may return</span></div>
|
|
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span> <span class="comment"> /// approximate result</span></div>
|
|
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span> <span class="comment"></span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1VectorTransform.html#a101ce54f1c60df19478801aa942470d9">reverse_transform</a> (idx_t n, <span class="keyword">const</span> <span class="keywordtype">float</span> * xt,</div>
|
|
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordtype">float</span> *x) <span class="keyword">const</span>;</div>
|
|
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span> </div>
|
|
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keyword">virtual</span> ~<a class="code" href="structfaiss_1_1VectorTransform.html">VectorTransform</a> () {}</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> };</div>
|
|
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span> </div>
|
|
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span> </div>
|
|
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span> <span class="comment">/** Generic linear transformation, with bias term applied on output</span></div>
|
|
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> <span class="comment"> * y = A * x + b</span></div>
|
|
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span> <span class="comment"> */</span></div>
|
|
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="structfaiss_1_1LinearTransform.html"> 77</a></span> <span class="keyword">struct </span><a class="code" href="structfaiss_1_1LinearTransform.html">LinearTransform</a>: <a class="code" href="structfaiss_1_1VectorTransform.html">VectorTransform</a> {</div>
|
|
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> </div>
|
|
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordtype">bool</span> have_bias; <span class="comment">///! whether to use the bias term</span></div>
|
|
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="comment"></span><span class="comment"></span></div>
|
|
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> <span class="comment"> /// Transformation matrix, size d_out * d_in</span></div>
|
|
<div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="structfaiss_1_1LinearTransform.html#aa40e156ef57fe206cd5f3a58ec0660da"> 82</a></span> <span class="comment"></span> std::vector<float> <a class="code" href="structfaiss_1_1LinearTransform.html#aa40e156ef57fe206cd5f3a58ec0660da">A</a>;</div>
|
|
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> <span class="comment"> /// bias vector, size d_out</span></div>
|
|
<div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="structfaiss_1_1LinearTransform.html#ab0383f690aeb823876e9143febad1a87"> 85</a></span> <span class="comment"></span> std::vector<float> <a class="code" href="structfaiss_1_1LinearTransform.html#ab0383f690aeb823876e9143febad1a87">b</a>;</div>
|
|
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span> <span class="comment"> /// both d_in > d_out and d_out < d_in are supported</span></div>
|
|
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span> <span class="comment"></span> <span class="keyword">explicit</span> <a class="code" href="structfaiss_1_1LinearTransform.html#a2fffd6064defb7c3fdaf143c0c4a9bc7">LinearTransform</a> (<span class="keywordtype">int</span> d_in = 0, <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1VectorTransform.html#a589d612f7b1773614619a0cbecd728a9">d_out</a> = 0,</div>
|
|
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <span class="keywordtype">bool</span> have_bias = <span class="keyword">false</span>);</div>
|
|
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="comment"> /// same as apply, but result is pre-allocated</span></div>
|
|
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1LinearTransform.html#af9c20b4ae67691b5713489884ca9f80f">apply_noalloc</a>(idx_t n, <span class="keyword">const</span> <span class="keywordtype">float</span>* x, <span class="keywordtype">float</span>* xt) <span class="keyword">const override</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"> /// compute x = A^T * (x - b)</span></div>
|
|
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span> <span class="comment"> /// is reverse transform if A has orthonormal lines</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_1LinearTransform.html#a1642efca4f5eb524c29722b0441c4d13">transform_transpose</a> (idx_t n, <span class="keyword">const</span> <span class="keywordtype">float</span> * y,</div>
|
|
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="keywordtype">float</span> *x) <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="keywordtype">bool</span> verbose;</div>
|
|
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> </div>
|
|
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  ~<a class="code" href="structfaiss_1_1LinearTransform.html">LinearTransform</a>()<span class="keyword"> override </span>{}</div>
|
|
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> };</div>
|
|
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span> </div>
|
|
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span> </div>
|
|
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span> <span class="comment">/// Randomly rotate a set of vectors</span></div>
|
|
<div class="line"><a name="l00107"></a><span class="lineno"><a class="line" href="structfaiss_1_1RandomRotationMatrix.html"> 107</a></span> <span class="comment"></span><span class="keyword">struct </span><a class="code" href="structfaiss_1_1RandomRotationMatrix.html">RandomRotationMatrix</a>: <a class="code" href="structfaiss_1_1LinearTransform.html">LinearTransform</a> {</div>
|
|
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span> <span class="comment"> /// both d_in > d_out and d_out < d_in are supported</span></div>
|
|
<div class="line"><a name="l00110"></a><span class="lineno"><a class="line" href="structfaiss_1_1RandomRotationMatrix.html#a64e406c8f73c7692bcf7d97b27305fc6"> 110</a></span> <span class="comment"></span> <a class="code" href="structfaiss_1_1RandomRotationMatrix.html#a64e406c8f73c7692bcf7d97b27305fc6">RandomRotationMatrix</a> (<span class="keywordtype">int</span> d_in, <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1VectorTransform.html#a589d612f7b1773614619a0cbecd728a9">d_out</a>):</div>
|
|
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <a class="code" href="structfaiss_1_1LinearTransform.html">LinearTransform</a>(d_in, d_out, false) {}</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="comment"> /// must be called before the transform is used</span></div>
|
|
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1RandomRotationMatrix.html#a857ad8c32fb76b3298d4eea4338ff66f">init</a>(<span class="keywordtype">int</span> seed);</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> <a class="code" href="structfaiss_1_1RandomRotationMatrix.html#a3ad86e9ae3bdc2090c1f5fc62a335c16">reverse_transform</a>(idx_t n, <span class="keyword">const</span> <span class="keywordtype">float</span>* xt, <span class="keywordtype">float</span>* x) <span class="keyword">const override</span>;</div>
|
|
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span> </div>
|
|
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <a class="code" href="structfaiss_1_1RandomRotationMatrix.html">RandomRotationMatrix</a> () {}</div>
|
|
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span> };</div>
|
|
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> </div>
|
|
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span> <span class="comment">/** Applies a principal component analysis on a set of vectors,</span></div>
|
|
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span> <span class="comment"> * with optionally whitening and random rotation. */</span></div>
|
|
<div class="line"><a name="l00124"></a><span class="lineno"><a class="line" href="structfaiss_1_1PCAMatrix.html"> 124</a></span> <span class="keyword">struct </span><a class="code" href="structfaiss_1_1PCAMatrix.html">PCAMatrix</a>: <a class="code" href="structfaiss_1_1LinearTransform.html">LinearTransform</a> {</div>
|
|
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span> <span class="comment"> /** after transformation the components are multiplied by</span></div>
|
|
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span> <span class="comment"> * eigenvalues^eigen_power</span></div>
|
|
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span> <span class="comment"> *</span></div>
|
|
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span> <span class="comment"> * =0: no whitening</span></div>
|
|
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="comment"> * =-2: full whitening</span></div>
|
|
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span> <span class="comment"> */</span></div>
|
|
<div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="structfaiss_1_1PCAMatrix.html#a4e48e801f98ba2cf57c03b0913d6fafc"> 132</a></span>  <span class="keywordtype">float</span> <a class="code" href="structfaiss_1_1PCAMatrix.html#a4e48e801f98ba2cf57c03b0913d6fafc">eigen_power</a>;</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"> /// random rotation after PCA</span></div>
|
|
<div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="structfaiss_1_1PCAMatrix.html#af111f055b7571703a3aa270d89e99321"> 135</a></span> <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="structfaiss_1_1PCAMatrix.html#af111f055b7571703a3aa270d89e99321">random_rotation</a>;</div>
|
|
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span> <span class="comment"> /// ratio between # training vectors and dimension</span></div>
|
|
<div class="line"><a name="l00138"></a><span class="lineno"><a class="line" href="structfaiss_1_1PCAMatrix.html#abdce90f57a3c4401f5230f03da901e0d"> 138</a></span> <span class="comment"></span> <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1PCAMatrix.html#abdce90f57a3c4401f5230f03da901e0d">max_points_per_d</a>;</div>
|
|
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span> <span class="comment"> /// try to distribute output eigenvectors in this many bins</span></div>
|
|
<div class="line"><a name="l00141"></a><span class="lineno"><a class="line" href="structfaiss_1_1PCAMatrix.html#ac9a4c97b5861081dfd8ca5881bb1a677"> 141</a></span> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1PCAMatrix.html#ac9a4c97b5861081dfd8ca5881bb1a677">balanced_bins</a>;</div>
|
|
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span> <span class="comment"> /// Mean, size d_in</span></div>
|
|
<div class="line"><a name="l00144"></a><span class="lineno"><a class="line" href="structfaiss_1_1PCAMatrix.html#a721c338c1df5c99471db82e6d3dc8f93"> 144</a></span> <span class="comment"></span> std::vector<float> <a class="code" href="structfaiss_1_1PCAMatrix.html#a721c338c1df5c99471db82e6d3dc8f93">mean</a>;</div>
|
|
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span> <span class="comment"> /// eigenvalues of covariance matrix (= squared singular values)</span></div>
|
|
<div class="line"><a name="l00147"></a><span class="lineno"><a class="line" href="structfaiss_1_1PCAMatrix.html#ae80e130c0667b66cea608c4926d7d561"> 147</a></span> <span class="comment"></span> std::vector<float> <a class="code" href="structfaiss_1_1PCAMatrix.html#ae80e130c0667b66cea608c4926d7d561">eigenvalues</a>;</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"> /// PCA matrix, size d_in * d_in</span></div>
|
|
<div class="line"><a name="l00150"></a><span class="lineno"><a class="line" href="structfaiss_1_1PCAMatrix.html#aef5c130774e5d4f697a3e1c82647bfd3"> 150</a></span> <span class="comment"></span> std::vector<float> <a class="code" href="structfaiss_1_1PCAMatrix.html#aef5c130774e5d4f697a3e1c82647bfd3">PCAMat</a>;</div>
|
|
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span> </div>
|
|
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="comment">// the final matrix is computed after random rotation and/or whitening</span></div>
|
|
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <span class="keyword">explicit</span> <a class="code" href="structfaiss_1_1PCAMatrix.html">PCAMatrix</a> (<span class="keywordtype">int</span> d_in = 0, <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1VectorTransform.html#a589d612f7b1773614619a0cbecd728a9">d_out</a> = 0,</div>
|
|
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <span class="keywordtype">float</span> <a class="code" href="structfaiss_1_1PCAMatrix.html#a4e48e801f98ba2cf57c03b0913d6fafc">eigen_power</a> = 0, <span class="keywordtype">bool</span> <a class="code" href="structfaiss_1_1PCAMatrix.html#af111f055b7571703a3aa270d89e99321">random_rotation</a> = <span class="keyword">false</span>);</div>
|
|
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span> <span class="comment"> /// train on n vectors. If n < d_in then the eigenvector matrix</span></div>
|
|
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span> <span class="comment"> /// will be completed with 0s</span></div>
|
|
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1PCAMatrix.html#a8f2dd12da8dce3cbeb22da9c5d4ec3e7">train</a>(<a class="code" href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">Index::idx_t</a> n, <span class="keyword">const</span> <span class="keywordtype">float</span>* x) <span class="keyword">override</span>;</div>
|
|
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span> </div>
|
|
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1PCAMatrix.html#abf427521a66cbfaaf0b7aae16bcb6e93">reverse_transform</a>(idx_t n, <span class="keyword">const</span> <span class="keywordtype">float</span>* xt, <span class="keywordtype">float</span>* x) <span class="keyword">const override</span>;</div>
|
|
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span> <span class="comment"> /// copy pre-trained PCA matrix</span></div>
|
|
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1PCAMatrix.html#ae586dc89db6c57753c687473417742a6">copy_from</a> (<span class="keyword">const</span> <a class="code" href="structfaiss_1_1PCAMatrix.html">PCAMatrix</a> & other);</div>
|
|
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span> <span class="comment"> /// called after mean, PCAMat and eigenvalues are computed</span></div>
|
|
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1PCAMatrix.html#a117a70b8fca6d125725fe49fddebf97b">prepare_Ab</a>();</div>
|
|
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span> </div>
|
|
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span> };</div>
|
|
<div class="line"><a name="l00169"></a><span class="lineno"> 169</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> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span> <span class="comment">/** Applies a rotation to align the dimensions with a PQ to minimize</span></div>
|
|
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span> <span class="comment"> * the reconstruction error. Can be used before an IndexPQ or an</span></div>
|
|
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span> <span class="comment"> * IndexIVFPQ. The method is the non-parametric version described in:</span></div>
|
|
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span> <span class="comment"> *</span></div>
|
|
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span> <span class="comment"> * "Optimized Product Quantization for Approximate Nearest Neighbor Search"</span></div>
|
|
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span> <span class="comment"> * Tiezheng Ge, Kaiming He, Qifa Ke, Jian Sun, CVPR'13</span></div>
|
|
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span> <span class="comment"> *</span></div>
|
|
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span> <span class="comment"> */</span></div>
|
|
<div class="line"><a name="l00180"></a><span class="lineno"><a class="line" href="structfaiss_1_1OPQMatrix.html"> 180</a></span> <span class="keyword">struct </span><a class="code" href="structfaiss_1_1OPQMatrix.html">OPQMatrix</a>: <a class="code" href="structfaiss_1_1LinearTransform.html">LinearTransform</a> {</div>
|
|
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span> </div>
|
|
<div class="line"><a name="l00182"></a><span class="lineno"><a class="line" href="structfaiss_1_1OPQMatrix.html#a07ad0c0c84f96a6880c1c8eaf09596e3"> 182</a></span>  <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1OPQMatrix.html#a07ad0c0c84f96a6880c1c8eaf09596e3">M</a>; <span class="comment">///< nb of subquantizers</span></div>
|
|
<div class="line"><a name="l00183"></a><span class="lineno"><a class="line" href="structfaiss_1_1OPQMatrix.html#a12cb3e05989dee37592b682070c31000"> 183</a></span> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1OPQMatrix.html#a12cb3e05989dee37592b682070c31000">niter</a>; <span class="comment">///< Number of outer training iterations</span></div>
|
|
<div class="line"><a name="l00184"></a><span class="lineno"><a class="line" href="structfaiss_1_1OPQMatrix.html#ab88c87a3931ec356904abf5f1f797a83"> 184</a></span> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1OPQMatrix.html#ab88c87a3931ec356904abf5f1f797a83">niter_pq</a>; <span class="comment">///< Number of training iterations for the PQ</span></div>
|
|
<div class="line"><a name="l00185"></a><span class="lineno"><a class="line" href="structfaiss_1_1OPQMatrix.html#a6406e97b05c831cc19b9343be3b43a1f"> 185</a></span> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1OPQMatrix.html#a6406e97b05c831cc19b9343be3b43a1f">niter_pq_0</a>; <span class="comment">///< same, for the first outer iteration</span></div>
|
|
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span> <span class="comment"></span><span class="comment"></span></div>
|
|
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span> <span class="comment"> /// if there are too many training points, resample</span></div>
|
|
<div class="line"><a name="l00188"></a><span class="lineno"><a class="line" href="structfaiss_1_1OPQMatrix.html#afdd5b2c74d19ccc5c7a6e0199333321a"> 188</a></span> <span class="comment"></span> <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1OPQMatrix.html#afdd5b2c74d19ccc5c7a6e0199333321a">max_train_points</a>;</div>
|
|
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <span class="keywordtype">bool</span> verbose;</div>
|
|
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span> <span class="comment"> /// if d2 != -1, output vectors of this dimension</span></div>
|
|
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span> <span class="comment"></span> <span class="keyword">explicit</span> <a class="code" href="structfaiss_1_1OPQMatrix.html#a6eb9d18ff15b1c598d3aa3bc9ab84519">OPQMatrix</a> (<span class="keywordtype">int</span> d = 0, <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1OPQMatrix.html#a07ad0c0c84f96a6880c1c8eaf09596e3">M</a> = 1, <span class="keywordtype">int</span> d2 = -1);</div>
|
|
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span> </div>
|
|
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1OPQMatrix.html#a1e314577db0c6cd4a709503f73eb71e2">train</a>(<a class="code" href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">Index::idx_t</a> n, <span class="keyword">const</span> <span class="keywordtype">float</span>* x) <span class="keyword">override</span>;</div>
|
|
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span> </div>
|
|
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1OPQMatrix.html#a8e61a84ea6bcbdee1809028b6aaa3aae">reverse_transform</a>(idx_t n, <span class="keyword">const</span> <span class="keywordtype">float</span>* xt, <span class="keywordtype">float</span>* x) <span class="keyword">const override</span>;</div>
|
|
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span> };</div>
|
|
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span> </div>
|
|
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span> <span class="comment">/** remap dimensions for intput vectors, possibly inserting 0s</span></div>
|
|
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span> <span class="comment"> * strictly speaking this is also a linear transform but we don't want</span></div>
|
|
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span> <span class="comment"> * to compute it with matrix multiplies */</span></div>
|
|
<div class="line"><a name="l00203"></a><span class="lineno"><a class="line" href="structfaiss_1_1RemapDimensionsTransform.html"> 203</a></span> <span class="keyword">struct </span><a class="code" href="structfaiss_1_1RemapDimensionsTransform.html">RemapDimensionsTransform</a>: <a class="code" href="structfaiss_1_1VectorTransform.html">VectorTransform</a> {</div>
|
|
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span> <span class="comment"> /// map from output dimension to input, size d_out</span></div>
|
|
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span> <span class="comment"> /// -1 -> set output to 0</span></div>
|
|
<div class="line"><a name="l00207"></a><span class="lineno"><a class="line" href="structfaiss_1_1RemapDimensionsTransform.html#a09202a195ff5f75f83e68792751a637f"> 207</a></span> <span class="comment"></span> std::vector<int> <a class="code" href="structfaiss_1_1RemapDimensionsTransform.html#a09202a195ff5f75f83e68792751a637f">map</a>;</div>
|
|
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span> </div>
|
|
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  <a class="code" href="structfaiss_1_1RemapDimensionsTransform.html">RemapDimensionsTransform</a> (<span class="keywordtype">int</span> d_in, <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1VectorTransform.html#a589d612f7b1773614619a0cbecd728a9">d_out</a>, <span class="keyword">const</span> <span class="keywordtype">int</span> *<a class="code" href="structfaiss_1_1RemapDimensionsTransform.html#a09202a195ff5f75f83e68792751a637f">map</a>);</div>
|
|
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span> <span class="comment"> /// remap input to output, skipping or inserting dimensions as needed</span></div>
|
|
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span> <span class="comment"> /// if uniform: distribute dimensions uniformly</span></div>
|
|
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span> <span class="comment"> /// otherwise just take the d_out first ones.</span></div>
|
|
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span> <span class="comment"></span> <a class="code" href="structfaiss_1_1RemapDimensionsTransform.html">RemapDimensionsTransform</a> (<span class="keywordtype">int</span> d_in, <span class="keywordtype">int</span> <a class="code" href="structfaiss_1_1VectorTransform.html#a589d612f7b1773614619a0cbecd728a9">d_out</a>, <span class="keywordtype">bool</span> uniform = <span class="keyword">true</span>);</div>
|
|
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span> </div>
|
|
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1RemapDimensionsTransform.html#a550be3d40c221d2134bf06a13dd33c4d">apply_noalloc</a>(idx_t n, <span class="keyword">const</span> <span class="keywordtype">float</span>* x, <span class="keywordtype">float</span>* xt) <span class="keyword">const override</span>;</div>
|
|
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span> <span class="comment"> /// reverse transform correct only when the mapping is a permuation</span></div>
|
|
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1RemapDimensionsTransform.html#a2fc83e79e4d3c7853bfd6931cbbaf82a">reverse_transform</a>(idx_t n, <span class="keyword">const</span> <span class="keywordtype">float</span>* xt, <span class="keywordtype">float</span>* x) <span class="keyword">const override</span>;</div>
|
|
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span> </div>
|
|
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  <a class="code" href="structfaiss_1_1RemapDimensionsTransform.html">RemapDimensionsTransform</a> () {}</div>
|
|
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span> };</div>
|
|
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span> </div>
|
|
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span> <span class="comment">/** per-vector normalization */</span></div>
|
|
<div class="line"><a name="l00226"></a><span class="lineno"><a class="line" href="structfaiss_1_1NormalizationTransform.html"> 226</a></span> <span class="keyword">struct </span><a class="code" href="structfaiss_1_1NormalizationTransform.html">NormalizationTransform</a>: <a class="code" href="structfaiss_1_1VectorTransform.html">VectorTransform</a> {</div>
|
|
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <span class="keywordtype">float</span> norm;</div>
|
|
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span> </div>
|
|
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  <span class="keyword">explicit</span> <a class="code" href="structfaiss_1_1NormalizationTransform.html">NormalizationTransform</a> (<span class="keywordtype">int</span> d, <span class="keywordtype">float</span> norm = 2.0);</div>
|
|
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <a class="code" href="structfaiss_1_1NormalizationTransform.html">NormalizationTransform</a> ();</div>
|
|
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span> </div>
|
|
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1NormalizationTransform.html#a80c94dc7d17c9a7a9edc627150401571">apply_noalloc</a>(idx_t n, <span class="keyword">const</span> <span class="keywordtype">float</span>* x, <span class="keywordtype">float</span>* xt) <span class="keyword">const override</span>;</div>
|
|
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span> };</div>
|
|
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span> </div>
|
|
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span> </div>
|
|
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span> <span class="comment">/** Index that applies a LinearTransform transform on vectors before</span></div>
|
|
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span> <span class="comment"> * handing them over to a sub-index */</span></div>
|
|
<div class="line"><a name="l00239"></a><span class="lineno"><a class="line" href="structfaiss_1_1IndexPreTransform.html"> 239</a></span> <span class="keyword">struct </span><a class="code" href="structfaiss_1_1IndexPreTransform.html">IndexPreTransform</a>: <a class="code" href="structfaiss_1_1Index.html">Index</a> {</div>
|
|
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span> </div>
|
|
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  std::vector<VectorTransform *> chain; <span class="comment">///! chain of tranforms</span></div>
|
|
<div class="line"><a name="l00242"></a><span class="lineno"><a class="line" href="structfaiss_1_1IndexPreTransform.html#aee3cbbe7915ec9ed13d59ca9276bdefc"> 242</a></span> <span class="comment"></span> <a class="code" href="structfaiss_1_1Index.html">Index</a> * <a class="code" href="structfaiss_1_1IndexPreTransform.html#aee3cbbe7915ec9ed13d59ca9276bdefc">index</a>; <span class="comment">///! the sub-index</span></div>
|
|
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00244"></a><span class="lineno"><a class="line" href="structfaiss_1_1IndexPreTransform.html#ae5ec3f184eb211e7d6e204082b52c8c0"> 244</a></span>  <span class="keywordtype">bool</span> <a class="code" href="structfaiss_1_1IndexPreTransform.html#ae5ec3f184eb211e7d6e204082b52c8c0">own_fields</a>; <span class="comment">///! whether pointers are deleted in destructor</span></div>
|
|
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <span class="keyword">explicit</span> <a class="code" href="structfaiss_1_1IndexPreTransform.html">IndexPreTransform</a> (<a class="code" href="structfaiss_1_1Index.html">Index</a> *<a class="code" href="structfaiss_1_1IndexPreTransform.html#aee3cbbe7915ec9ed13d59ca9276bdefc">index</a>);</div>
|
|
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span> </div>
|
|
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  <a class="code" href="structfaiss_1_1IndexPreTransform.html">IndexPreTransform</a> ();</div>
|
|
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span> <span class="comment"> /// ltrans is the last transform before the index</span></div>
|
|
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span> <span class="comment"></span> <a class="code" href="structfaiss_1_1IndexPreTransform.html">IndexPreTransform</a> (<a class="code" href="structfaiss_1_1VectorTransform.html">VectorTransform</a> * ltrans, <a class="code" href="structfaiss_1_1Index.html">Index</a> * <a class="code" href="structfaiss_1_1IndexPreTransform.html#aee3cbbe7915ec9ed13d59ca9276bdefc">index</a>);</div>
|
|
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span> </div>
|
|
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <span class="keywordtype">void</span> prepend_transform (<a class="code" href="structfaiss_1_1VectorTransform.html">VectorTransform</a> * ltrans);</div>
|
|
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span> </div>
|
|
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1IndexPreTransform.html#a416aaf28d7a533dcf7d2d7de434e993c">train</a>(<a class="code" href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> n, <span class="keyword">const</span> <span class="keywordtype">float</span>* x) <span class="keyword">override</span>;</div>
|
|
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span> </div>
|
|
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1IndexPreTransform.html#a03c77c582a3421952e2cba2057083059">add</a>(<a class="code" href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> n, <span class="keyword">const</span> <span class="keywordtype">float</span>* x) <span class="keyword">override</span>;</div>
|
|
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span> </div>
|
|
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1IndexPreTransform.html#a07fef0553b2ef2907f394470f61898b2">add_with_ids</a>(<a class="code" href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> n, <span class="keyword">const</span> <span class="keywordtype">float</span>* x, <span class="keyword">const</span> <span class="keywordtype">long</span>* xids) <span class="keyword">override</span>;</div>
|
|
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span> </div>
|
|
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1IndexPreTransform.html#a8e48ac9fde5e76e378553b2a6ec2c86e">reset</a>() <span class="keyword">override</span>;</div>
|
|
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span> <span class="comment"> /** removes IDs from the index. Not supported by all indexes.</span></div>
|
|
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span> <span class="comment"> */</span></div>
|
|
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  <span class="keywordtype">long</span> <a class="code" href="structfaiss_1_1IndexPreTransform.html#ad4e59f4dacc1d8183a788510680f0df5">remove_ids</a>(<span class="keyword">const</span> <a class="code" href="structfaiss_1_1IDSelector.html">IDSelector</a>& sel) <span class="keyword">override</span>;</div>
|
|
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span> </div>
|
|
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1IndexPreTransform.html#a7c2c820895d87083742969c281ae4911">search</a>(</div>
|
|
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  <a class="code" href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> n,</div>
|
|
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>  <span class="keyword">const</span> <span class="keywordtype">float</span>* x,</div>
|
|
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  <a class="code" href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> k,</div>
|
|
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  <span class="keywordtype">float</span>* distances,</div>
|
|
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  <a class="code" href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a>* labels) <span class="keyword">const override</span>;</div>
|
|
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span> </div>
|
|
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1IndexPreTransform.html#a370dd6ef091393401fa9b60e3d1d25b2">reconstruct_n</a> (<a class="code" href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> i0, <a class="code" href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> ni, <span class="keywordtype">float</span> *recons)</div>
|
|
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  <span class="keyword">const override</span>;</div>
|
|
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span> <span class="comment"></span></div>
|
|
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span> <span class="comment"> /// apply the transforms in the chain. The returned float * may be</span></div>
|
|
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span> <span class="comment"> /// equal to x, otherwise it should be deallocated.</span></div>
|
|
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span> <span class="comment"></span> <span class="keyword">const</span> <span class="keywordtype">float</span> * <a class="code" href="structfaiss_1_1IndexPreTransform.html#aa773a5763ebdd1561152b34453fda96d">apply_chain</a> (<a class="code" href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">idx_t</a> n, <span class="keyword">const</span> <span class="keywordtype">float</span> *x) <span class="keyword">const</span>;</div>
|
|
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span> </div>
|
|
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  ~<a class="code" href="structfaiss_1_1IndexPreTransform.html">IndexPreTransform</a>() <span class="keyword">override</span>;</div>
|
|
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span> };</div>
|
|
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span> </div>
|
|
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span> </div>
|
|
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span> </div>
|
|
<div class="line"><a name="l00286"></a><span class="lineno"> 286</span> } <span class="comment">// namespace faiss</span></div>
|
|
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span> </div>
|
|
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span> </div>
|
|
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span> </div>
|
|
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span> <span class="preprocessor">#endif</span></div>
|
|
<div class="ttc" id="structfaiss_1_1LinearTransform_html_a1642efca4f5eb524c29722b0441c4d13"><div class="ttname"><a href="structfaiss_1_1LinearTransform.html#a1642efca4f5eb524c29722b0441c4d13">faiss::LinearTransform::transform_transpose</a></div><div class="ttdeci">void transform_transpose(idx_t n, const float *y, float *x) const </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00134">VectorTransform.cpp:134</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1IndexPreTransform_html_aee3cbbe7915ec9ed13d59ca9276bdefc"><div class="ttname"><a href="structfaiss_1_1IndexPreTransform.html#aee3cbbe7915ec9ed13d59ca9276bdefc">faiss::IndexPreTransform::index</a></div><div class="ttdeci">Index * index</div><div class="ttdoc">! chain of tranforms </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00242">VectorTransform.h:242</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1RandomRotationMatrix_html"><div class="ttname"><a href="structfaiss_1_1RandomRotationMatrix.html">faiss::RandomRotationMatrix</a></div><div class="ttdoc">Randomly rotate a set of vectors. </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00107">VectorTransform.h:107</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1OPQMatrix_html_a12cb3e05989dee37592b682070c31000"><div class="ttname"><a href="structfaiss_1_1OPQMatrix.html#a12cb3e05989dee37592b682070c31000">faiss::OPQMatrix::niter</a></div><div class="ttdeci">int niter</div><div class="ttdoc">Number of outer training iterations. </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00183">VectorTransform.h:183</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1RandomRotationMatrix_html_a64e406c8f73c7692bcf7d97b27305fc6"><div class="ttname"><a href="structfaiss_1_1RandomRotationMatrix.html#a64e406c8f73c7692bcf7d97b27305fc6">faiss::RandomRotationMatrix::RandomRotationMatrix</a></div><div class="ttdeci">RandomRotationMatrix(int d_in, int d_out)</div><div class="ttdoc">both d_in &gt; d_out and d_out &lt; d_in are supported </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00110">VectorTransform.h:110</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1RandomRotationMatrix_html_a857ad8c32fb76b3298d4eea4338ff66f"><div class="ttname"><a href="structfaiss_1_1RandomRotationMatrix.html#a857ad8c32fb76b3298d4eea4338ff66f">faiss::RandomRotationMatrix::init</a></div><div class="ttdeci">void init(int seed)</div><div class="ttdoc">must be called before the transform is used </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00164">VectorTransform.cpp:164</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1IndexPreTransform_html_a8e48ac9fde5e76e378553b2a6ec2c86e"><div class="ttname"><a href="structfaiss_1_1IndexPreTransform.html#a8e48ac9fde5e76e378553b2a6ec2c86e">faiss::IndexPreTransform::reset</a></div><div class="ttdeci">void reset() override</div><div class="ttdoc">removes all elements from the database. </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00894">VectorTransform.cpp:894</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1OPQMatrix_html_ab88c87a3931ec356904abf5f1f797a83"><div class="ttname"><a href="structfaiss_1_1OPQMatrix.html#ab88c87a3931ec356904abf5f1f797a83">faiss::OPQMatrix::niter_pq</a></div><div class="ttdeci">int niter_pq</div><div class="ttdoc">Number of training iterations for the PQ. </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00184">VectorTransform.h:184</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1LinearTransform_html_aa40e156ef57fe206cd5f3a58ec0660da"><div class="ttname"><a href="structfaiss_1_1LinearTransform.html#aa40e156ef57fe206cd5f3a58ec0660da">faiss::LinearTransform::A</a></div><div class="ttdeci">std::vector< float > A</div><div class="ttdoc">! whether to use the bias term </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00082">VectorTransform.h:82</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1PCAMatrix_html_a4e48e801f98ba2cf57c03b0913d6fafc"><div class="ttname"><a href="structfaiss_1_1PCAMatrix.html#a4e48e801f98ba2cf57c03b0913d6fafc">faiss::PCAMatrix::eigen_power</a></div><div class="ttdeci">float eigen_power</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00132">VectorTransform.h:132</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1IDSelector_html"><div class="ttname"><a href="structfaiss_1_1IDSelector.html">faiss::IDSelector</a></div><div class="ttdef"><b>Definition:</b> <a href="AuxIndexStructures_8h_source.html#l00052">AuxIndexStructures.h:52</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1LinearTransform_html_a2fffd6064defb7c3fdaf143c0c4a9bc7"><div class="ttname"><a href="structfaiss_1_1LinearTransform.html#a2fffd6064defb7c3fdaf143c0c4a9bc7">faiss::LinearTransform::LinearTransform</a></div><div class="ttdeci">LinearTransform(int d_in=0, int d_out=0, bool have_bias=false)</div><div class="ttdoc">both d_in &gt; d_out and d_out &lt; d_in are supported </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00099">VectorTransform.cpp:99</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1PCAMatrix_html"><div class="ttname"><a href="structfaiss_1_1PCAMatrix.html">faiss::PCAMatrix</a></div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00124">VectorTransform.h:124</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1VectorTransform_html_a137f48bab695736f0b1d79a50cddc858"><div class="ttname"><a href="structfaiss_1_1VectorTransform.html#a137f48bab695736f0b1d79a50cddc858">faiss::VectorTransform::VectorTransform</a></div><div class="ttdeci">VectorTransform(int d_in=0, int d_out=0)</div><div class="ttdoc">! output dimension </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00035">VectorTransform.h:35</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1OPQMatrix_html"><div class="ttname"><a href="structfaiss_1_1OPQMatrix.html">faiss::OPQMatrix</a></div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00180">VectorTransform.h:180</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1PCAMatrix_html_a8f2dd12da8dce3cbeb22da9c5d4ec3e7"><div class="ttname"><a href="structfaiss_1_1PCAMatrix.html#a8f2dd12da8dce3cbeb22da9c5d4ec3e7">faiss::PCAMatrix::train</a></div><div class="ttdeci">void train(Index::idx_t n, const float *x) override</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00271">VectorTransform.cpp:271</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1IndexPreTransform_html"><div class="ttname"><a href="structfaiss_1_1IndexPreTransform.html">faiss::IndexPreTransform</a></div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00239">VectorTransform.h:239</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1PCAMatrix_html_a721c338c1df5c99471db82e6d3dc8f93"><div class="ttname"><a href="structfaiss_1_1PCAMatrix.html#a721c338c1df5c99471db82e6d3dc8f93">faiss::PCAMatrix::mean</a></div><div class="ttdeci">std::vector< float > mean</div><div class="ttdoc">Mean, size d_in. </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00144">VectorTransform.h:144</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1RemapDimensionsTransform_html_a09202a195ff5f75f83e68792751a637f"><div class="ttname"><a href="structfaiss_1_1RemapDimensionsTransform.html#a09202a195ff5f75f83e68792751a637f">faiss::RemapDimensionsTransform::map</a></div><div class="ttdeci">std::vector< int > map</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00207">VectorTransform.h:207</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1IndexPreTransform_html_aa773a5763ebdd1561152b34453fda96d"><div class="ttname"><a href="structfaiss_1_1IndexPreTransform.html#aa773a5763ebdd1561152b34453fda96d">faiss::IndexPreTransform::apply_chain</a></div><div class="ttdeci">const float * apply_chain(idx_t n, const float *x) const </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00847">VectorTransform.cpp:847</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1PCAMatrix_html_aef5c130774e5d4f697a3e1c82647bfd3"><div class="ttname"><a href="structfaiss_1_1PCAMatrix.html#aef5c130774e5d4f697a3e1c82647bfd3">faiss::PCAMatrix::PCAMat</a></div><div class="ttdeci">std::vector< float > PCAMat</div><div class="ttdoc">PCA matrix, size d_in * d_in. </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00150">VectorTransform.h:150</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1IndexPreTransform_html_a416aaf28d7a533dcf7d2d7de434e993c"><div class="ttname"><a href="structfaiss_1_1IndexPreTransform.html#a416aaf28d7a533dcf7d2d7de434e993c">faiss::IndexPreTransform::train</a></div><div class="ttdeci">void train(idx_t n, const float *x) override</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00791">VectorTransform.cpp:791</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1LinearTransform_html_ab0383f690aeb823876e9143febad1a87"><div class="ttname"><a href="structfaiss_1_1LinearTransform.html#ab0383f690aeb823876e9143febad1a87">faiss::LinearTransform::b</a></div><div class="ttdeci">std::vector< float > b</div><div class="ttdoc">bias vector, size d_out </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00085">VectorTransform.h:85</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1LinearTransform_html"><div class="ttname"><a href="structfaiss_1_1LinearTransform.html">faiss::LinearTransform</a></div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00077">VectorTransform.h:77</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1OPQMatrix_html_a1e314577db0c6cd4a709503f73eb71e2"><div class="ttname"><a href="structfaiss_1_1OPQMatrix.html#a1e314577db0c6cd4a709503f73eb71e2">faiss::OPQMatrix::train</a></div><div class="ttdeci">void train(Index::idx_t n, const float *x) override</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00548">VectorTransform.cpp:548</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1PCAMatrix_html_ac9a4c97b5861081dfd8ca5881bb1a677"><div class="ttname"><a href="structfaiss_1_1PCAMatrix.html#ac9a4c97b5861081dfd8ca5881bb1a677">faiss::PCAMatrix::balanced_bins</a></div><div class="ttdeci">int balanced_bins</div><div class="ttdoc">try to distribute output eigenvectors in this many bins </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00141">VectorTransform.h:141</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1VectorTransform_html_ab511f1ddf608c00204555881ca28cb02"><div class="ttname"><a href="structfaiss_1_1VectorTransform.html#ab511f1ddf608c00204555881ca28cb02">faiss::VectorTransform::is_trained</a></div><div class="ttdeci">bool is_trained</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00042">VectorTransform.h:42</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1Index_html_a040c6aed1f224f3ea7bf58eebc0c31a4"><div class="ttname"><a href="structfaiss_1_1Index.html#a040c6aed1f224f3ea7bf58eebc0c31a4">faiss::Index::idx_t</a></div><div class="ttdeci">long idx_t</div><div class="ttdoc">all indices are this type </div><div class="ttdef"><b>Definition:</b> <a href="Index_8h_source.html#l00062">Index.h:62</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1IndexPreTransform_html_a370dd6ef091393401fa9b60e3d1d25b2"><div class="ttname"><a href="structfaiss_1_1IndexPreTransform.html#a370dd6ef091393401fa9b60e3d1d25b2">faiss::IndexPreTransform::reconstruct_n</a></div><div class="ttdeci">void reconstruct_n(idx_t i0, idx_t ni, float *recons) const override</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00906">VectorTransform.cpp:906</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1NormalizationTransform_html_a80c94dc7d17c9a7a9edc627150401571"><div class="ttname"><a href="structfaiss_1_1NormalizationTransform.html#a80c94dc7d17c9a7a9edc627150401571">faiss::NormalizationTransform::apply_noalloc</a></div><div class="ttdeci">void apply_noalloc(idx_t n, const float *x, float *xt) const override</div><div class="ttdoc">same as apply, but result is pre-allocated </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00731">VectorTransform.cpp:731</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1VectorTransform_html"><div class="ttname"><a href="structfaiss_1_1VectorTransform.html">faiss::VectorTransform</a></div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00028">VectorTransform.h:28</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1IndexPreTransform_html_ae5ec3f184eb211e7d6e204082b52c8c0"><div class="ttname"><a href="structfaiss_1_1IndexPreTransform.html#ae5ec3f184eb211e7d6e204082b52c8c0">faiss::IndexPreTransform::own_fields</a></div><div class="ttdeci">bool own_fields</div><div class="ttdoc">! the sub-index </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00244">VectorTransform.h:244</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1OPQMatrix_html_a6406e97b05c831cc19b9343be3b43a1f"><div class="ttname"><a href="structfaiss_1_1OPQMatrix.html#a6406e97b05c831cc19b9343be3b43a1f">faiss::OPQMatrix::niter_pq_0</a></div><div class="ttdeci">int niter_pq_0</div><div class="ttdoc">same, for the first outer iteration </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00185">VectorTransform.h:185</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1OPQMatrix_html_a8e61a84ea6bcbdee1809028b6aaa3aae"><div class="ttname"><a href="structfaiss_1_1OPQMatrix.html#a8e61a84ea6bcbdee1809028b6aaa3aae">faiss::OPQMatrix::reverse_transform</a></div><div class="ttdeci">void reverse_transform(idx_t n, const float *xt, float *x) const override</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00709">VectorTransform.cpp:709</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1VectorTransform_html_a7350d4dd28d60866d55ba4f75d2da84c"><div class="ttname"><a href="structfaiss_1_1VectorTransform.html#a7350d4dd28d60866d55ba4f75d2da84c">faiss::VectorTransform::train</a></div><div class="ttdeci">virtual void train(idx_t n, const float *x)</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00080">VectorTransform.cpp:80</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1RandomRotationMatrix_html_a3ad86e9ae3bdc2090c1f5fc62a335c16"><div class="ttname"><a href="structfaiss_1_1RandomRotationMatrix.html#a3ad86e9ae3bdc2090c1f5fc62a335c16">faiss::RandomRotationMatrix::reverse_transform</a></div><div class="ttdeci">void reverse_transform(idx_t n, const float *xt, float *x) const override</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00189">VectorTransform.cpp:189</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1VectorTransform_html_a101ce54f1c60df19478801aa942470d9"><div class="ttname"><a href="structfaiss_1_1VectorTransform.html#a101ce54f1c60df19478801aa942470d9">faiss::VectorTransform::reverse_transform</a></div><div class="ttdeci">virtual void reverse_transform(idx_t n, const float *xt, float *x) const </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00085">VectorTransform.cpp:85</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1RemapDimensionsTransform_html_a2fc83e79e4d3c7853bfd6931cbbaf82a"><div class="ttname"><a href="structfaiss_1_1RemapDimensionsTransform.html#a2fc83e79e4d3c7853bfd6931cbbaf82a">faiss::RemapDimensionsTransform::reverse_transform</a></div><div class="ttdeci">void reverse_transform(idx_t n, const float *xt, float *x) const override</div><div class="ttdoc">reverse transform correct only when the mapping is a permuation </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00975">VectorTransform.cpp:975</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1RemapDimensionsTransform_html"><div class="ttname"><a href="structfaiss_1_1RemapDimensionsTransform.html">faiss::RemapDimensionsTransform</a></div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00203">VectorTransform.h:203</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1PCAMatrix_html_abf427521a66cbfaaf0b7aae16bcb6e93"><div class="ttname"><a href="structfaiss_1_1PCAMatrix.html#abf427521a66cbfaaf0b7aae16bcb6e93">faiss::PCAMatrix::reverse_transform</a></div><div class="ttdeci">void reverse_transform(idx_t n, const float *xt, float *x) const override</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00522">VectorTransform.cpp:522</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1OPQMatrix_html_afdd5b2c74d19ccc5c7a6e0199333321a"><div class="ttname"><a href="structfaiss_1_1OPQMatrix.html#afdd5b2c74d19ccc5c7a6e0199333321a">faiss::OPQMatrix::max_train_points</a></div><div class="ttdeci">size_t max_train_points</div><div class="ttdoc">if there are too many training points, resample </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00188">VectorTransform.h:188</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1PCAMatrix_html_ae586dc89db6c57753c687473417742a6"><div class="ttname"><a href="structfaiss_1_1PCAMatrix.html#ae586dc89db6c57753c687473417742a6">faiss::PCAMatrix::copy_from</a></div><div class="ttdeci">void copy_from(const PCAMatrix &other)</div><div class="ttdoc">copy pre-trained PCA matrix </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00413">VectorTransform.cpp:413</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1VectorTransform_html_a589d612f7b1773614619a0cbecd728a9"><div class="ttname"><a href="structfaiss_1_1VectorTransform.html#a589d612f7b1773614619a0cbecd728a9">faiss::VectorTransform::d_out</a></div><div class="ttdeci">int d_out</div><div class="ttdoc">! input dimension </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00033">VectorTransform.h:33</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1OPQMatrix_html_a6eb9d18ff15b1c598d3aa3bc9ab84519"><div class="ttname"><a href="structfaiss_1_1OPQMatrix.html#a6eb9d18ff15b1c598d3aa3bc9ab84519">faiss::OPQMatrix::OPQMatrix</a></div><div class="ttdeci">OPQMatrix(int d=0, int M=1, int d2=-1)</div><div class="ttdoc">if d2 != -1, output vectors of this dimension </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00535">VectorTransform.cpp:535</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_1PCAMatrix_html_a117a70b8fca6d125725fe49fddebf97b"><div class="ttname"><a href="structfaiss_1_1PCAMatrix.html#a117a70b8fca6d125725fe49fddebf97b">faiss::PCAMatrix::prepare_Ab</a></div><div class="ttdeci">void prepare_Ab()</div><div class="ttdoc">called after mean, PCAMat and eigenvalues are computed </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00423">VectorTransform.cpp:423</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1IndexPreTransform_html_a03c77c582a3421952e2cba2057083059"><div class="ttname"><a href="structfaiss_1_1IndexPreTransform.html#a03c77c582a3421952e2cba2057083059">faiss::IndexPreTransform::add</a></div><div class="ttdeci">void add(idx_t n, const float *x) override</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00862">VectorTransform.cpp:862</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1RemapDimensionsTransform_html_a550be3d40c221d2134bf06a13dd33c4d"><div class="ttname"><a href="structfaiss_1_1RemapDimensionsTransform.html#a550be3d40c221d2134bf06a13dd33c4d">faiss::RemapDimensionsTransform::apply_noalloc</a></div><div class="ttdeci">void apply_noalloc(idx_t n, const float *x, float *xt) const override</div><div class="ttdoc">same as apply, but result is pre-allocated </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00963">VectorTransform.cpp:963</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1PCAMatrix_html_ae80e130c0667b66cea608c4926d7d561"><div class="ttname"><a href="structfaiss_1_1PCAMatrix.html#ae80e130c0667b66cea608c4926d7d561">faiss::PCAMatrix::eigenvalues</a></div><div class="ttdeci">std::vector< float > eigenvalues</div><div class="ttdoc">eigenvalues of covariance matrix (= squared singular values) </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00147">VectorTransform.h:147</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1IndexPreTransform_html_a7c2c820895d87083742969c281ae4911"><div class="ttname"><a href="structfaiss_1_1IndexPreTransform.html#a7c2c820895d87083742969c281ae4911">faiss::IndexPreTransform::search</a></div><div class="ttdeci">void search(idx_t n, const float *x, idx_t k, float *distances, idx_t *labels) const override</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00884">VectorTransform.cpp:884</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1NormalizationTransform_html"><div class="ttname"><a href="structfaiss_1_1NormalizationTransform.html">faiss::NormalizationTransform</a></div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00226">VectorTransform.h:226</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1IndexPreTransform_html_a07fef0553b2ef2907f394470f61898b2"><div class="ttname"><a href="structfaiss_1_1IndexPreTransform.html#a07fef0553b2ef2907f394470f61898b2">faiss::IndexPreTransform::add_with_ids</a></div><div class="ttdeci">void add_with_ids(idx_t n, const float *x, const long *xids) override</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00871">VectorTransform.cpp:871</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1PCAMatrix_html_af111f055b7571703a3aa270d89e99321"><div class="ttname"><a href="structfaiss_1_1PCAMatrix.html#af111f055b7571703a3aa270d89e99321">faiss::PCAMatrix::random_rotation</a></div><div class="ttdeci">bool random_rotation</div><div class="ttdoc">random rotation after PCA </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00135">VectorTransform.h:135</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1PCAMatrix_html_abdce90f57a3c4401f5230f03da901e0d"><div class="ttname"><a href="structfaiss_1_1PCAMatrix.html#abdce90f57a3c4401f5230f03da901e0d">faiss::PCAMatrix::max_points_per_d</a></div><div class="ttdeci">size_t max_points_per_d</div><div class="ttdoc">ratio between # training vectors and dimension </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00138">VectorTransform.h:138</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1VectorTransform_html_af3b3a8bf95911f4b28128001c83f91a5"><div class="ttname"><a href="structfaiss_1_1VectorTransform.html#af3b3a8bf95911f4b28128001c83f91a5">faiss::VectorTransform::apply</a></div><div class="ttdeci">float * apply(idx_t n, const float *x) const </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00072">VectorTransform.cpp:72</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1IndexPreTransform_html_ad4e59f4dacc1d8183a788510680f0df5"><div class="ttname"><a href="structfaiss_1_1IndexPreTransform.html#ad4e59f4dacc1d8183a788510680f0df5">faiss::IndexPreTransform::remove_ids</a></div><div class="ttdeci">long remove_ids(const IDSelector &sel) override</div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00899">VectorTransform.cpp:899</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1VectorTransform_html_a90f1a218c224c049f1bd8b77a78d6aa0"><div class="ttname"><a href="structfaiss_1_1VectorTransform.html#a90f1a218c224c049f1bd8b77a78d6aa0">faiss::VectorTransform::apply_noalloc</a></div><div class="ttdeci">virtual void apply_noalloc(idx_t n, const float *x, float *xt) const =0</div><div class="ttdoc">same as apply, but result is pre-allocated </div></div>
|
|
<div class="ttc" id="structfaiss_1_1OPQMatrix_html_a07ad0c0c84f96a6880c1c8eaf09596e3"><div class="ttname"><a href="structfaiss_1_1OPQMatrix.html#a07ad0c0c84f96a6880c1c8eaf09596e3">faiss::OPQMatrix::M</a></div><div class="ttdeci">int M</div><div class="ttdoc">nb of subquantizers </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8h_source.html#l00182">VectorTransform.h:182</a></div></div>
|
|
<div class="ttc" id="structfaiss_1_1LinearTransform_html_af9c20b4ae67691b5713489884ca9f80f"><div class="ttname"><a href="structfaiss_1_1LinearTransform.html#af9c20b4ae67691b5713489884ca9f80f">faiss::LinearTransform::apply_noalloc</a></div><div class="ttdeci">void apply_noalloc(idx_t n, const float *x, float *xt) const override</div><div class="ttdoc">same as apply, but result is pre-allocated </div><div class="ttdef"><b>Definition:</b> <a href="VectorTransform_8cpp_source.html#l00105">VectorTransform.cpp:105</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>
|