68 | | <a name="l00091"></a>00091 ivec <a class="code" href="classbdm_1_1RV.html#1367055b2608ad9d50d01a2da6cec869" title="Find indexes of self in another rv,.">findself</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ) <span class="keyword">const</span>; |
69 | | <a name="l00093"></a>00093 <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1RV.html#3bb011af88ae98f5c97955bb2c95cfee" title="Compare if rv2 is identical to this RV.">equal</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ) <span class="keyword">const</span>; |
70 | | <a name="l00095"></a>00095 <span class="keywordtype">bool</span> <span class="keyword">add</span> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ); |
71 | | <a name="l00097"></a>00097 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1RV.html#aec44dabdf0a6d90fbae95e1356eda39" title="Subtract another variable from the current one.">subt</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ) <span class="keyword">const</span>; |
72 | | <a name="l00099"></a>00099 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1RV.html#c0c04ab99ded62e1e05bcefb151ebeb9" title="Select only variables at indeces ind.">subselect</a> ( <span class="keyword">const</span> ivec &ind ) <span class="keyword">const</span>; |
73 | | <a name="l00101"></a>00101 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1RV.html#6f3daf0f857fff53a1c0a445fe160966" title="Select only variables at indeces ind.">operator() </a>( <span class="keyword">const</span> ivec &ind ) <span class="keyword">const</span>; |
74 | | <a name="l00103"></a>00103 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#bd77cb0899f7fba1d0e34396137b7f1f" title="Shift time shifted by delta.">t</a> ( <span class="keywordtype">int</span> delta ); |
75 | | <a name="l00105"></a>00105 <a class="code" href="classbdm_1_1str.html" title="Structure of RV (used internally), i.e. expanded RVs.">str</a> <a class="code" href="classbdm_1_1RV.html#8bdd7f4072749c7cc864b78a418ca388" title="generate str from rv, by expanding sizes">tostr</a>() <span class="keyword">const</span>; |
76 | | <a name="l00108"></a>00108 ivec <a class="code" href="classbdm_1_1RV.html#cbebdb5e0d30101a6eb63550ef701c55">dataind</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &crv ) <span class="keyword">const</span>; |
77 | | <a name="l00111"></a>00111 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#cbebdb5e0d30101a6eb63550ef701c55">dataind</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv2, ivec &selfi, ivec &rv2i ) <span class="keyword">const</span>; |
78 | | <a name="l00113"></a><a class="code" href="classbdm_1_1RV.html#8bfda300b769a05598c55cb94fe61f52">00113</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#8bfda300b769a05598c55cb94fe61f52" title="Minimum time-offset.">mint</a> () {<span class="keywordflow">return</span> min ( <a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> );}; |
79 | | <a name="l00114"></a>00114 |
80 | | <a name="l00116"></a><a class="code" href="classbdm_1_1RV.html#ae0c6e729851a43c82a5b1c199474ef2">00116</a> Array<std::string>& <a class="code" href="classbdm_1_1RV.html#ae0c6e729851a43c82a5b1c199474ef2" title="access function">_names</a>() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#9a87c46918c3c0db0bdca854a48a44aa" title="Array of names.">names</a>;}; |
81 | | <a name="l00117"></a>00117 |
82 | | <a name="l00119"></a><a class="code" href="classbdm_1_1RV.html#172390b8525ef5aac684228241fff7b5">00119</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#172390b8525ef5aac684228241fff7b5" title="access function">id</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( at );}; |
83 | | <a name="l00121"></a><a class="code" href="classbdm_1_1RV.html#8e64d02005a02aef72f214286977d8de">00121</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#8e64d02005a02aef72f214286977d8de" title="access function">size</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#0112d25045f6f8fabdc9e821029928ee" title="Vector of sizes.">sizes</a> ( at );}; |
84 | | <a name="l00123"></a><a class="code" href="classbdm_1_1RV.html#aff4de8185750b506492623847520518">00123</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#aff4de8185750b506492623847520518" title="access function">time</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> ( at );}; |
85 | | <a name="l00125"></a><a class="code" href="classbdm_1_1RV.html#d05af87595cfb7fa2e0fadeae5597fa8">00125</a> std::string <a class="code" href="classbdm_1_1RV.html#d05af87595cfb7fa2e0fadeae5597fa8" title="access function">name</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#9a87c46918c3c0db0bdca854a48a44aa" title="Array of names.">names</a> ( at );}; |
86 | | <a name="l00126"></a>00126 |
87 | | <a name="l00128"></a><a class="code" href="classbdm_1_1RV.html#602cea0aecebc5146d81657df5127543">00128</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#602cea0aecebc5146d81657df5127543" title="access function">set_id</a> ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> id0 ) {<a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( at ) =id0;}; |
88 | | <a name="l00130"></a><a class="code" href="classbdm_1_1RV.html#0b2c9e73ff66847c3644ebc3eb559a03">00130</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#0b2c9e73ff66847c3644ebc3eb559a03" title="access function">set_size</a> ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> size0 ) {<a class="code" href="classbdm_1_1RV.html#0112d25045f6f8fabdc9e821029928ee" title="Vector of sizes.">sizes</a> ( at ) =size0; <a class="code" href="classbdm_1_1RV.html#38203096d950671def44de8cf1c6bb2e" title="size = sum of sizes">tsize</a>=sum ( <a class="code" href="classbdm_1_1RV.html#0112d25045f6f8fabdc9e821029928ee" title="Vector of sizes.">sizes</a> );}; |
89 | | <a name="l00132"></a><a class="code" href="classbdm_1_1RV.html#fb2892d12dc978549e9491aed327dfd4">00132</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#fb2892d12dc978549e9491aed327dfd4" title="access function">set_time</a> ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> time0 ) {<a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> ( at ) =time0;}; |
90 | | <a name="l00133"></a>00133 |
91 | | <a name="l00135"></a>00135 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#176e9c0c35b51fee0ad8813a39883a63" title="Assign unused ids to this rv.">newids</a>(); |
92 | | <a name="l00136"></a>00136 }; |
93 | | <a name="l00137"></a>00137 |
94 | | <a name="l00139"></a>00139 RV <a class="code" href="namespacebdm.html#b9016687c0e874ca5cdcf75ae28811aa" title="Concat two random variables.">concat</a> ( <span class="keyword">const</span> RV &rv1, <span class="keyword">const</span> RV &rv2 ); |
95 | | <a name="l00140"></a>00140 |
96 | | <a name="l00142"></a>00142 <span class="keyword">extern</span> RV <a class="code" href="namespacebdm.html#bdd4760f14ec7d6fea083aa2170f6236" title="Default empty RV that can be used as default argument.">RV0</a>; |
97 | | <a name="l00143"></a>00143 |
| 67 | <a name="l00090"></a>00090 <span class="comment">//TODO why not inline and later??</span> |
| 68 | <a name="l00091"></a>00091 |
| 69 | <a name="l00093"></a>00093 ivec <a class="code" href="classbdm_1_1RV.html#1367055b2608ad9d50d01a2da6cec869" title="Find indexes of self in another rv,.">findself</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 70 | <a name="l00095"></a>00095 <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1RV.html#3bb011af88ae98f5c97955bb2c95cfee" title="Compare if rv2 is identical to this RV.">equal</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 71 | <a name="l00097"></a>00097 <span class="keywordtype">bool</span> <span class="keyword">add</span> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ); |
| 72 | <a name="l00099"></a>00099 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1RV.html#aec44dabdf0a6d90fbae95e1356eda39" title="Subtract another variable from the current one.">subt</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 73 | <a name="l00101"></a>00101 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1RV.html#c0c04ab99ded62e1e05bcefb151ebeb9" title="Select only variables at indeces ind.">subselect</a> ( <span class="keyword">const</span> ivec &ind ) <span class="keyword">const</span>; |
| 74 | <a name="l00103"></a>00103 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1RV.html#6f3daf0f857fff53a1c0a445fe160966" title="Select only variables at indeces ind.">operator() </a>( <span class="keyword">const</span> ivec &ind ) <span class="keyword">const</span>; |
| 75 | <a name="l00105"></a>00105 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#bd77cb0899f7fba1d0e34396137b7f1f" title="Shift time shifted by delta.">t</a> ( <span class="keywordtype">int</span> delta ); |
| 76 | <a name="l00107"></a>00107 <a class="code" href="classbdm_1_1str.html" title="Structure of RV (used internally), i.e. expanded RVs.">str</a> <a class="code" href="classbdm_1_1RV.html#8bdd7f4072749c7cc864b78a418ca388" title="generate str from rv, by expanding sizes">tostr</a>() <span class="keyword">const</span>; |
| 77 | <a name="l00110"></a>00110 ivec <a class="code" href="classbdm_1_1RV.html#cbebdb5e0d30101a6eb63550ef701c55">dataind</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &crv ) <span class="keyword">const</span>; |
| 78 | <a name="l00113"></a>00113 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#cbebdb5e0d30101a6eb63550ef701c55">dataind</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv2, ivec &selfi, ivec &rv2i ) <span class="keyword">const</span>; |
| 79 | <a name="l00115"></a><a class="code" href="classbdm_1_1RV.html#9a5c5aeeaf39299d07763377b05a8241">00115</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#9a5c5aeeaf39299d07763377b05a8241" title="Minimum time-offset.">mint</a> ()<span class="keyword"> const </span>{<span class="keywordflow">return</span> min ( <a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> );}; |
| 80 | <a name="l00116"></a>00116 |
| 81 | <a name="l00118"></a><a class="code" href="classbdm_1_1RV.html#ae0c6e729851a43c82a5b1c199474ef2">00118</a> Array<std::string>& <a class="code" href="classbdm_1_1RV.html#ae0c6e729851a43c82a5b1c199474ef2" title="access function">_names</a>() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#9a87c46918c3c0db0bdca854a48a44aa" title="Array of names.">names</a>;}; |
| 82 | <a name="l00119"></a>00119 |
| 83 | <a name="l00121"></a><a class="code" href="classbdm_1_1RV.html#172390b8525ef5aac684228241fff7b5">00121</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#172390b8525ef5aac684228241fff7b5" title="access function">id</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( at );}; |
| 84 | <a name="l00123"></a><a class="code" href="classbdm_1_1RV.html#8e64d02005a02aef72f214286977d8de">00123</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#8e64d02005a02aef72f214286977d8de" title="access function">size</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#0112d25045f6f8fabdc9e821029928ee" title="Vector of sizes.">sizes</a> ( at );}; |
| 85 | <a name="l00125"></a><a class="code" href="classbdm_1_1RV.html#aff4de8185750b506492623847520518">00125</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#aff4de8185750b506492623847520518" title="access function">time</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> ( at );}; |
| 86 | <a name="l00127"></a><a class="code" href="classbdm_1_1RV.html#d05af87595cfb7fa2e0fadeae5597fa8">00127</a> std::string <a class="code" href="classbdm_1_1RV.html#d05af87595cfb7fa2e0fadeae5597fa8" title="access function">name</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#9a87c46918c3c0db0bdca854a48a44aa" title="Array of names.">names</a> ( at );}; |
| 87 | <a name="l00128"></a>00128 |
| 88 | <a name="l00130"></a><a class="code" href="classbdm_1_1RV.html#602cea0aecebc5146d81657df5127543">00130</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#602cea0aecebc5146d81657df5127543" title="access function">set_id</a> ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> id0 ) {<a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( at ) =id0;}; |
| 89 | <a name="l00132"></a><a class="code" href="classbdm_1_1RV.html#0b2c9e73ff66847c3644ebc3eb559a03">00132</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#0b2c9e73ff66847c3644ebc3eb559a03" title="access function">set_size</a> ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> size0 ) {<a class="code" href="classbdm_1_1RV.html#0112d25045f6f8fabdc9e821029928ee" title="Vector of sizes.">sizes</a> ( at ) =size0; <a class="code" href="classbdm_1_1RV.html#38203096d950671def44de8cf1c6bb2e" title="size = sum of sizes">tsize</a>=sum ( <a class="code" href="classbdm_1_1RV.html#0112d25045f6f8fabdc9e821029928ee" title="Vector of sizes.">sizes</a> );}; |
| 90 | <a name="l00134"></a><a class="code" href="classbdm_1_1RV.html#fb2892d12dc978549e9491aed327dfd4">00134</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#fb2892d12dc978549e9491aed327dfd4" title="access function">set_time</a> ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> time0 ) {<a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> ( at ) =time0;}; |
| 91 | <a name="l00135"></a>00135 |
| 92 | <a name="l00137"></a>00137 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#176e9c0c35b51fee0ad8813a39883a63" title="Assign unused ids to this rv.">newids</a>(); |
| 93 | <a name="l00138"></a>00138 }; |
| 94 | <a name="l00139"></a>00139 |
| 95 | <a name="l00141"></a>00141 RV <a class="code" href="namespacebdm.html#b9016687c0e874ca5cdcf75ae28811aa" title="Concat two random variables.">concat</a> ( <span class="keyword">const</span> RV &rv1, <span class="keyword">const</span> RV &rv2 ); |
| 96 | <a name="l00142"></a>00142 |
| 97 | <a name="l00144"></a>00144 <span class="keyword">extern</span> RV <a class="code" href="namespacebdm.html#bdd4760f14ec7d6fea083aa2170f6236" title="Default empty RV that can be used as default argument.">RV0</a>; |
118 | | <a name="l00172"></a><a class="code" href="classbdm_1_1epdf.html">00172</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> :<span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
119 | | <a name="l00173"></a>00173 <span class="keyword">protected</span>: |
120 | | <a name="l00175"></a><a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8">00175</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a>; |
121 | | <a name="l00176"></a>00176 <span class="keyword">public</span>: |
122 | | <a name="l00178"></a><a class="code" href="classbdm_1_1epdf.html#992f3de956fb3439c62225156aafb6f6">00178</a> <a class="code" href="classbdm_1_1epdf.html#992f3de956fb3439c62225156aafb6f6" title="default constructor">epdf</a>() :<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a> ( ) {}; |
123 | | <a name="l00179"></a>00179 |
124 | | <a name="l00181"></a><a class="code" href="classbdm_1_1epdf.html#fdfed7aa18f2870951888b1dde977415">00181</a> <a class="code" href="classbdm_1_1epdf.html#992f3de956fb3439c62225156aafb6f6" title="default constructor">epdf</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv0 ) :<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a> ( rv0 ) {}; |
125 | | <a name="l00182"></a>00182 |
126 | | <a name="l00183"></a>00183 <span class="comment">// //! Returns the required moment of the epdf</span> |
127 | | <a name="l00184"></a>00184 <span class="comment">// virtual vec moment ( const int order = 1 );</span> |
128 | | <a name="l00185"></a>00185 |
129 | | <a name="l00187"></a>00187 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#09721eb148bc49d6ec2f1956039f3a10" title="Returns a sample, from density .">sample</a> () <span class="keyword">const</span> =0; |
130 | | <a name="l00189"></a>00189 <span class="keyword">virtual</span> mat <a class="code" href="classbdm_1_1epdf.html#b4cf45fd83cc7573ede9fe1215256058" title="Returns N samples from density .">sample_m</a> ( <span class="keywordtype">int</span> N ) <span class="keyword">const</span>; |
131 | | <a name="l00190"></a>00190 |
132 | | <a name="l00192"></a>00192 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1epdf.html#a8e39e2ff5e5cf5471bc159530d3b2d3" title="Compute log-probability of argument val.">evallog</a> ( <span class="keyword">const</span> vec &val ) <span class="keyword">const</span> =0; |
133 | | <a name="l00193"></a>00193 |
134 | | <a name="l00195"></a><a class="code" href="classbdm_1_1epdf.html#34956d4dd3176eeb5937cf48a1546b62">00195</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#34956d4dd3176eeb5937cf48a1546b62" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( <span class="keyword">const</span> mat &Val )<span class="keyword"> const </span>{ |
135 | | <a name="l00196"></a>00196 vec x ( Val.cols() ); |
136 | | <a name="l00197"></a>00197 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<Val.cols();i++ ) {x ( i ) =<a class="code" href="classbdm_1_1epdf.html#a8e39e2ff5e5cf5471bc159530d3b2d3" title="Compute log-probability of argument val.">evallog</a> ( Val.get_col ( i ) ) ;} |
137 | | <a name="l00198"></a>00198 <span class="keywordflow">return</span> x; |
138 | | <a name="l00199"></a>00199 } |
139 | | <a name="l00201"></a><a class="code" href="classbdm_1_1epdf.html#e584eac5579c1b6384947ecf66166c77">00201</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>* <a class="code" href="classbdm_1_1epdf.html#e584eac5579c1b6384947ecf66166c77" title="Return conditional density on the given RV, the remaining rvs will be in conditioning...">condition</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a> )<span class="keyword"> const </span>{it_warning ( <span class="stringliteral">"Not implemented"</span> ); <span class="keywordflow">return</span> NULL;} |
140 | | <a name="l00203"></a><a class="code" href="classbdm_1_1epdf.html#3fb2ece54f720b62ad325e61214fa0a1">00203</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1epdf.html#3fb2ece54f720b62ad325e61214fa0a1" title="Return marginal density on the given RV, the remainig rvs are intergrated out.">marginal</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a> )<span class="keyword"> const </span>{it_warning ( <span class="stringliteral">"Not implemented"</span> ); <span class="keywordflow">return</span> NULL;} |
141 | | <a name="l00204"></a>00204 |
142 | | <a name="l00206"></a>00206 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#565300f603ca00c989e16389d9eb42f5" title="return expected value">mean</a>() <span class="keyword">const</span> =0; |
143 | | <a name="l00207"></a>00207 |
144 | | <a name="l00209"></a>00209 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#45c2b64faa4bf526799e4154a6ec6097" title="return expected variance (not covariance!)">variance</a>() <span class="keyword">const</span> = 0; |
145 | | <a name="l00210"></a>00210 |
146 | | <a name="l00212"></a><a class="code" href="classbdm_1_1epdf.html#a4fa8637e7307cb051c400c2ce0ca0c8">00212</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1epdf.html#a4fa8637e7307cb051c400c2ce0ca0c8" title="Destructor for future use;.">~epdf</a>() {}; |
147 | | <a name="l00214"></a><a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21">00214</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="access function, possibly dangerous!">_rv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a>;} |
148 | | <a name="l00216"></a><a class="code" href="classbdm_1_1epdf.html#62e88cbce0ce77a8692f5e15d76e805f">00216</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1epdf.html#62e88cbce0ce77a8692f5e15d76e805f" title="modifier function - useful when copying epdfs">_renewrv</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &in_rv ) {<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a>=in_rv;} |
149 | | <a name="l00218"></a>00218 }; |
150 | | <a name="l00219"></a>00219 |
151 | | <a name="l00220"></a>00220 |
152 | | <a name="l00222"></a>00222 <span class="comment">//TODO Samplecond can be generalized</span> |
153 | | <a name="l00223"></a>00223 |
154 | | <a name="l00224"></a><a class="code" href="classbdm_1_1mpdf.html">00224</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
155 | | <a name="l00225"></a>00225 <span class="keyword">protected</span>: |
156 | | <a name="l00227"></a><a class="code" href="classbdm_1_1mpdf.html#9bcfb45435d30983f436d41c298cbb51">00227</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1mpdf.html#9bcfb45435d30983f436d41c298cbb51" title="modeled random variable">rv</a>; |
157 | | <a name="l00229"></a><a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288">00229</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>; |
158 | | <a name="l00231"></a><a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0">00231</a> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>; |
159 | | <a name="l00232"></a>00232 <span class="keyword">public</span>: |
160 | | <a name="l00233"></a>00233 |
161 | | <a name="l00235"></a><a class="code" href="classbdm_1_1mpdf.html#e4848a428d8ef0549c6e4a9ed386d9f2">00235</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1mpdf.html#e4848a428d8ef0549c6e4a9ed386d9f2" title="Returns a sample from the density conditioned on cond, .">samplecond</a> ( <span class="keyword">const</span> vec &cond, <span class="keywordtype">double</span> &ll ) { |
162 | | <a name="l00236"></a>00236 this-><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond ); |
163 | | <a name="l00237"></a>00237 vec temp= <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-><a class="code" href="classbdm_1_1epdf.html#09721eb148bc49d6ec2f1956039f3a10" title="Returns a sample, from density .">sample</a>(); |
164 | | <a name="l00238"></a>00238 ll=<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-><a class="code" href="classbdm_1_1epdf.html#a8e39e2ff5e5cf5471bc159530d3b2d3" title="Compute log-probability of argument val.">evallog</a> ( temp );<span class="keywordflow">return</span> temp; |
165 | | <a name="l00239"></a>00239 }; |
166 | | <a name="l00241"></a><a class="code" href="classbdm_1_1mpdf.html#ee26963a637b2ea1fb1933652981e652">00241</a> <span class="keyword">virtual</span> mat <a class="code" href="classbdm_1_1mpdf.html#ee26963a637b2ea1fb1933652981e652" title="Returns.">samplecond_m</a> ( <span class="keyword">const</span> vec &cond, vec &ll, <span class="keywordtype">int</span> N ) { |
167 | | <a name="l00242"></a>00242 this-><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond ); |
168 | | <a name="l00243"></a>00243 mat temp ( <a class="code" href="classbdm_1_1mpdf.html#9bcfb45435d30983f436d41c298cbb51" title="modeled random variable">rv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>(),N ); vec smp ( <a class="code" href="classbdm_1_1mpdf.html#9bcfb45435d30983f436d41c298cbb51" title="modeled random variable">rv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>() ); |
169 | | <a name="l00244"></a>00244 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<N;i++ ) {smp=<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-><a class="code" href="classbdm_1_1epdf.html#09721eb148bc49d6ec2f1956039f3a10" title="Returns a sample, from density .">sample</a>() ;temp.set_col ( i, smp );ll ( i ) =<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-><a class="code" href="classbdm_1_1epdf.html#a8e39e2ff5e5cf5471bc159530d3b2d3" title="Compute log-probability of argument val.">evallog</a> ( smp );} |
170 | | <a name="l00245"></a>00245 <span class="keywordflow">return</span> temp; |
171 | | <a name="l00246"></a>00246 }; |
172 | | <a name="l00248"></a><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530">00248</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &cond ) {it_error ( <span class="stringliteral">"Not implemented"</span> );}; |
173 | | <a name="l00249"></a>00249 |
174 | | <a name="l00251"></a><a class="code" href="classbdm_1_1mpdf.html#6336a8a72462e2a56a3989a220f18b1b">00251</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mpdf.html#6336a8a72462e2a56a3989a220f18b1b" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a> ( <span class="keyword">const</span> vec &dt, <span class="keyword">const</span> vec &cond ) { |
175 | | <a name="l00252"></a>00252 <span class="keywordtype">double</span> tmp; this-><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond );tmp = <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-><a class="code" href="classbdm_1_1epdf.html#a8e39e2ff5e5cf5471bc159530d3b2d3" title="Compute log-probability of argument val.">evallog</a> ( dt ); it_assert_debug ( std::isfinite ( tmp ),<span class="stringliteral">"Infinite value"</span> ); <span class="keywordflow">return</span> tmp; |
176 | | <a name="l00253"></a>00253 }; |
177 | | <a name="l00254"></a>00254 |
178 | | <a name="l00256"></a><a class="code" href="classbdm_1_1mpdf.html#0b0ed1ed663071bb7cf4a1349eb94fcb">00256</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1mpdf.html#0b0ed1ed663071bb7cf4a1349eb94fcb" title="Matrix version of evallogcond.">evallogcond_m</a> ( <span class="keyword">const</span> mat &Dt, <span class="keyword">const</span> vec &cond ) {this-><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond );<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-><a class="code" href="classbdm_1_1epdf.html#34956d4dd3176eeb5937cf48a1546b62" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( Dt );}; |
179 | | <a name="l00257"></a>00257 |
180 | | <a name="l00259"></a><a class="code" href="classbdm_1_1mpdf.html#2d83cf2a5ba40cab11dfe158ced9ee9a">00259</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1mpdf.html#2d83cf2a5ba40cab11dfe158ced9ee9a" title="Destructor for future use;.">~mpdf</a>() {}; |
181 | | <a name="l00260"></a>00260 |
182 | | <a name="l00262"></a><a class="code" href="classbdm_1_1mpdf.html#5fd998aa9e223231ab20f29762e594f7">00262</a> <a class="code" href="classbdm_1_1mpdf.html#5fd998aa9e223231ab20f29762e594f7" title="Default constructor.">mpdf</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv0, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc0 ) :<a class="code" href="classbdm_1_1mpdf.html#9bcfb45435d30983f436d41c298cbb51" title="modeled random variable">rv</a> ( rv0 ),<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> ( rvc0 ) {}; |
183 | | <a name="l00264"></a><a class="code" href="classbdm_1_1mpdf.html#b3aba7311038bf990d706a64cab60cf8">00264</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1mpdf.html#b3aba7311038bf990d706a64cab60cf8" title="access function">_rvc</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>;} |
184 | | <a name="l00266"></a><a class="code" href="classbdm_1_1mpdf.html#222d5280e309c5a053ba73841e98c151">00266</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1mpdf.html#222d5280e309c5a053ba73841e98c151" title="access function">_rv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#9bcfb45435d30983f436d41c298cbb51" title="modeled random variable">rv</a>;} |
185 | | <a name="l00268"></a><a class="code" href="classbdm_1_1mpdf.html#1892fe3933488942253679f068e9e7f6">00268</a> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>& <a class="code" href="classbdm_1_1mpdf.html#1892fe3933488942253679f068e9e7f6" title="access function">_epdf</a>() {<span class="keywordflow">return</span> *<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>;} |
186 | | <a name="l00270"></a><a class="code" href="classbdm_1_1mpdf.html#05e843fd11c410a99dad2b88c55aca80">00270</a> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1mpdf.html#05e843fd11c410a99dad2b88c55aca80" title="access function">_e</a>() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>;} |
187 | | <a name="l00271"></a>00271 }; |
188 | | <a name="l00272"></a>00272 |
189 | | <a name="l00304"></a><a class="code" href="classbdm_1_1logger.html">00304</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1logger.html" title="DataLink is a connection between two data vectors Up and Down.">logger</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
190 | | <a name="l00305"></a>00305 <span class="keyword">protected</span>: |
191 | | <a name="l00307"></a><a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f">00307</a> Array<RV> <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>; |
192 | | <a name="l00309"></a><a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02">00309</a> Array<string> <a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>; |
193 | | <a name="l00310"></a>00310 <span class="keyword">public</span>: |
194 | | <a name="l00312"></a><a class="code" href="classbdm_1_1logger.html#f9c2fe7db5ddbda0098a4a5bd2c29fbf">00312</a> <a class="code" href="classbdm_1_1logger.html#f9c2fe7db5ddbda0098a4a5bd2c29fbf" title="Default constructor.">logger</a> ( ) : <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( 0 ),<a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a> ( 0 ) {} |
195 | | <a name="l00313"></a>00313 |
196 | | <a name="l00315"></a><a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">00315</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> <span class="keyword">add</span> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keywordtype">string</span> name=<span class="stringliteral">""</span> ) { |
197 | | <a name="l00316"></a>00316 <span class="keywordtype">int</span> <span class="keywordtype">id</span>=<a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.length(); |
198 | | <a name="l00317"></a>00317 <a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>=<a class="code" href="namespacebdm.html#b9016687c0e874ca5cdcf75ae28811aa" title="Concat two random variables.">concat</a> ( <a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>, name ); <span class="comment">// diff</span> |
199 | | <a name="l00318"></a>00318 <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.set_length ( <span class="keywordtype">id</span>+1,<span class="keyword">true</span> ); |
200 | | <a name="l00319"></a>00319 <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( <span class="keywordtype">id</span> ) = rv; |
201 | | <a name="l00320"></a>00320 <span class="keywordflow">return</span> id; <span class="comment">// identifier of the last entry</span> |
| 118 | <a name="l00173"></a>00173 |
| 119 | <a name="l00174"></a><a class="code" href="classbdm_1_1epdf.html">00174</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> :<span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
| 120 | <a name="l00175"></a>00175 <span class="keyword">protected</span>: |
| 121 | <a name="l00177"></a><a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8">00177</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a>; |
| 122 | <a name="l00178"></a>00178 <span class="keyword">public</span>: |
| 123 | <a name="l00180"></a><a class="code" href="classbdm_1_1epdf.html#992f3de956fb3439c62225156aafb6f6">00180</a> <a class="code" href="classbdm_1_1epdf.html#992f3de956fb3439c62225156aafb6f6" title="default constructor">epdf</a>() :<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a> ( ) {}; |
| 124 | <a name="l00181"></a>00181 |
| 125 | <a name="l00183"></a><a class="code" href="classbdm_1_1epdf.html#fdfed7aa18f2870951888b1dde977415">00183</a> <a class="code" href="classbdm_1_1epdf.html#992f3de956fb3439c62225156aafb6f6" title="default constructor">epdf</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv0 ) :<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a> ( rv0 ) {}; |
| 126 | <a name="l00184"></a>00184 |
| 127 | <a name="l00185"></a>00185 <span class="comment">// //! Returns the required moment of the epdf</span> |
| 128 | <a name="l00186"></a>00186 <span class="comment">// virtual vec moment ( const int order = 1 );</span> |
| 129 | <a name="l00187"></a>00187 |
| 130 | <a name="l00189"></a>00189 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#09721eb148bc49d6ec2f1956039f3a10" title="Returns a sample, from density .">sample</a> () <span class="keyword">const</span> =0; |
| 131 | <a name="l00191"></a>00191 <span class="keyword">virtual</span> mat <a class="code" href="classbdm_1_1epdf.html#b4cf45fd83cc7573ede9fe1215256058" title="Returns N samples from density .">sample_m</a> ( <span class="keywordtype">int</span> N ) <span class="keyword">const</span>; |
| 132 | <a name="l00192"></a>00192 |
| 133 | <a name="l00194"></a>00194 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1epdf.html#a8e39e2ff5e5cf5471bc159530d3b2d3" title="Compute log-probability of argument val.">evallog</a> ( <span class="keyword">const</span> vec &val ) <span class="keyword">const</span> =0; |
| 134 | <a name="l00195"></a>00195 |
| 135 | <a name="l00197"></a><a class="code" href="classbdm_1_1epdf.html#34956d4dd3176eeb5937cf48a1546b62">00197</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#34956d4dd3176eeb5937cf48a1546b62" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( <span class="keyword">const</span> mat &Val )<span class="keyword"> const </span>{ |
| 136 | <a name="l00198"></a>00198 vec x ( Val.cols() ); |
| 137 | <a name="l00199"></a>00199 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<Val.cols();i++ ) {x ( i ) =<a class="code" href="classbdm_1_1epdf.html#a8e39e2ff5e5cf5471bc159530d3b2d3" title="Compute log-probability of argument val.">evallog</a> ( Val.get_col ( i ) ) ;} |
| 138 | <a name="l00200"></a>00200 <span class="keywordflow">return</span> x; |
| 139 | <a name="l00201"></a>00201 } |
| 140 | <a name="l00203"></a><a class="code" href="classbdm_1_1epdf.html#e584eac5579c1b6384947ecf66166c77">00203</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>* <a class="code" href="classbdm_1_1epdf.html#e584eac5579c1b6384947ecf66166c77" title="Return conditional density on the given RV, the remaining rvs will be in conditioning...">condition</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a> )<span class="keyword"> const </span>{it_warning ( <span class="stringliteral">"Not implemented"</span> ); <span class="keywordflow">return</span> NULL;} |
| 141 | <a name="l00205"></a><a class="code" href="classbdm_1_1epdf.html#3fb2ece54f720b62ad325e61214fa0a1">00205</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1epdf.html#3fb2ece54f720b62ad325e61214fa0a1" title="Return marginal density on the given RV, the remainig rvs are intergrated out.">marginal</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a> )<span class="keyword"> const </span>{it_warning ( <span class="stringliteral">"Not implemented"</span> ); <span class="keywordflow">return</span> NULL;} |
| 142 | <a name="l00206"></a>00206 |
| 143 | <a name="l00208"></a>00208 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#565300f603ca00c989e16389d9eb42f5" title="return expected value">mean</a>() <span class="keyword">const</span> =0; |
| 144 | <a name="l00209"></a>00209 |
| 145 | <a name="l00211"></a>00211 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#45c2b64faa4bf526799e4154a6ec6097" title="return expected variance (not covariance!)">variance</a>() <span class="keyword">const</span> = 0; |
| 146 | <a name="l00212"></a>00212 |
| 147 | <a name="l00214"></a><a class="code" href="classbdm_1_1epdf.html#a4fa8637e7307cb051c400c2ce0ca0c8">00214</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1epdf.html#a4fa8637e7307cb051c400c2ce0ca0c8" title="Destructor for future use;.">~epdf</a>() {}; |
| 148 | <a name="l00216"></a><a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21">00216</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="access function, possibly dangerous!">_rv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a>;} |
| 149 | <a name="l00218"></a><a class="code" href="classbdm_1_1epdf.html#62e88cbce0ce77a8692f5e15d76e805f">00218</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1epdf.html#62e88cbce0ce77a8692f5e15d76e805f" title="modifier function - useful when copying epdfs">_renewrv</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &in_rv ) {<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Identified of the random variable.">rv</a>=in_rv;} |
| 150 | <a name="l00220"></a>00220 }; |
| 151 | <a name="l00221"></a>00221 |
| 152 | <a name="l00222"></a>00222 |
| 153 | <a name="l00224"></a>00224 <span class="comment">//TODO Samplecond can be generalized</span> |
| 154 | <a name="l00225"></a>00225 |
| 155 | <a name="l00226"></a><a class="code" href="classbdm_1_1mpdf.html">00226</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
| 156 | <a name="l00227"></a>00227 <span class="keyword">protected</span>: |
| 157 | <a name="l00229"></a><a class="code" href="classbdm_1_1mpdf.html#9bcfb45435d30983f436d41c298cbb51">00229</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1mpdf.html#9bcfb45435d30983f436d41c298cbb51" title="modeled random variable">rv</a>; |
| 158 | <a name="l00231"></a><a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288">00231</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>; |
| 159 | <a name="l00233"></a><a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0">00233</a> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>; |
| 160 | <a name="l00234"></a>00234 <span class="keyword">public</span>: |
| 161 | <a name="l00235"></a>00235 |
| 162 | <a name="l00237"></a><a class="code" href="classbdm_1_1mpdf.html#f0c1db6fcbb3aae2dd6123884457a367">00237</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1mpdf.html#f0c1db6fcbb3aae2dd6123884457a367" title="Returns a sample from the density conditioned on cond, .">samplecond</a> ( <span class="keyword">const</span> vec &cond) { |
| 163 | <a name="l00238"></a>00238 this-><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond ); |
| 164 | <a name="l00239"></a>00239 vec temp= <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-><a class="code" href="classbdm_1_1epdf.html#09721eb148bc49d6ec2f1956039f3a10" title="Returns a sample, from density .">sample</a>(); |
| 165 | <a name="l00240"></a>00240 <span class="keywordflow">return</span> temp; |
| 166 | <a name="l00241"></a>00241 }; |
| 167 | <a name="l00243"></a><a class="code" href="classbdm_1_1mpdf.html#ee26963a637b2ea1fb1933652981e652">00243</a> <span class="keyword">virtual</span> mat <a class="code" href="classbdm_1_1mpdf.html#ee26963a637b2ea1fb1933652981e652" title="Returns.">samplecond_m</a> ( <span class="keyword">const</span> vec &cond, vec &ll, <span class="keywordtype">int</span> N ) { |
| 168 | <a name="l00244"></a>00244 this-><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond ); |
| 169 | <a name="l00245"></a>00245 mat temp ( <a class="code" href="classbdm_1_1mpdf.html#9bcfb45435d30983f436d41c298cbb51" title="modeled random variable">rv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>(),N ); vec smp ( <a class="code" href="classbdm_1_1mpdf.html#9bcfb45435d30983f436d41c298cbb51" title="modeled random variable">rv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>() ); |
| 170 | <a name="l00246"></a>00246 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<N;i++ ) {smp=<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-><a class="code" href="classbdm_1_1epdf.html#09721eb148bc49d6ec2f1956039f3a10" title="Returns a sample, from density .">sample</a>() ;temp.set_col ( i, smp );ll ( i ) =<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-><a class="code" href="classbdm_1_1epdf.html#a8e39e2ff5e5cf5471bc159530d3b2d3" title="Compute log-probability of argument val.">evallog</a> ( smp );} |
| 171 | <a name="l00247"></a>00247 <span class="keywordflow">return</span> temp; |
| 172 | <a name="l00248"></a>00248 }; |
| 173 | <a name="l00250"></a><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530">00250</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &cond ) {it_error ( <span class="stringliteral">"Not implemented"</span> );}; |
| 174 | <a name="l00251"></a>00251 |
| 175 | <a name="l00253"></a><a class="code" href="classbdm_1_1mpdf.html#6336a8a72462e2a56a3989a220f18b1b">00253</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mpdf.html#6336a8a72462e2a56a3989a220f18b1b" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a> ( <span class="keyword">const</span> vec &dt, <span class="keyword">const</span> vec &cond ) { |
| 176 | <a name="l00254"></a>00254 <span class="keywordtype">double</span> tmp; this-><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond );tmp = <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-><a class="code" href="classbdm_1_1epdf.html#a8e39e2ff5e5cf5471bc159530d3b2d3" title="Compute log-probability of argument val.">evallog</a> ( dt ); it_assert_debug ( std::isfinite ( tmp ),<span class="stringliteral">"Infinite value"</span> ); <span class="keywordflow">return</span> tmp; |
| 177 | <a name="l00255"></a>00255 }; |
| 178 | <a name="l00256"></a>00256 |
| 179 | <a name="l00258"></a><a class="code" href="classbdm_1_1mpdf.html#0b0ed1ed663071bb7cf4a1349eb94fcb">00258</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1mpdf.html#0b0ed1ed663071bb7cf4a1349eb94fcb" title="Matrix version of evallogcond.">evallogcond_m</a> ( <span class="keyword">const</span> mat &Dt, <span class="keyword">const</span> vec &cond ) {this-><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond );<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-><a class="code" href="classbdm_1_1epdf.html#34956d4dd3176eeb5937cf48a1546b62" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( Dt );}; |
| 180 | <a name="l00259"></a>00259 |
| 181 | <a name="l00261"></a><a class="code" href="classbdm_1_1mpdf.html#2d83cf2a5ba40cab11dfe158ced9ee9a">00261</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1mpdf.html#2d83cf2a5ba40cab11dfe158ced9ee9a" title="Destructor for future use;.">~mpdf</a>() {}; |
| 182 | <a name="l00262"></a>00262 |
| 183 | <a name="l00264"></a><a class="code" href="classbdm_1_1mpdf.html#5fd998aa9e223231ab20f29762e594f7">00264</a> <a class="code" href="classbdm_1_1mpdf.html#5fd998aa9e223231ab20f29762e594f7" title="Default constructor.">mpdf</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv0, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc0 ) :<a class="code" href="classbdm_1_1mpdf.html#9bcfb45435d30983f436d41c298cbb51" title="modeled random variable">rv</a> ( rv0 ),<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> ( rvc0 ) {}; |
| 184 | <a name="l00266"></a><a class="code" href="classbdm_1_1mpdf.html#b3aba7311038bf990d706a64cab60cf8">00266</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1mpdf.html#b3aba7311038bf990d706a64cab60cf8" title="access function">_rvc</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>;} |
| 185 | <a name="l00268"></a><a class="code" href="classbdm_1_1mpdf.html#222d5280e309c5a053ba73841e98c151">00268</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1mpdf.html#222d5280e309c5a053ba73841e98c151" title="access function">_rv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#9bcfb45435d30983f436d41c298cbb51" title="modeled random variable">rv</a>;} |
| 186 | <a name="l00270"></a><a class="code" href="classbdm_1_1mpdf.html#1892fe3933488942253679f068e9e7f6">00270</a> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>& <a class="code" href="classbdm_1_1mpdf.html#1892fe3933488942253679f068e9e7f6" title="access function">_epdf</a>() {<span class="keywordflow">return</span> *<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>;} |
| 187 | <a name="l00272"></a><a class="code" href="classbdm_1_1mpdf.html#05e843fd11c410a99dad2b88c55aca80">00272</a> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1mpdf.html#05e843fd11c410a99dad2b88c55aca80" title="access function">_e</a>() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>;} |
| 188 | <a name="l00273"></a>00273 }; |
| 189 | <a name="l00274"></a>00274 |
| 190 | <a name="l00300"></a><a class="code" href="classbdm_1_1datalink__e2e.html">00300</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__e2e.html" title="DataLink is a connection between two data vectors Up and Down.">datalink_e2e</a> { |
| 191 | <a name="l00301"></a>00301 <span class="keyword">protected</span>: |
| 192 | <a name="l00303"></a><a class="code" href="classbdm_1_1datalink__e2e.html#eb4ee03764c2531083ec19759b7a52d3">00303</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink__e2e.html#eb4ee03764c2531083ec19759b7a52d3" title="Remember how long val should be.">valsize</a>; |
| 193 | <a name="l00305"></a><a class="code" href="classbdm_1_1datalink__e2e.html#ed0830e7a13f4f0f4beaae939cf11f6b">00305</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink__e2e.html#ed0830e7a13f4f0f4beaae939cf11f6b" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a>; |
| 194 | <a name="l00307"></a><a class="code" href="classbdm_1_1datalink__e2e.html#fa38045c8f1230757d62d38e71a49b97">00307</a> ivec <a class="code" href="classbdm_1_1datalink__e2e.html#fa38045c8f1230757d62d38e71a49b97" title="val-to-val link, indeces of the upper val">v2v_up</a>; |
| 195 | <a name="l00308"></a>00308 <span class="keyword">public</span>: |
| 196 | <a name="l00310"></a><a class="code" href="classbdm_1_1datalink__e2e.html#c85912b85a0a47ff0931d07e2d653264">00310</a> <a class="code" href="classbdm_1_1datalink__e2e.html#c85912b85a0a47ff0931d07e2d653264" title="Constructor.">datalink_e2e</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up ) : |
| 197 | <a name="l00311"></a>00311 <a class="code" href="classbdm_1_1datalink__e2e.html#eb4ee03764c2531083ec19759b7a52d3" title="Remember how long val should be.">valsize</a> ( rv.count() ), <a class="code" href="classbdm_1_1datalink__e2e.html#ed0830e7a13f4f0f4beaae939cf11f6b" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a> ( rv_up.count() ), <a class="code" href="classbdm_1_1datalink__e2e.html#fa38045c8f1230757d62d38e71a49b97" title="val-to-val link, indeces of the upper val">v2v_up</a> ( rv.dataind ( rv_up ) ) { |
| 198 | <a name="l00312"></a>00312 it_assert_debug ( <a class="code" href="classbdm_1_1datalink__e2e.html#fa38045c8f1230757d62d38e71a49b97" title="val-to-val link, indeces of the upper val">v2v_up</a>.length() ==<a class="code" href="classbdm_1_1datalink__e2e.html#eb4ee03764c2531083ec19759b7a52d3" title="Remember how long val should be.">valsize</a>,<span class="stringliteral">"rv is not fully in rv_up"</span> ); |
| 199 | <a name="l00313"></a>00313 } |
| 200 | <a name="l00315"></a><a class="code" href="classbdm_1_1datalink__e2e.html#4938c157340dc0dbc8f7bd3491678d86">00315</a> vec <a class="code" href="classbdm_1_1datalink__e2e.html#4938c157340dc0dbc8f7bd3491678d86" title="Get val for myself from val of &quot;Up&quot;.">get_val</a> ( <span class="keyword">const</span> vec &val_up ) {it_assert_debug ( <a class="code" href="classbdm_1_1datalink__e2e.html#ed0830e7a13f4f0f4beaae939cf11f6b" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); <span class="keywordflow">return</span> get_vec ( val_up,<a class="code" href="classbdm_1_1datalink__e2e.html#fa38045c8f1230757d62d38e71a49b97" title="val-to-val link, indeces of the upper val">v2v_up</a> );} |
| 201 | <a name="l00317"></a><a class="code" href="classbdm_1_1datalink__e2e.html#7646ec2f0f83bee2852e0fae6b0756a2">00317</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__e2e.html#7646ec2f0f83bee2852e0fae6b0756a2" title="Fill val of &quot;Up&quot; by my pieces.">fill_val</a> ( vec &val_up, <span class="keyword">const</span> vec &val ) { |
| 202 | <a name="l00318"></a>00318 it_assert_debug ( <a class="code" href="classbdm_1_1datalink__e2e.html#eb4ee03764c2531083ec19759b7a52d3" title="Remember how long val should be.">valsize</a>==val.length(),<span class="stringliteral">"Wrong val"</span> ); |
| 203 | <a name="l00319"></a>00319 it_assert_debug ( <a class="code" href="classbdm_1_1datalink__e2e.html#ed0830e7a13f4f0f4beaae939cf11f6b" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
| 204 | <a name="l00320"></a>00320 set_subvector ( val_up, <a class="code" href="classbdm_1_1datalink__e2e.html#fa38045c8f1230757d62d38e71a49b97" title="val-to-val link, indeces of the upper val">v2v_up</a>, val ); |
225 | | <a name="l00354"></a>00354 vec get_val ( <span class="keyword">const</span> vec &val_up ) {it_assert_debug ( valupsize==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); <span class="keywordflow">return</span> get_vec ( val_up,v2v_up );} |
226 | | <a name="l00356"></a>00356 <span class="keywordtype">void</span> fill_val ( vec &val_up, <span class="keyword">const</span> vec &val ) { |
227 | | <a name="l00357"></a>00357 it_assert_debug ( valsize==val.length(),<span class="stringliteral">"Wrong val"</span> ); |
228 | | <a name="l00358"></a>00358 it_assert_debug ( valupsize==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
229 | | <a name="l00359"></a>00359 set_subvector ( val_up, v2v_up, val ); |
230 | | <a name="l00360"></a>00360 } |
231 | | <a name="l00361"></a>00361 }; |
232 | | <a name="l00362"></a>00362 |
233 | | <a name="l00364"></a><a class="code" href="classbdm_1_1datalink__m2e.html">00364</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__m2e.html" title="data link between">datalink_m2e</a>: <span class="keyword">public</span> datalink_e2e { |
234 | | <a name="l00365"></a>00365 <span class="keyword">protected</span>: |
235 | | <a name="l00367"></a><a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9">00367</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>; |
236 | | <a name="l00369"></a><a class="code" href="classbdm_1_1datalink__m2e.html#43fe3e2d7aa04134053ec15793722783">00369</a> ivec <a class="code" href="classbdm_1_1datalink__m2e.html#43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a>; |
237 | | <a name="l00371"></a><a class="code" href="classbdm_1_1datalink__m2e.html#9e0048d87bda78e9b8d38761440c7abc">00371</a> ivec <a class="code" href="classbdm_1_1datalink__m2e.html#9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>; |
238 | | <a name="l00372"></a>00372 |
239 | | <a name="l00373"></a>00373 <span class="keyword">public</span>: |
240 | | <a name="l00375"></a><a class="code" href="classbdm_1_1datalink__m2e.html#31bb5b6cd04b4d99a02fc8d1ad5ce202">00375</a> <a class="code" href="classbdm_1_1datalink__m2e.html#31bb5b6cd04b4d99a02fc8d1ad5ce202" title="Constructor.">datalink_m2e</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up ) : |
241 | | <a name="l00376"></a>00376 datalink_e2e ( rv,rv_up ), <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ( rvc.count() ) { |
242 | | <a name="l00377"></a>00377 <span class="comment">//establish v2c connection</span> |
243 | | <a name="l00378"></a>00378 rvc.<a class="code" href="classbdm_1_1RV.html#cbebdb5e0d30101a6eb63550ef701c55">dataind</a> ( rv_up, <a class="code" href="classbdm_1_1datalink__m2e.html#9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>, <a class="code" href="classbdm_1_1datalink__m2e.html#43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a> ); |
244 | | <a name="l00379"></a>00379 } |
245 | | <a name="l00381"></a><a class="code" href="classbdm_1_1datalink__m2e.html#7ba850822e3cf9a4b079afc7e7c01703">00381</a> vec <a class="code" href="classbdm_1_1datalink__m2e.html#7ba850822e3cf9a4b079afc7e7c01703" title="Construct condition.">get_cond</a> ( <span class="keyword">const</span> vec &val_up ) { |
246 | | <a name="l00382"></a>00382 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
247 | | <a name="l00383"></a>00383 set_subvector ( tmp,<a class="code" href="classbdm_1_1datalink__m2e.html#9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>,val_up ( <a class="code" href="classbdm_1_1datalink__m2e.html#43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a> ) ); |
248 | | <a name="l00384"></a>00384 <span class="keywordflow">return</span> tmp; |
249 | | <a name="l00385"></a>00385 } |
250 | | <a name="l00386"></a>00386 <span class="keywordtype">void</span> fill_val_cond ( vec &val_up, <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ) { |
251 | | <a name="l00387"></a>00387 it_assert_debug ( valsize==val.length(),<span class="stringliteral">"Wrong val"</span> ); |
252 | | <a name="l00388"></a>00388 it_assert_debug ( valupsize==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
253 | | <a name="l00389"></a>00389 set_subvector ( val_up, v2v_up, val ); |
254 | | <a name="l00390"></a>00390 set_subvector ( val_up, <a class="code" href="classbdm_1_1datalink__m2e.html#43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a>, cond ); |
255 | | <a name="l00391"></a>00391 } |
256 | | <a name="l00392"></a>00392 }; |
257 | | <a name="l00395"></a><a class="code" href="classbdm_1_1datalink__m2m.html">00395</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__m2m.html">datalink_m2m</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1datalink__m2e.html" title="data link between">datalink_m2e</a> { |
258 | | <a name="l00396"></a>00396 <span class="keyword">protected</span>: |
259 | | <a name="l00398"></a><a class="code" href="classbdm_1_1datalink__m2m.html#d64dda6f92654628276bbcebb7600d0d">00398</a> ivec <a class="code" href="classbdm_1_1datalink__m2m.html#d64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indeces of the upper cond">c2c_up</a>; |
260 | | <a name="l00400"></a><a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5">00400</a> ivec <a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>; |
261 | | <a name="l00401"></a>00401 <span class="keyword">public</span>: |
262 | | <a name="l00403"></a><a class="code" href="classbdm_1_1datalink__m2m.html#540c4b60686fdf1a7915300ae11bc41b">00403</a> <a class="code" href="classbdm_1_1datalink__m2m.html#540c4b60686fdf1a7915300ae11bc41b" title="Constructor.">datalink_m2m</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc_up ) : |
263 | | <a name="l00404"></a>00404 <a class="code" href="classbdm_1_1datalink__m2e.html" title="data link between">datalink_m2e</a> ( rv, rvc, rv_up ) { |
264 | | <a name="l00405"></a>00405 <span class="comment">//establish c2c connection</span> |
265 | | <a name="l00406"></a>00406 rvc.<a class="code" href="classbdm_1_1RV.html#cbebdb5e0d30101a6eb63550ef701c55">dataind</a> ( rvc_up, <a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>, <a class="code" href="classbdm_1_1datalink__m2m.html#d64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indeces of the upper cond">c2c_up</a> ); |
266 | | <a name="l00407"></a>00407 it_assert_debug ( <a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>.length() +<a class="code" href="classbdm_1_1datalink__m2e.html#9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>.length() ==<a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>, <span class="stringliteral">"cond is not fully given"</span> ); |
267 | | <a name="l00408"></a>00408 } |
268 | | <a name="l00410"></a><a class="code" href="classbdm_1_1datalink__m2m.html#911fb7fcfa80d4e31db8e0cc03141a90">00410</a> vec <a class="code" href="classbdm_1_1datalink__m2m.html#911fb7fcfa80d4e31db8e0cc03141a90" title="Get cond for myself from val and cond of &quot;Up&quot;.">get_cond</a> ( <span class="keyword">const</span> vec &val_up, <span class="keyword">const</span> vec &cond_up ) { |
269 | | <a name="l00411"></a>00411 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
270 | | <a name="l00412"></a>00412 set_subvector ( tmp,<a class="code" href="classbdm_1_1datalink__m2e.html#9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>,val_up ( <a class="code" href="classbdm_1_1datalink__m2e.html#43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a> ) ); |
271 | | <a name="l00413"></a>00413 set_subvector ( tmp,<a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>,cond_up ( <a class="code" href="classbdm_1_1datalink__m2m.html#d64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indeces of the upper cond">c2c_up</a> ) ); |
272 | | <a name="l00414"></a>00414 <span class="keywordflow">return</span> tmp; |
273 | | <a name="l00415"></a>00415 } |
274 | | <a name="l00417"></a>00417 |
275 | | <a name="l00418"></a>00418 }; |
276 | | <a name="l00419"></a>00419 |
277 | | <a name="l00423"></a><a class="code" href="classbdm_1_1mepdf.html">00423</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mepdf.html" title="Unconditional mpdf, allows using epdf in the role of mpdf.">mepdf</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> { |
278 | | <a name="l00424"></a>00424 <span class="keyword">public</span>: |
279 | | <a name="l00426"></a><a class="code" href="classbdm_1_1mepdf.html#27cc32d1a810516c25bda51ddf886376">00426</a> <a class="code" href="classbdm_1_1mepdf.html#27cc32d1a810516c25bda51ddf886376" title="Default constructor.">mepdf</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* em ) :<a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> ( em-><a class="code" href="classbdm_1_1mpdf.html#222d5280e309c5a053ba73841e98c151" title="access function">_rv</a>(),<a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>() ) {<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>=<span class="keyword">const_cast<</span><a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>*<span class="keyword">></span> ( em );}; |
280 | | <a name="l00427"></a><a class="code" href="classbdm_1_1mepdf.html#b2b898058169e7ed9a6dc7cd4e1c147c">00427</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mepdf.html#b2b898058169e7ed9a6dc7cd4e1c147c" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &cond ) {} |
281 | | <a name="l00428"></a>00428 }; |
282 | | <a name="l00429"></a>00429 |
283 | | <a name="l00432"></a><a class="code" href="classbdm_1_1compositepdf.html">00432</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1compositepdf.html" title="Abstract composition of pdfs, will be used for specific classes this abstract class...">compositepdf</a> { |
284 | | <a name="l00433"></a>00433 <span class="keyword">protected</span>: |
285 | | <a name="l00435"></a><a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a">00435</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a>; |
286 | | <a name="l00437"></a><a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a">00437</a> Array<mpdf*> <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>; |
287 | | <a name="l00438"></a>00438 <span class="keyword">public</span>: |
288 | | <a name="l00439"></a>00439 <a class="code" href="classbdm_1_1compositepdf.html" title="Abstract composition of pdfs, will be used for specific classes this abstract class...">compositepdf</a> ( Array<mpdf*> A0 ) : <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ( A0.length() ), <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( A0 ) {}; |
289 | | <a name="l00441"></a>00441 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1compositepdf.html#c73d39acc4378eee6a63155c3517d3c9" title="find common rv, flag">getrv</a> ( <span class="keywordtype">bool</span> checkoverlap=<span class="keyword">false</span> ); |
290 | | <a name="l00443"></a>00443 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1compositepdf.html#c71fc2c51f49d797e61f479f543c75ce" title="common rvc of all mpdfs is written to rvc">setrvc</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc ); |
291 | | <a name="l00444"></a>00444 }; |
292 | | <a name="l00445"></a>00445 |
293 | | <a name="l00453"></a><a class="code" href="classbdm_1_1DS.html">00453</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
294 | | <a name="l00454"></a>00454 <span class="keyword">protected</span>: |
295 | | <a name="l00456"></a><a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec">00456</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a>; |
296 | | <a name="l00458"></a><a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702">00458</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a>; <span class="comment">//</span> |
297 | | <a name="l00460"></a><a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867">00460</a> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>, L_ut; |
298 | | <a name="l00461"></a>00461 <span class="keyword">public</span>: |
299 | | <a name="l00462"></a>00462 <a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a>() :<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a> ( <a class="code" href="namespacebdm.html#bdd4760f14ec7d6fea083aa2170f6236" title="Default empty RV that can be used as default argument.">RV0</a> ),<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a> ( <a class="code" href="namespacebdm.html#bdd4760f14ec7d6fea083aa2170f6236" title="Default empty RV that can be used as default argument.">RV0</a> ) {}; |
300 | | <a name="l00463"></a>00463 <a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &Drv0, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &Urv0 ) :<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a> ( Drv0 ),<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a> ( Urv0 ) {}; |
301 | | <a name="l00465"></a><a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba">00465</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( vec &dt ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
302 | | <a name="l00467"></a><a class="code" href="classbdm_1_1DS.html#a0bf451c7fea73ff4150ff9e83da4832">00467</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( vec &dt, <span class="keyword">const</span> ivec &indeces ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
303 | | <a name="l00469"></a><a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a">00469</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
304 | | <a name="l00471"></a><a class="code" href="classbdm_1_1DS.html#6bced13f84f6bf04449728817e049e1d">00471</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut, <span class="keyword">const</span> ivec &indeces ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
305 | | <a name="l00472"></a>00472 |
306 | | <a name="l00474"></a>00474 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#9a14c64d881e838ddc3a5617ee8a973b" title="Moves from to , i.e. perfroms the actions and reads response of the system.">step</a>() =0; |
307 | | <a name="l00475"></a>00475 |
308 | | <a name="l00477"></a><a class="code" href="classbdm_1_1DS.html#3c9e417d85052396fe74c164857ee67e">00477</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#3c9e417d85052396fe74c164857ee67e" title="Register DS for logging into logger L.">log_add</a> ( <a class="code" href="classbdm_1_1logger.html" title="DataLink is a connection between two data vectors Up and Down.">logger</a> &L ) { |
309 | | <a name="l00478"></a>00478 <a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>=L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a> ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a>,<span class="stringliteral">""</span> ); |
310 | | <a name="l00479"></a>00479 L_ut=L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a> ( <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a>,<span class="stringliteral">""</span> ); |
311 | | <a name="l00480"></a>00480 } |
312 | | <a name="l00482"></a><a class="code" href="classbdm_1_1DS.html#e03d2c93cddd5c3a03107ddd3ae999cf">00482</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#e03d2c93cddd5c3a03107ddd3ae999cf" title="Register DS for logging into logger L.">logit</a> ( <a class="code" href="classbdm_1_1logger.html" title="DataLink is a connection between two data vectors Up and Down.">logger</a> &L ) { |
313 | | <a name="l00483"></a>00483 vec tmp(<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>()+<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>()); |
314 | | <a name="l00484"></a>00484 <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a>(tmp); |
315 | | <a name="l00485"></a>00485 <span class="comment">// d is first in getdata</span> |
316 | | <a name="l00486"></a>00486 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>,tmp.left ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>() ) ); |
317 | | <a name="l00487"></a>00487 <span class="comment">// u follows after d in getdata</span> |
318 | | <a name="l00488"></a>00488 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( L_ut,tmp.mid ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>(), <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>() ) ); |
319 | | <a name="l00489"></a>00489 } |
320 | | <a name="l00490"></a>00490 }; |
321 | | <a name="l00491"></a>00491 |
322 | | <a name="l00496"></a><a class="code" href="classbdm_1_1BM.html">00496</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a> :<span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
323 | | <a name="l00497"></a>00497 <span class="keyword">protected</span>: |
324 | | <a name="l00499"></a><a class="code" href="classbdm_1_1BM.html#18d6db4af8ee42077741d9e3618153ca">00499</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rv; |
325 | | <a name="l00501"></a><a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a">00501</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
326 | | <a name="l00503"></a><a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee">00503</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>; |
327 | | <a name="l00504"></a>00504 <span class="keyword">public</span>: |
328 | | <a name="l00505"></a>00505 |
329 | | <a name="l00507"></a><a class="code" href="classbdm_1_1BM.html#a33000bb124c32e58742f056ecab4293">00507</a> <a class="code" href="classbdm_1_1BM.html#a33000bb124c32e58742f056ecab4293" title="Default constructor.">BM</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv0, <span class="keywordtype">double</span> ll0=0,<span class="keywordtype">bool</span> evalll0=<span class="keyword">true</span> ) :rv ( rv0 ), <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( ll0 ),<a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( evalll0 ) {<span class="comment">//Fixme: test rv</span> |
330 | | <a name="l00508"></a>00508 }; |
331 | | <a name="l00510"></a><a class="code" href="classbdm_1_1BM.html#241b3701190ff1f729fe873a2eef0055">00510</a> <a class="code" href="classbdm_1_1BM.html#a33000bb124c32e58742f056ecab4293" title="Default constructor.">BM</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a> &B ) : rv ( B.rv ), <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( B.<a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ), <a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( B.<a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {} |
332 | | <a name="l00511"></a>00511 |
333 | | <a name="l00515"></a>00515 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#60b1779a577367c369a932cabd3a6188" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &dt ) = 0; |
334 | | <a name="l00517"></a>00517 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#1dee3fddaf021e62d925289660a707dc" title="Batch Bayes rule (columns of Dt are observations).">bayesB</a> ( <span class="keyword">const</span> mat &Dt ); |
335 | | <a name="l00519"></a>00519 <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>& <a class="code" href="classbdm_1_1BM.html#963258c4c2dd05be001003b19aceefef" title="Returns a reference to the epdf representing posterior density on parameters.">_epdf</a>() <span class="keyword">const</span> =0; |
336 | | <a name="l00520"></a>00520 |
337 | | <a name="l00522"></a>00522 <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1BM.html#4ed0f8b880e606316ae800f3a011c3a6" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_e</a>() <span class="keyword">const</span> =0; |
338 | | <a name="l00523"></a>00523 |
339 | | <a name="l00526"></a><a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">00526</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( <span class="keyword">const</span> vec &dt )<span class="keyword"> const</span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0.0;} |
340 | | <a name="l00528"></a><a class="code" href="classbdm_1_1BM.html#0e8ebe61fb14990abe1254bd3dda5fae">00528</a> vec <a class="code" href="classbdm_1_1BM.html#0e8ebe61fb14990abe1254bd3dda5fae" title="Matrix version of logpred.">logpred_m</a> ( <span class="keyword">const</span> mat &dt )<span class="keyword"> const</span>{vec tmp ( dt.cols() );<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<dt.cols();i++ ) {tmp ( i ) =<a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( dt.get_col ( i ) );}<span class="keywordflow">return</span> tmp;} |
341 | | <a name="l00529"></a>00529 |
342 | | <a name="l00531"></a><a class="code" href="classbdm_1_1BM.html#710e7d69c0d8791fb41a7cd4683cca2c">00531</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1BM.html#710e7d69c0d8791fb41a7cd4683cca2c" title="Constructs a predictive density (marginal density on data).">predictor</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> NULL;}; |
343 | | <a name="l00532"></a>00532 |
344 | | <a name="l00534"></a><a class="code" href="classbdm_1_1BM.html#374281cad3caa16fa30609bb4ac16505">00534</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1BM.html#374281cad3caa16fa30609bb4ac16505" title="Destructor for future use;.">~BM</a>() {}; |
345 | | <a name="l00536"></a><a class="code" href="classbdm_1_1BM.html#40a3c891996391e3135518053a917793">00536</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1BM.html#40a3c891996391e3135518053a917793" title="access function">_rv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> rv;} |
346 | | <a name="l00538"></a><a class="code" href="classbdm_1_1BM.html#5be65d37dedfe33a3671e7065f523a70">00538</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#5be65d37dedfe33a3671e7065f523a70" title="access function">_ll</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>;} |
347 | | <a name="l00540"></a><a class="code" href="classbdm_1_1BM.html#236b3abbcc93594fc97cd86d82c1a83f">00540</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#236b3abbcc93594fc97cd86d82c1a83f" title="access function">set_evalll</a> ( <span class="keywordtype">bool</span> evl0 ) {<a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>=evl0;} |
348 | | <a name="l00541"></a>00541 |
349 | | <a name="l00544"></a><a class="code" href="classbdm_1_1BM.html#3efb3098172f1f67564a312fe732473e">00544</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a>* <a class="code" href="classbdm_1_1BM.html#3efb3098172f1f67564a312fe732473e">_copy_</a> ( <span class="keywordtype">bool</span> changerv=<span class="keyword">false</span> ) {it_error ( <span class="stringliteral">"function _copy_ not implemented for this BM"</span> ); <span class="keywordflow">return</span> NULL;}; |
350 | | <a name="l00545"></a>00545 }; |
351 | | <a name="l00546"></a>00546 |
352 | | <a name="l00556"></a><a class="code" href="classbdm_1_1BMcond.html">00556</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1BMcond.html" title="Conditional Bayesian Filter.">BMcond</a> :<span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
353 | | <a name="l00557"></a>00557 <span class="keyword">protected</span>: |
354 | | <a name="l00559"></a><a class="code" href="classbdm_1_1BMcond.html#9a12750776d977408aada06a70093297">00559</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1BMcond.html#9a12750776d977408aada06a70093297" title="Identificator of the conditioning variable.">rvc</a>; |
355 | | <a name="l00560"></a>00560 <span class="keyword">public</span>: |
356 | | <a name="l00562"></a>00562 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BMcond.html#a67bac171f89ef18d0191f8f74189f25" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &val ) =0; |
357 | | <a name="l00564"></a><a class="code" href="classbdm_1_1BMcond.html#dde99f401cbf2e8e6a926eaa764b457d">00564</a> <a class="code" href="classbdm_1_1BMcond.html#dde99f401cbf2e8e6a926eaa764b457d" title="Default constructor.">BMcond</a> ( <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv0 ) :<a class="code" href="classbdm_1_1BMcond.html#9a12750776d977408aada06a70093297" title="Identificator of the conditioning variable.">rvc</a> ( rv0 ) {}; |
358 | | <a name="l00566"></a><a class="code" href="classbdm_1_1BMcond.html#7d68d46cfcc36f9cc07a15a5403b5a1a">00566</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1BMcond.html#7d68d46cfcc36f9cc07a15a5403b5a1a" title="Destructor for future use.">~BMcond</a>() {}; |
359 | | <a name="l00568"></a><a class="code" href="classbdm_1_1BMcond.html#7506910f93250b44fea505ec4ffb19dc">00568</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1BMcond.html#7506910f93250b44fea505ec4ffb19dc" title="access function">_rvc</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BMcond.html#9a12750776d977408aada06a70093297" title="Identificator of the conditioning variable.">rvc</a>;} |
360 | | <a name="l00569"></a>00569 }; |
361 | | <a name="l00570"></a>00570 |
362 | | <a name="l00571"></a>00571 }; <span class="comment">//namespace</span> |
363 | | <a name="l00573"></a>00573 <span class="comment"></span><span class="preprocessor">#endif // BM_H</span> |
| 231 | <a name="l00353"></a>00353 }; |
| 232 | <a name="l00356"></a><a class="code" href="classbdm_1_1datalink__m2m.html">00356</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__m2m.html">datalink_m2m</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1datalink__m2e.html" title="data link between">datalink_m2e</a> { |
| 233 | <a name="l00357"></a>00357 <span class="keyword">protected</span>: |
| 234 | <a name="l00359"></a><a class="code" href="classbdm_1_1datalink__m2m.html#d64dda6f92654628276bbcebb7600d0d">00359</a> ivec <a class="code" href="classbdm_1_1datalink__m2m.html#d64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indeces of the upper cond">c2c_up</a>; |
| 235 | <a name="l00361"></a><a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5">00361</a> ivec <a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>; |
| 236 | <a name="l00362"></a>00362 <span class="keyword">public</span>: |
| 237 | <a name="l00364"></a><a class="code" href="classbdm_1_1datalink__m2m.html#540c4b60686fdf1a7915300ae11bc41b">00364</a> <a class="code" href="classbdm_1_1datalink__m2m.html#540c4b60686fdf1a7915300ae11bc41b" title="Constructor.">datalink_m2m</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc_up ) : |
| 238 | <a name="l00365"></a>00365 <a class="code" href="classbdm_1_1datalink__m2e.html" title="data link between">datalink_m2e</a> ( rv, rvc, rv_up ) { |
| 239 | <a name="l00366"></a>00366 <span class="comment">//establish c2c connection</span> |
| 240 | <a name="l00367"></a>00367 rvc.<a class="code" href="classbdm_1_1RV.html#cbebdb5e0d30101a6eb63550ef701c55">dataind</a> ( rvc_up, <a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>, <a class="code" href="classbdm_1_1datalink__m2m.html#d64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indeces of the upper cond">c2c_up</a> ); |
| 241 | <a name="l00368"></a>00368 it_assert_debug ( <a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>.length() +<a class="code" href="classbdm_1_1datalink__m2e.html#9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>.length() ==<a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>, <span class="stringliteral">"cond is not fully given"</span> ); |
| 242 | <a name="l00369"></a>00369 } |
| 243 | <a name="l00371"></a><a class="code" href="classbdm_1_1datalink__m2m.html#911fb7fcfa80d4e31db8e0cc03141a90">00371</a> vec <a class="code" href="classbdm_1_1datalink__m2m.html#911fb7fcfa80d4e31db8e0cc03141a90" title="Get cond for myself from val and cond of &quot;Up&quot;.">get_cond</a> ( <span class="keyword">const</span> vec &val_up, <span class="keyword">const</span> vec &cond_up ) { |
| 244 | <a name="l00372"></a>00372 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
| 245 | <a name="l00373"></a>00373 set_subvector ( tmp,<a class="code" href="classbdm_1_1datalink__m2e.html#9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>,val_up ( <a class="code" href="classbdm_1_1datalink__m2e.html#43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a> ) ); |
| 246 | <a name="l00374"></a>00374 set_subvector ( tmp,<a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>,cond_up ( <a class="code" href="classbdm_1_1datalink__m2m.html#d64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indeces of the upper cond">c2c_up</a> ) ); |
| 247 | <a name="l00375"></a>00375 <span class="keywordflow">return</span> tmp; |
| 248 | <a name="l00376"></a>00376 } |
| 249 | <a name="l00378"></a>00378 |
| 250 | <a name="l00379"></a>00379 }; |
| 251 | <a name="l00380"></a>00380 |
| 252 | <a name="l00386"></a><a class="code" href="classbdm_1_1logger.html">00386</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
| 253 | <a name="l00387"></a>00387 <span class="keyword">protected</span>: |
| 254 | <a name="l00389"></a><a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f">00389</a> Array<RV> <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>; |
| 255 | <a name="l00391"></a><a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02">00391</a> Array<string> <a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>; |
| 256 | <a name="l00392"></a>00392 <span class="keyword">public</span>: |
| 257 | <a name="l00394"></a><a class="code" href="classbdm_1_1logger.html#f9c2fe7db5ddbda0098a4a5bd2c29fbf">00394</a> <a class="code" href="classbdm_1_1logger.html#f9c2fe7db5ddbda0098a4a5bd2c29fbf" title="Default constructor.">logger</a> ( ) : <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( 0 ),<a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a> ( 0 ) {} |
| 258 | <a name="l00395"></a>00395 |
| 259 | <a name="l00397"></a><a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">00397</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> <span class="keyword">add</span> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keywordtype">string</span> name=<span class="stringliteral">""</span> ) { |
| 260 | <a name="l00398"></a>00398 <span class="keywordtype">int</span> <span class="keywordtype">id</span>=<a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.length(); |
| 261 | <a name="l00399"></a>00399 <a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>=<a class="code" href="namespacebdm.html#b9016687c0e874ca5cdcf75ae28811aa" title="Concat two random variables.">concat</a> ( <a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>, name ); <span class="comment">// diff</span> |
| 262 | <a name="l00400"></a>00400 <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.set_length ( <span class="keywordtype">id</span>+1,<span class="keyword">true</span> ); |
| 263 | <a name="l00401"></a>00401 <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( <span class="keywordtype">id</span> ) = rv; |
| 264 | <a name="l00402"></a>00402 <span class="keywordflow">return</span> id; <span class="comment">// identifier of the last entry</span> |
| 265 | <a name="l00403"></a>00403 } |
| 266 | <a name="l00404"></a>00404 |
| 267 | <a name="l00406"></a>00406 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> vec &v ) =0; |
| 268 | <a name="l00407"></a>00407 |
| 269 | <a name="l00409"></a>00409 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#4f31c03578a7b9b30d8b1f8c338a37e8" title="Shifts storage position for another time step.">step</a>() =0; |
| 270 | <a name="l00410"></a>00410 |
| 271 | <a name="l00412"></a><a class="code" href="classbdm_1_1logger.html#0e3fc7d13e23a8f71fc7c8a5ea68559d">00412</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#0e3fc7d13e23a8f71fc7c8a5ea68559d" title="Finalize storing information.">finalize</a>() {}; |
| 272 | <a name="l00413"></a>00413 |
| 273 | <a name="l00415"></a><a class="code" href="classbdm_1_1logger.html#cd6291a73491f755dc7bc88d022eb2fc">00415</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#cd6291a73491f755dc7bc88d022eb2fc" title="Initialize the storage.">init</a>() {}; |
| 274 | <a name="l00416"></a>00416 |
| 275 | <a name="l00418"></a><a class="code" href="classbdm_1_1logger.html#f2ade56238a5d408e65a77c53f516448">00418</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1logger.html#f2ade56238a5d408e65a77c53f516448" title="for future use">~logger</a>() {}; |
| 276 | <a name="l00419"></a>00419 }; |
| 277 | <a name="l00420"></a>00420 |
| 278 | <a name="l00424"></a><a class="code" href="classbdm_1_1mepdf.html">00424</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mepdf.html" title="Unconditional mpdf, allows using epdf in the role of mpdf.">mepdf</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> { |
| 279 | <a name="l00425"></a>00425 <span class="keyword">public</span>: |
| 280 | <a name="l00427"></a><a class="code" href="classbdm_1_1mepdf.html#27cc32d1a810516c25bda51ddf886376">00427</a> <a class="code" href="classbdm_1_1mepdf.html#27cc32d1a810516c25bda51ddf886376" title="Default constructor.">mepdf</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* em ) :<a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> ( em-><a class="code" href="classbdm_1_1mpdf.html#222d5280e309c5a053ba73841e98c151" title="access function">_rv</a>(),<a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>() ) {<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>=<span class="keyword">const_cast<</span><a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>*<span class="keyword">></span> ( em );}; |
| 281 | <a name="l00428"></a><a class="code" href="classbdm_1_1mepdf.html#b2b898058169e7ed9a6dc7cd4e1c147c">00428</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mepdf.html#b2b898058169e7ed9a6dc7cd4e1c147c" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &cond ) {} |
| 282 | <a name="l00429"></a>00429 }; |
| 283 | <a name="l00430"></a>00430 |
| 284 | <a name="l00433"></a><a class="code" href="classbdm_1_1compositepdf.html">00433</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1compositepdf.html" title="Abstract composition of pdfs, will be used for specific classes this abstract class...">compositepdf</a> { |
| 285 | <a name="l00434"></a>00434 <span class="keyword">protected</span>: |
| 286 | <a name="l00436"></a><a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a">00436</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a>; |
| 287 | <a name="l00438"></a><a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a">00438</a> Array<mpdf*> <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>; |
| 288 | <a name="l00439"></a>00439 <span class="keyword">public</span>: |
| 289 | <a name="l00440"></a>00440 <a class="code" href="classbdm_1_1compositepdf.html" title="Abstract composition of pdfs, will be used for specific classes this abstract class...">compositepdf</a> ( Array<mpdf*> A0 ) : <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ( A0.length() ), <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( A0 ) {}; |
| 290 | <a name="l00442"></a>00442 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1compositepdf.html#c73d39acc4378eee6a63155c3517d3c9" title="find common rv, flag">getrv</a> ( <span class="keywordtype">bool</span> checkoverlap=<span class="keyword">false</span> ); |
| 291 | <a name="l00444"></a>00444 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1compositepdf.html#c71fc2c51f49d797e61f479f543c75ce" title="common rvc of all mpdfs is written to rvc">setrvc</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc ); |
| 292 | <a name="l00445"></a>00445 }; |
| 293 | <a name="l00446"></a>00446 |
| 294 | <a name="l00454"></a><a class="code" href="classbdm_1_1DS.html">00454</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
| 295 | <a name="l00455"></a>00455 <span class="keyword">protected</span>: |
| 296 | <a name="l00457"></a><a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec">00457</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a>; |
| 297 | <a name="l00459"></a><a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702">00459</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a>; <span class="comment">//</span> |
| 298 | <a name="l00461"></a><a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867">00461</a> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>, L_ut; |
| 299 | <a name="l00462"></a>00462 <span class="keyword">public</span>: |
| 300 | <a name="l00463"></a>00463 <a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a>() :<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a> ( <a class="code" href="namespacebdm.html#bdd4760f14ec7d6fea083aa2170f6236" title="Default empty RV that can be used as default argument.">RV0</a> ),<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a> ( <a class="code" href="namespacebdm.html#bdd4760f14ec7d6fea083aa2170f6236" title="Default empty RV that can be used as default argument.">RV0</a> ) {}; |
| 301 | <a name="l00464"></a>00464 <a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &Drv0, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &Urv0 ) :<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a> ( Drv0 ),<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a> ( Urv0 ) {}; |
| 302 | <a name="l00466"></a><a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba">00466</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( vec &dt ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
| 303 | <a name="l00468"></a><a class="code" href="classbdm_1_1DS.html#a0bf451c7fea73ff4150ff9e83da4832">00468</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( vec &dt, <span class="keyword">const</span> ivec &indeces ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
| 304 | <a name="l00470"></a><a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a">00470</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
| 305 | <a name="l00472"></a><a class="code" href="classbdm_1_1DS.html#6bced13f84f6bf04449728817e049e1d">00472</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut, <span class="keyword">const</span> ivec &indeces ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
| 306 | <a name="l00473"></a>00473 |
| 307 | <a name="l00475"></a>00475 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#9a14c64d881e838ddc3a5617ee8a973b" title="Moves from to , i.e. perfroms the actions and reads response of the system.">step</a>() =0; |
| 308 | <a name="l00476"></a>00476 |
| 309 | <a name="l00478"></a><a class="code" href="classbdm_1_1DS.html#3c9e417d85052396fe74c164857ee67e">00478</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#3c9e417d85052396fe74c164857ee67e" title="Register DS for logging into logger L.">log_add</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
| 310 | <a name="l00479"></a>00479 <a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>=L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a> ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a>,<span class="stringliteral">""</span> ); |
| 311 | <a name="l00480"></a>00480 L_ut=L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1" title="returns an identifier which will be later needed for calling the log() function">add</a> ( <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a>,<span class="stringliteral">""</span> ); |
| 312 | <a name="l00481"></a>00481 } |
| 313 | <a name="l00483"></a><a class="code" href="classbdm_1_1DS.html#e03d2c93cddd5c3a03107ddd3ae999cf">00483</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#e03d2c93cddd5c3a03107ddd3ae999cf" title="Register DS for logging into logger L.">logit</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
| 314 | <a name="l00484"></a>00484 vec tmp(<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>()+<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>()); |
| 315 | <a name="l00485"></a>00485 <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a>(tmp); |
| 316 | <a name="l00486"></a>00486 <span class="comment">// d is first in getdata</span> |
| 317 | <a name="l00487"></a>00487 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>,tmp.left ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>() ) ); |
| 318 | <a name="l00488"></a>00488 <span class="comment">// u follows after d in getdata</span> |
| 319 | <a name="l00489"></a>00489 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( L_ut,tmp.mid ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>(), <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#2174751a00ce19f941edd2c1a861be67" title="Return number of scalars in the RV.">count</a>() ) ); |
| 320 | <a name="l00490"></a>00490 } |
| 321 | <a name="l00492"></a><a class="code" href="classbdm_1_1DS.html#ed2113851294ed96abe60fc3f05aa660">00492</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1DS.html#ed2113851294ed96abe60fc3f05aa660" title="access function">_drv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="namespacebdm.html#b9016687c0e874ca5cdcf75ae28811aa" title="Concat two random variables.">concat</a>(<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Observed variables, returned by getdata().">Drv</a>,<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a>);} |
| 322 | <a name="l00494"></a><a class="code" href="classbdm_1_1DS.html#a6a9a375da64c82fc227bda3418a1f33">00494</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1DS.html#a6a9a375da64c82fc227bda3418a1f33" title="access function">_urv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Action variables, accepted by write().">Urv</a>;} |
| 323 | <a name="l00495"></a>00495 }; |
| 324 | <a name="l00496"></a>00496 |
| 325 | <a name="l00501"></a><a class="code" href="classbdm_1_1BM.html">00501</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> :<span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
| 326 | <a name="l00502"></a>00502 <span class="keyword">protected</span>: |
| 327 | <a name="l00504"></a><a class="code" href="classbdm_1_1BM.html#18d6db4af8ee42077741d9e3618153ca">00504</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1BM.html#18d6db4af8ee42077741d9e3618153ca" title="Random variable of the posterior.">rv</a>; |
| 328 | <a name="l00506"></a><a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed">00506</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>; |
| 329 | <a name="l00508"></a><a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a">00508</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
| 330 | <a name="l00510"></a><a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee">00510</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>; |
| 331 | <a name="l00511"></a>00511 <span class="keyword">public</span>: |
| 332 | <a name="l00512"></a>00512 |
| 333 | <a name="l00514"></a><a class="code" href="classbdm_1_1BM.html#a33000bb124c32e58742f056ecab4293">00514</a> <a class="code" href="classbdm_1_1BM.html#a33000bb124c32e58742f056ecab4293" title="Default constructor.">BM</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv0, <span class="keywordtype">double</span> ll0=0,<span class="keywordtype">bool</span> evalll0=<span class="keyword">true</span> ) :<a class="code" href="classbdm_1_1BM.html#18d6db4af8ee42077741d9e3618153ca" title="Random variable of the posterior.">rv</a> ( rv0 ), <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( ll0 ),<a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( evalll0 ) {<span class="comment">//Fixme: test rv</span> |
| 334 | <a name="l00515"></a>00515 }; |
| 335 | <a name="l00517"></a><a class="code" href="classbdm_1_1BM.html#241b3701190ff1f729fe873a2eef0055">00517</a> <a class="code" href="classbdm_1_1BM.html#a33000bb124c32e58742f056ecab4293" title="Default constructor.">BM</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> &B ) : <a class="code" href="classbdm_1_1BM.html#18d6db4af8ee42077741d9e3618153ca" title="Random variable of the posterior.">rv</a> ( B.<a class="code" href="classbdm_1_1BM.html#18d6db4af8ee42077741d9e3618153ca" title="Random variable of the posterior.">rv</a> ), <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( B.<a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ), <a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( B.<a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {} |
| 336 | <a name="l00518"></a>00518 |
| 337 | <a name="l00522"></a>00522 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#60b1779a577367c369a932cabd3a6188" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &dt ) = 0; |
| 338 | <a name="l00524"></a>00524 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#1dee3fddaf021e62d925289660a707dc" title="Batch Bayes rule (columns of Dt are observations).">bayesB</a> ( <span class="keyword">const</span> mat &Dt ); |
| 339 | <a name="l00526"></a>00526 <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>& <a class="code" href="classbdm_1_1BM.html#963258c4c2dd05be001003b19aceefef" title="Returns a reference to the epdf representing posterior density on parameters.">_epdf</a>() <span class="keyword">const</span> =0; |
| 340 | <a name="l00527"></a>00527 |
| 341 | <a name="l00529"></a>00529 <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1BM.html#4ed0f8b880e606316ae800f3a011c3a6" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_e</a>() <span class="keyword">const</span> =0; |
| 342 | <a name="l00530"></a>00530 |
| 343 | <a name="l00533"></a><a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">00533</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( <span class="keyword">const</span> vec &dt )<span class="keyword"> const</span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0.0;} |
| 344 | <a name="l00535"></a><a class="code" href="classbdm_1_1BM.html#0e8ebe61fb14990abe1254bd3dda5fae">00535</a> vec <a class="code" href="classbdm_1_1BM.html#0e8ebe61fb14990abe1254bd3dda5fae" title="Matrix version of logpred.">logpred_m</a> ( <span class="keyword">const</span> mat &dt )<span class="keyword"> const</span>{vec tmp ( dt.cols() );<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<dt.cols();i++ ) {tmp ( i ) =<a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( dt.get_col ( i ) );}<span class="keywordflow">return</span> tmp;} |
| 345 | <a name="l00536"></a>00536 |
| 346 | <a name="l00538"></a><a class="code" href="classbdm_1_1BM.html#710e7d69c0d8791fb41a7cd4683cca2c">00538</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1BM.html#710e7d69c0d8791fb41a7cd4683cca2c" title="Constructs a predictive density (marginal density on data).">predictor</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classbdm_1_1BM.html#18d6db4af8ee42077741d9e3618153ca" title="Random variable of the posterior.">rv</a> )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> NULL;}; |
| 347 | <a name="l00539"></a>00539 |
| 348 | <a name="l00541"></a><a class="code" href="classbdm_1_1BM.html#374281cad3caa16fa30609bb4ac16505">00541</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1BM.html#374281cad3caa16fa30609bb4ac16505" title="Destructor for future use;.">~BM</a>() {}; |
| 349 | <a name="l00543"></a><a class="code" href="classbdm_1_1BM.html#40a3c891996391e3135518053a917793">00543</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1BM.html#40a3c891996391e3135518053a917793" title="access function">_rv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#18d6db4af8ee42077741d9e3618153ca" title="Random variable of the posterior.">rv</a>;} |
| 350 | <a name="l00545"></a><a class="code" href="classbdm_1_1BM.html#ff2d8755ba0b3def927d31305c03b09c">00545</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1BM.html#ff2d8755ba0b3def927d31305c03b09c" title="access function">_drv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>;} |
| 351 | <a name="l00547"></a><a class="code" href="classbdm_1_1BM.html#f135ae6dce7e9f30c9f88229c7930b96">00547</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#f135ae6dce7e9f30c9f88229c7930b96" title="set drv">set_drv</a>(<span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classbdm_1_1BM.html#18d6db4af8ee42077741d9e3618153ca" title="Random variable of the posterior.">rv</a>){<a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>=rv;} |
| 352 | <a name="l00549"></a><a class="code" href="classbdm_1_1BM.html#5be65d37dedfe33a3671e7065f523a70">00549</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#5be65d37dedfe33a3671e7065f523a70" title="access function">_ll</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>;} |
| 353 | <a name="l00551"></a><a class="code" href="classbdm_1_1BM.html#236b3abbcc93594fc97cd86d82c1a83f">00551</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#236b3abbcc93594fc97cd86d82c1a83f" title="access function">set_evalll</a> ( <span class="keywordtype">bool</span> evl0 ) {<a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>=evl0;} |
| 354 | <a name="l00552"></a>00552 |
| 355 | <a name="l00555"></a><a class="code" href="classbdm_1_1BM.html#3efb3098172f1f67564a312fe732473e">00555</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a>* <a class="code" href="classbdm_1_1BM.html#3efb3098172f1f67564a312fe732473e">_copy_</a> ( <span class="keywordtype">bool</span> changerv=<span class="keyword">false</span> ) {it_error ( <span class="stringliteral">"function _copy_ not implemented for this BM"</span> ); <span class="keywordflow">return</span> NULL;}; |
| 356 | <a name="l00556"></a>00556 }; |
| 357 | <a name="l00557"></a>00557 |
| 358 | <a name="l00567"></a><a class="code" href="classbdm_1_1BMcond.html">00567</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1BMcond.html" title="Conditional Bayesian Filter.">BMcond</a> :<span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
| 359 | <a name="l00568"></a>00568 <span class="keyword">protected</span>: |
| 360 | <a name="l00570"></a><a class="code" href="classbdm_1_1BMcond.html#9a12750776d977408aada06a70093297">00570</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1BMcond.html#9a12750776d977408aada06a70093297" title="Identificator of the conditioning variable.">rvc</a>; |
| 361 | <a name="l00571"></a>00571 <span class="keyword">public</span>: |
| 362 | <a name="l00573"></a>00573 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BMcond.html#a67bac171f89ef18d0191f8f74189f25" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &val ) =0; |
| 363 | <a name="l00575"></a><a class="code" href="classbdm_1_1BMcond.html#dde99f401cbf2e8e6a926eaa764b457d">00575</a> <a class="code" href="classbdm_1_1BMcond.html#dde99f401cbf2e8e6a926eaa764b457d" title="Default constructor.">BMcond</a> ( <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv0 ) :<a class="code" href="classbdm_1_1BMcond.html#9a12750776d977408aada06a70093297" title="Identificator of the conditioning variable.">rvc</a> ( rv0 ) {}; |
| 364 | <a name="l00577"></a><a class="code" href="classbdm_1_1BMcond.html#7d68d46cfcc36f9cc07a15a5403b5a1a">00577</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1BMcond.html#7d68d46cfcc36f9cc07a15a5403b5a1a" title="Destructor for future use.">~BMcond</a>() {}; |
| 365 | <a name="l00579"></a><a class="code" href="classbdm_1_1BMcond.html#7506910f93250b44fea505ec4ffb19dc">00579</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1BMcond.html#7506910f93250b44fea505ec4ffb19dc" title="access function">_rvc</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BMcond.html#9a12750776d977408aada06a70093297" title="Identificator of the conditioning variable.">rvc</a>;} |
| 366 | <a name="l00580"></a>00580 }; |
| 367 | <a name="l00581"></a>00581 |
| 368 | <a name="l00582"></a>00582 }; <span class="comment">//namespace</span> |
| 369 | <a name="l00584"></a>00584 <span class="comment"></span><span class="preprocessor">#endif // BM_H</span> |