📄 ublasmatrix_8hpp-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Bayes++ Bayesian Filtering Classes: uBLASmatrix.hpp Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.2 --><div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Compound List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Compound Members</a> | <a class="qindex" href="globals.html">File Members</a></div><h1>uBLASmatrix.hpp</h1><a href="uBLASmatrix_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> * Bayes++ the Bayesian Filtering Library</span>00003 <span class="comment"> * Copyright (c) 2002 Michael Stevens</span>00004 <span class="comment"> * See accompanying Bayes++.htm for terms and conditions of use.</span>00005 <span class="comment"> *</span>00006 <span class="comment"> * $Header: /cvsroot/bayesclasses/Bayes++/BayesFilter/uBLASmatrix.hpp,v 1.24.2.1 2004/02/11 21:06:42 mistevens Exp $</span>00007 <span class="comment"> * $NoKeywords: $</span>00008 <span class="comment"> */</span>00009 00010 <span class="comment">/*</span>00011 <span class="comment"> * Common type independant uBlas interface</span>00012 <span class="comment"> * Should be include after base types have been defined</span>00013 <span class="comment"> *</span>00014 <span class="comment"> * Everything in namespace Bayes_filter_matrix is intended to support the matrix storage</span>00015 <span class="comment"> * and algebra requirements of the library. Therefore the interfaces and implementation is</span>00016 <span class="comment"> * not intended to be stable. Nor is this a general purpose adapator for uBLAS</span>00017 <span class="comment"> *</span>00018 <span class="comment"> * Note on row_major matrices</span>00019 <span class="comment"> * The implementation uses row major extensively. The computation of symetric products P*P' is </span>00020 <span class="comment"> * most efficient with row operations. These products are used extensively so the default</span>00021 <span class="comment"> * is to use row_major matrices</span>00022 <span class="comment"> */</span>00023 00024 <span class="comment">/* Filter Matrix Namespace */</span>00025 <span class="keyword">namespace </span>Bayesian_filter_matrix00026 {00027 <span class="comment">// Allow use a few functions in own namespace (particular useful for compilers with Konig lookup)</span>00028 <span class="keyword">using</span> ublas::row;00029 <span class="keyword">using</span> ublas::column;00030 <span class="keyword">using</span> ublas::trans;00031 <span class="keyword">using</span> ublas::prod; <span class="comment">// These do not apply to the templated prod<temp> funtions</span>00032 <span class="keyword">using</span> ublas::inner_prod;00033 <span class="keyword">using</span> ublas::outer_prod;00034 <a name="l00035"></a><a class="code" href="namespaceBayesian__filter__matrix.html#a70">00035</a> <span class="keyword">enum</span> <a class="code" href="namespaceBayesian__filter__matrix.html#a70">EmptyTag</a> {<a class="code" href="namespaceBayesian__filter__matrix.html#a70a17">Empty</a>}; <span class="comment">// Tag type used for empty matrix constructor</span>00036 00037 <span class="preprocessor">#if (BOOST_VERSION >= 103100)</span>00038 <span class="preprocessor"></span><span class="keyword">using</span> ublas::noalias;00039 <span class="preprocessor">#else</span>00040 <span class="preprocessor"></span><span class="keyword">namespace </span>detail00041 {00042 <span class="comment">// Assignment proxy.</span>00043 <span class="comment">// Provides temporary free assigment when LHS has no alias on RHS</span>00044 <span class="keyword">template</span><<span class="keyword">class</span> C><a name="l00045"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html">00045</a> <span class="keyword">class </span><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html">noalias_proxy</a> {00046 <span class="keyword">public</span>:00047 BOOST_UBLAS_INLINE<a name="l00048"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html#a0">00048</a> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html#a0">noalias_proxy</a> (C& lval):00049 lval_ (lval) {}00050 00051 <span class="keyword">template</span> <<span class="keyword">class</span> E>00052 BOOST_UBLAS_INLINE<a name="l00053"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html#a1">00053</a> <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html#a1">operator= </a>(<span class="keyword">const</span> E& e) {00054 lval_.assign (e);00055 }00056 00057 <span class="keyword">template</span> <<span class="keyword">class</span> E>00058 BOOST_UBLAS_INLINE<a name="l00059"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html#a2">00059</a> <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html#a2">operator+= </a>(<span class="keyword">const</span> E& e) {00060 lval_.plus_assign (e);00061 }00062 00063 <span class="keyword">template</span> <<span class="keyword">class</span> E>00064 BOOST_UBLAS_INLINE<a name="l00065"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html#a3">00065</a> <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html#a3">operator-= </a>(<span class="keyword">const</span> E& e) {00066 lval_.minus_assign (e);00067 }00068 00069 <span class="keyword">private</span>: <span class="comment">// nonassignable</span>00070 <span class="keywordtype">void</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html#a1">operator=</a>( <span class="keyword">const</span> noalias_proxy& );00071 <span class="keyword">private</span>:00072 C& lval_;00073 };00074 00075 }<span class="comment">//namespace detail</span>00076 00077 <span class="comment">// Improve syntax of effcient assignment where no aliases of LHS appear on the RHS</span>00078 <span class="comment">// noalias(lhs) = rhs_expression</span>00079 <span class="keyword">template</span> <<span class="keyword">class</span> E>00080 BOOST_UBLAS_INLINE<a name="l00081"></a><a class="code" href="namespaceBayesian__filter__matrix.html#a49">00081</a> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html">detail::noalias_proxy<E></a> <a class="code" href="namespaceBayesian__filter__matrix.html#a49">noalias</a> (ublas::matrix_expression<E>& lvalue) {00082 <span class="keywordflow">return</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html">detail::noalias_proxy<E></a> (lvalue() );00083 }00084 <span class="keyword">template</span> <<span class="keyword">class</span> E>00085 BOOST_UBLAS_INLINE<a name="l00086"></a><a class="code" href="namespaceBayesian__filter__matrix.html#a50">00086</a> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html">detail::noalias_proxy<E></a> <a class="code" href="namespaceBayesian__filter__matrix.html#a49">noalias</a> (ublas::vector_expression<E>& lvalue) {00087 <span class="keywordflow">return</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1noalias__proxy.html">detail::noalias_proxy<E></a> (lvalue() );00088 }00089 00090 <span class="preprocessor">#endif</span>00091 <span class="preprocessor"></span>00092 00093 <span class="keyword">namespace </span>detail <span class="comment">// Lots of implementation detail</span>00094 {00095 00096 <span class="comment">/*</span>00097 <span class="comment"> * Filter Vec type</span>00098 <span class="comment"> */</span>00099 <span class="keyword">template</span> <<span class="keyword">class</span> VecBase><a name="l00100"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html">00100</a> <span class="keyword">class </span><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html">FMVec</a> : <span class="keyword">public</span> VecBase00101 {00102 <span class="keyword">public</span>:00103 <span class="comment">// No Default Constructor. Empty creation is very error prone</span><a name="l00104"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a0">00104</a> <span class="keyword">explicit</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a0">FMVec</a>(EmptyTag) : VecBase()00105 {} <span class="comment">// Empty constructor</span><a name="l00106"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a1">00106</a> <span class="keyword">explicit</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a0">FMVec</a>(size_t size) : VecBase(size)00107 {} <span class="comment">// Normal sized constructor</span><a name="l00108"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a2">00108</a> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a0">FMVec</a>(<span class="keyword">const</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html">FMVec</a>& c) : VecBase(static_cast<const VecBase&>(c))00109 {} <span class="comment">// Copy constructor</span>00110 <span class="keyword">template</span> <<span class="keyword">class</span> E><a name="l00111"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a3">00111</a> <span class="keyword">explicit</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a0">FMVec</a>(<span class="keyword">const</span> ublas::vector_expression<E>& e) : VecBase(e)00112 {} <span class="comment">// vector_expression copy constructor</span>00113 <span class="keyword">template</span> <<span class="keyword">class</span> E><a name="l00114"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a4">00114</a> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a0">FMVec</a>(<span class="keyword">const</span> ublas::matrix_column<E>& e) : VecBase(e)00115 {} <span class="comment">// conversion copy constructor, hides the implict copy required for matrix column access</span>00116 00117 <span class="keyword">template</span> <<span class="keyword">class</span> E><a name="l00118"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a5">00118</a> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html">FMVec</a>& <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a5">operator= </a>(<span class="keyword">const</span> ublas::vector_expression<E>& r)00119 { <span class="comment">// Expression assignment; may be dependant on r</span>00120 VecBase::operator=(r);00121 <span class="keywordflow">return</span> *<span class="keyword">this</span>;00122 }<a name="l00123"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a6">00123</a> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html">FMVec</a>& <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a5">operator= </a>(<span class="keyword">const</span> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html">FMVec</a>& r)00124 { <span class="comment">// Vector assignment; independant</span>00125 assign(r);00126 <span class="keywordflow">return</span> *<span class="keyword">this</span>;00127 }00128 00129 <span class="comment">// Sub-range selection operators</span><a name="l00130"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a7">00130</a> <span class="keyword">const</span> ublas::vector_range<const VecBase> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a7">sub_range</a>(size_t b, size_t e)<span class="keyword"> const</span>00131 <span class="keyword"> </span>{00132 <span class="keywordflow">return</span> ublas::vector_range<const VecBase>(*<span class="keyword">this</span>, ublas::range(b,e));00133 }<a name="l00134"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a8">00134</a> ublas::vector_range<VecBase> <a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMVec.html#a7">sub_range</a>(size_t b, size_t e)00135 {00136 <span class="keywordflow">return</span> ublas::vector_range<VecBase>(*<span class="keyword">this</span>, ublas::range(b,e));00137 }00138 };00139 00140 00141 <span class="comment">/*</span>00142 <span class="comment"> * Filter Matrix class template. Augmentation for uBlas MatrixBase</span>00143 <span class="comment"> */</span>00144 <span class="keyword">template</span> <<span class="keyword">class</span> MatrixBase><a name="l00145"></a><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html">00145</a> <span class="keyword">class </span><a class="code" href="classBayesian__filter__matrix_1_1detail_1_1FMMatrix.html">FMMatrix</a> : <span class="keyword">public</span> MatrixBase00146 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -