⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ublasmatrix_8hpp-source.html

📁 Bayes滤波器算法C++类说明文档,源码见Bayes滤波器算法
💻 HTML
📖 第 1 页 / 共 4 页
字号:
00147 <span class="keyword">public</span>:<a name="l00148"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w0">00148</a>     <span class="keyword">typedef</span> <span class="keyword">typename</span> MatrixBase::value_type <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w0">value_type</a>;00149 00150     <span class="comment">// No Default Constructor. Empty creation is very error prone</span><a name="l00151"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a0">00151</a>     <span class="keyword">explicit</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a0">FMMatrix</a>(EmptyTag) : MatrixBase()00152     {}  <span class="comment">// Empty constructor</span><a name="l00153"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a1">00153</a>     <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a0">FMMatrix</a>(size_t size1, size_t size2) : MatrixBase(size1,size2)00154     {}  <span class="comment">// Normal sized constructor</span><a name="l00155"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a2">00155</a>     <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a0">FMMatrix</a>(<span class="keyword">const</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html">FMMatrix</a>&amp; c) : MatrixBase(static_cast&lt;const MatrixBase&amp;&gt;(c))00156     {}  <span class="comment">// Copy constructor</span>00157     <span class="keyword">template</span> &lt;<span class="keyword">class</span> E&gt;<a name="l00158"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a3">00158</a>     <span class="keyword">explicit</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a0">FMMatrix</a>(<span class="keyword">const</span> ublas::matrix_expression&lt;E&gt;&amp; e) : MatrixBase(e)00159     {}  <span class="comment">// matrix_expression copy constructor</span>00160 00161     <span class="keyword">template</span> &lt;<span class="keyword">class</span> E&gt;<a name="l00162"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a4">00162</a>     <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html">FMMatrix</a>&amp; <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a4">operator= </a>(<span class="keyword">const</span> ublas::matrix_expression&lt;E&gt;&amp; r)00163     {   <span class="comment">// Expression assignment; may be dependant on r</span>00164         MatrixBase::operator=(r);00165         <span class="keywordflow">return</span> *<span class="keyword">this</span>;00166     }<a name="l00167"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a5">00167</a>     <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html">FMMatrix</a>&amp; <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a4">operator= </a>(<span class="keyword">const</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html">FMMatrix</a>&amp; r)00168     {   <span class="comment">// Matrix assignment; independant</span>00169         assign (r);00170         <span class="keywordflow">return</span> *<span class="keyword">this</span>;00171     }00172 00173     <span class="comment">// Row,Column vector proxies</span><a name="l00174"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w1">00174</a>     <span class="keyword">typedef</span> ublas::matrix_row&lt;FMMatrix&gt; <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w1">Row</a>;<a name="l00175"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w2">00175</a>     <span class="keyword">typedef</span> <span class="keyword">const</span> ublas::matrix_row&lt;const FMMatrix&gt; <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w2">const_Row</a>;<a name="l00176"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w3">00176</a>     <span class="keyword">typedef</span> ublas::matrix_column&lt;FMMatrix&gt; <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w3">Column</a>;<a name="l00177"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w4">00177</a>     <span class="keyword">typedef</span> <span class="keyword">const</span> ublas::matrix_column&lt;const FMMatrix&gt; <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w4">const_Column</a>;00178 00179     <span class="comment">// Vector proxies from iterators - static members dependant on MatrixBase type</span>00180     <span class="comment">// ri() returns container associated with iterator. static_cast required as typeof(ri()) may not be typeof(MM)</span><a name="l00181"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#e0">00181</a>     <span class="keyword">static</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w1">Row</a> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#e0">rowi</a>(<span class="keyword">const</span> <span class="keyword">typename</span> MatrixBase::iterator1&amp; ri)00182     {00183         <span class="keywordflow">return</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w1">Row</a>(static_cast&lt;FMMatrix&amp;&gt;(ri()), ri.index1());00184     }<a name="l00185"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#e1">00185</a>     <span class="keyword">static</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w2">const_Row</a> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#e0">rowi</a>(<span class="keyword">const</span> <span class="keyword">typename</span> MatrixBase::const_iterator1&amp; ri)00186     {00187         <span class="keywordflow">return</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w2">const_Row</a>(static_cast&lt;const FMMatrix&amp;&gt;(ri()), ri.index1());00188     }<a name="l00189"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#e2">00189</a>     <span class="keyword">static</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w3">Column</a> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#e2">columni</a>(<span class="keyword">const</span> <span class="keyword">typename</span> MatrixBase::iterator2&amp; ci)00190     {00191         <span class="keywordflow">return</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w3">Column</a>(static_cast&lt;FMMatrix&amp;&gt;(ci()), ci.index2());00192     }<a name="l00193"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#e3">00193</a>     <span class="keyword">static</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w4">const_Column</a> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#e2">columni</a>(<span class="keyword">const</span> <span class="keyword">typename</span> MatrixBase::const_iterator2&amp; ci)00194     {00195         <span class="keywordflow">return</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#w4">const_Column</a>(static_cast&lt;const FMMatrix&amp;&gt;(ci()), ci.index2());00196     }00197 00198     <span class="comment">// Sub-range selection operators</span>00199     ublas::matrix_range&lt;const MatrixBase&gt;<a name="l00200"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a6">00200</a>     <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a6">sub_matrix</a>(size_t s1, size_t e1, size_t s2, size_t e2)<span class="keyword"> const</span>00201 <span class="keyword">    </span>{00202         <span class="keywordflow">return</span> ublas::matrix_range&lt;const MatrixBase&gt; (*<span class="keyword">this</span>, ublas::range(s1,e1), ublas::range(s2,e2));00203     }00204     ublas::matrix_range&lt;MatrixBase&gt;<a name="l00205"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a7">00205</a>     <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a6">sub_matrix</a>(size_t s1, size_t e1, size_t s2, size_t e2)00206     {00207         <span class="keywordflow">return</span> ublas::matrix_range&lt;MatrixBase&gt; (*<span class="keyword">this</span>, ublas::range(s1,e1), ublas::range(s2,e2));00208     }00209 00210     <span class="comment">// Requires boost_1.30.0 which has a generalised matrix_vector_slice</span>00211     ublas::matrix_vector_slice&lt;const MatrixBase&gt;<a name="l00212"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a8">00212</a>     <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a8">sub_column</a>(size_t s1, size_t e1, size_t s2) <span class="keyword">const</span> 00213     <span class="comment">// Column vector s2 with rows [s1,e1)</span>00214     {00215         <span class="keywordflow">return</span> ublas::matrix_vector_slice&lt;const MatrixBase&gt; (*<span class="keyword">this</span>, ublas::slice(s1,1,e1-s1), ublas::slice(s2,0,e1-s1));00216     }00217     ublas::matrix_vector_slice&lt;MatrixBase&gt;<a name="l00218"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a9">00218</a>     <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html#a8">sub_column</a>(size_t s1, size_t e1, size_t s2)00219     <span class="comment">// Column vector s2 with rows [s1,e1)</span>00220     {00221         <span class="keywordflow">return</span> ublas::matrix_vector_slice&lt;MatrixBase&gt; (*<span class="keyword">this</span>, ublas::slice(s1,1,e1-s1), ublas::slice(s2,0,e1-s1));00222     }00223 };00224 00225 00226 <span class="comment">/*</span>00227 <span class="comment"> * Helper template to allow member construction before base class</span>00228 <span class="comment"> *  Boost version does not work as it passes by value</span>00229 <span class="comment"> */</span>00230 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> MemberType&gt;<a name="l00231"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html">00231</a> <span class="keyword">class </span><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html">BaseFromMember</a>00232 {00233 <span class="keyword">protected</span>:<a name="l00234"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">00234</a>     MemberType <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">member</a>;<a name="l00235"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#b0">00235</a>     <span class="keyword">explicit</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#b0">BaseFromMember</a>() : <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">member</a>()00236     {}00237 00238     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T1&gt;<a name="l00239"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#b1">00239</a>     <span class="keyword">explicit</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#b0">BaseFromMember</a>( <span class="keyword">const</span> T1&amp; x1 ) : <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">member</a>( x1 )00240     {}00241 00242     <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T1, <span class="keyword">typename</span> T2&gt;<a name="l00243"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#b2">00243</a>     <span class="keyword">explicit</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#b0">BaseFromMember</a>( <span class="keyword">const</span> T1&amp; x1, <span class="keyword">const</span> T2&amp; x2 ) : <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">member</a>( x1, x2 )00244     {}00245 };00246 00247 00248 <span class="comment">/*</span>00249 <span class="comment"> * We require static type conversion between Symmetric matrices and equivilent row major matrices</span>00250 <span class="comment"> * Therefore we create symmetric matrix types, using a MatrixBase for storage</span>00251 <span class="comment"> * and wraps this in a symmetric_adaptor</span>00252 <span class="comment"> */</span>00253 <span class="keyword">template</span> &lt;<span class="keyword">class</span> MatrixBase&gt;<a name="l00254"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html">00254</a> <span class="keyword">class </span><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html">SymMatrixWrapper</a> :00255     <span class="keyword">private</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html">BaseFromMember</a>&lt;MatrixBase&gt;,  <span class="comment">// allow construction of MatrixBase member before symmetric_adaptor</span>00256     <span class="keyword">public</span> ublas::symmetric_adaptor&lt;MatrixBase, ublas::upper&gt;00257 {00258     <span class="keyword">typedef</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html">BaseFromMember&lt;MatrixBase&gt;</a> matrix_type;00259     <span class="keyword">typedef</span> ublas::symmetric_adaptor&lt;MatrixBase, ublas::upper&gt; symadaptor_type;00260 <span class="keyword">public</span>:<a name="l00261"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a0">00261</a>     <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a0">SymMatrixWrapper</a> () : matrix_type(), symadaptor_type(this-&gt;<a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">member</a>)00262     {}<a name="l00263"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a1">00263</a>     <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a0">SymMatrixWrapper</a> (size_t size1, size_t size2) : matrix_type(size1,size2), symadaptor_type(this-&gt;<a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">member</a>)00264     {}  <span class="comment">// Normal sized constructor</span><a name="l00265"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a2">00265</a>     <span class="keyword">explicit</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a0">SymMatrixWrapper</a> (<span class="keyword">const</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html">SymMatrixWrapper</a>&amp; r) : matrix_type(reinterpret_cast&lt;const MatrixBase&amp;&gt;(r)), symadaptor_type(this-&gt;<a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">member</a>)00266     {}  <span class="comment">// Explict copy construction referencing the copy reinterpreted as a MatrixBase</span>00267     <span class="keyword">template</span> &lt;<span class="keyword">class</span> E&gt;<a name="l00268"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a3">00268</a>     <span class="keyword">explicit</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a0">SymMatrixWrapper</a> (<span class="keyword">const</span> ublas::matrix_expression&lt;E&gt;&amp; e) : matrix_type(e), symadaptor_type(this-&gt;<a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">member</a>)00269     {}  <span class="comment">// Explict matrix_expression conversion constructor</span>00270 00271     <span class="keyword">template</span> &lt;<span class="keyword">class</span> E&gt;<a name="l00272"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a4">00272</a>     <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html">SymMatrixWrapper</a>&amp; <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a4">operator=</a>(<span class="keyword">const</span> ublas::matrix_expression&lt;E&gt;&amp; r)00273     {00274         symadaptor_type::operator=(r);00275         <span class="keywordflow">return</span> *<span class="keyword">this</span>;00276     }00277 00278     <span class="comment">// Conversions straight to a FMMatrix, equivilent to a RowMatrix types</span><a name="l00279"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a5">00279</a>     <span class="keyword">const</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html">FMMatrix&lt;MatrixBase&gt;</a>&amp; <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a5">asRowMatrix</a>()<span class="keyword"> const</span>00280 <span class="keyword">    </span>{00281         <span class="keywordflow">return</span> static_cast&lt;const FMMatrix&lt;MatrixBase&gt;&amp; &gt;(this-&gt;<a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">member</a>);00282     }<a name="l00283"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a6">00283</a>     <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html">FMMatrix&lt;MatrixBase&gt;</a>&amp; <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a5">asRowMatrix</a>()00284     {00285         <span class="keywordflow">return</span> static_cast&lt;FMMatrix&lt;MatrixBase&gt;&amp; &gt;(this-&gt;<a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">member</a>);00286     }00287 00288     <span class="comment">// Matrix storage members</span><a name="l00289"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a7">00289</a>     <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a7">clear</a>()00290     {   this-&gt;<a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">member</a>.clear();00291     }<a name="l00292"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a8">00292</a>     <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1SymMatrixWrapper.html#a8">resize</a>(size_t nsize1, size_t nsize2)00293     {00294         this-&gt;<a class="code" href="classBayesian__filter__matrix_1_1detail_1_1BaseFromMember.html#p0">member</a>.resize(nsize1, nsize2);00295     }00296 };00297 00298 }<span class="comment">//namespace detail</span>00299 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -