20 | | <a name="l00019"></a>00019 <span class="preprocessor">#ifndef BM_H</span> |
21 | | <a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#define BM_H</span> |
22 | | <a name="l00021"></a>00021 <span class="preprocessor"></span> |
23 | | <a name="l00022"></a>00022 |
24 | | <a name="l00023"></a>00023 <span class="preprocessor">#include "../itpp_ext.h"</span> |
25 | | <a name="l00024"></a>00024 <span class="preprocessor">#include <map></span> |
26 | | <a name="l00025"></a>00025 |
27 | | <a name="l00026"></a>00026 <span class="keyword">namespace </span>bdm { |
28 | | <a name="l00027"></a>00027 <span class="keyword">using namespace </span>itpp; |
29 | | <a name="l00028"></a>00028 <span class="keyword">using namespace </span>std; |
30 | | <a name="l00029"></a>00029 |
31 | | <a name="l00031"></a><a class="code" href="classbdm_1_1bdmroot.html">00031</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
32 | | <a name="l00032"></a>00032 <span class="keyword">public</span>: |
33 | | <a name="l00034"></a><a class="code" href="classbdm_1_1bdmroot.html#9c191bccc52a133d32d84edbc1a19c49">00034</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1bdmroot.html#9c191bccc52a133d32d84edbc1a19c49" title="make sure this is a virtual object">~bdmroot</a>() {} |
34 | | <a name="l00035"></a>00035 }; |
35 | | <a name="l00036"></a>00036 |
36 | | <a name="l00037"></a>00037 <span class="keyword">typedef</span> std::map<string, int> RVmap; |
37 | | <a name="l00038"></a>00038 <span class="keyword">extern</span> ivec RV_SIZES; |
38 | | <a name="l00039"></a>00039 <span class="keyword">extern</span> Array<string> RV_NAMES; |
39 | | <a name="l00040"></a>00040 |
40 | | <a name="l00042"></a><a class="code" href="classbdm_1_1str.html">00042</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1str.html" title="Structure of RV (used internally), i.e. expanded RVs.">str</a> { |
41 | | <a name="l00043"></a>00043 <span class="keyword">public</span>: |
42 | | <a name="l00045"></a><a class="code" href="classbdm_1_1str.html#64675a73fc7324177175f19b3baeb0b0">00045</a> ivec <a class="code" href="classbdm_1_1str.html#64675a73fc7324177175f19b3baeb0b0" title="vector id ids (non-unique!)">ids</a>; |
43 | | <a name="l00047"></a><a class="code" href="classbdm_1_1str.html#905dc0f240e40432c103708c4a34f80a">00047</a> ivec <a class="code" href="classbdm_1_1str.html#905dc0f240e40432c103708c4a34f80a" title="vector of times">times</a>; |
44 | | <a name="l00049"></a><a class="code" href="classbdm_1_1str.html#7c6b9dccc6814d7bd1e8e2208a0d3f3f">00049</a> <a class="code" href="classbdm_1_1str.html#7c6b9dccc6814d7bd1e8e2208a0d3f3f" title="Default constructor.">str</a> ( ivec ids0, ivec times0 ) :<a class="code" href="classbdm_1_1str.html#64675a73fc7324177175f19b3baeb0b0" title="vector id ids (non-unique!)">ids</a> ( ids0 ),<a class="code" href="classbdm_1_1str.html#905dc0f240e40432c103708c4a34f80a" title="vector of times">times</a> ( times0 ) { |
45 | | <a name="l00050"></a>00050 it_assert_debug ( times0.length() ==ids0.length(),<span class="stringliteral">"Incompatible input"</span> ); |
46 | | <a name="l00051"></a>00051 }; |
47 | | <a name="l00052"></a>00052 }; |
48 | | <a name="l00053"></a>00053 |
49 | | <a name="l00092"></a><a class="code" href="classbdm_1_1RV.html">00092</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> :<span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
50 | | <a name="l00093"></a>00093 <span class="keyword">protected</span>: |
51 | | <a name="l00095"></a><a class="code" href="classbdm_1_1RV.html#0cfe477965243a89eb87a06b024e2fcb">00095</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a>; |
52 | | <a name="l00097"></a><a class="code" href="classbdm_1_1RV.html#b11bfdceb831ed30d33b852dd4a6b385">00097</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#b11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a>; |
53 | | <a name="l00099"></a><a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b">00099</a> ivec <a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a>; |
54 | | <a name="l00101"></a><a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896">00101</a> ivec <a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a>; |
55 | | <a name="l00102"></a>00102 |
56 | | <a name="l00103"></a>00103 <span class="keyword">private</span>: |
57 | | <a name="l00105"></a>00105 <span class="keywordtype">void</span> init ( Array<std::string> in_names, ivec in_sizes, ivec in_times ); |
58 | | <a name="l00106"></a>00106 <span class="keywordtype">int</span> init ( <span class="keyword">const</span> <span class="keywordtype">string</span> &name, <span class="keywordtype">int</span> size ); |
59 | | <a name="l00107"></a>00107 <span class="keyword">public</span>: |
60 | | <a name="l00110"></a>00110 |
61 | | <a name="l00112"></a><a class="code" href="classbdm_1_1RV.html#3d93da01a64dab31074b25b7d93e5eae">00112</a> <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> ( Array<std::string> in_names, ivec in_sizes, ivec in_times ) {init ( in_names,in_sizes,in_times );}; |
62 | | <a name="l00114"></a><a class="code" href="classbdm_1_1RV.html#5bd1bd9ec51b91578ecc83a6b2398a20">00114</a> <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> ( Array<std::string> in_names, ivec in_sizes ) {init ( in_names,in_sizes,zeros_i ( in_names.length() ) );}; |
63 | | <a name="l00116"></a><a class="code" href="classbdm_1_1RV.html#a222dfef569e8f123180d40fde97c1cd">00116</a> <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> ( Array<std::string> in_names ) {init ( in_names,ones_i ( in_names.length() ),zeros_i ( in_names.length() ) );} |
64 | | <a name="l00118"></a><a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412">00118</a> <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> () :<a class="code" href="classbdm_1_1RV.html#0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a> ( 0 ),<a class="code" href="classbdm_1_1RV.html#b11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a> ( 0 ),<a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( 0 ),<a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> ( 0 ) {}; |
65 | | <a name="l00120"></a>00120 <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> ( <span class="keywordtype">string</span> name, <span class="keywordtype">int</span> sz, <span class="keywordtype">int</span> tm=0 ); |
66 | | <a name="l00122"></a>00122 |
67 | | <a name="l00125"></a>00125 |
68 | | <a name="l00127"></a>00127 <span class="keyword">friend</span> std::ostream &<a class="code" href="classbdm_1_1RV.html#cad6f15535d10437f6690cb4492176a8" title="Printing output e.g. for debugging.">operator<< </a>( std::ostream &os, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv ); |
69 | | <a name="l00128"></a>00128 <span class="keywordtype">int</span> _dsize()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a>;} ; |
70 | | <a name="l00130"></a>00130 <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#39f9b44752376f07e346579b5ff8cbbd" title="Recount size of the corresponding data vector.">countsize</a>() <span class="keyword">const</span>; |
71 | | <a name="l00131"></a>00131 <span class="keywordtype">int</span> length()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#b11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a>;} ; |
72 | | <a name="l00132"></a>00132 <span class="keywordtype">int</span> id ( <span class="keywordtype">int</span> at )<span class="keyword"> const</span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( at );}; |
73 | | <a name="l00133"></a>00133 <span class="keywordtype">int</span> size ( <span class="keywordtype">int</span> at )<span class="keyword"> const </span>{<span class="keywordflow">return</span> RV_SIZES ( at );}; |
74 | | <a name="l00134"></a>00134 <span class="keywordtype">int</span> time ( <span class="keywordtype">int</span> at )<span class="keyword"> const</span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> ( at );}; |
75 | | <a name="l00135"></a>00135 std::string name ( <span class="keywordtype">int</span> at )<span class="keyword"> const </span>{<span class="keywordflow">return</span> RV_NAMES ( at );}; |
76 | | <a name="l00136"></a>00136 <span class="keywordtype">void</span> set_time ( <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;}; |
77 | | <a name="l00138"></a>00138 |
78 | | <a name="l00139"></a>00139 <span class="comment">//TODO why not inline and later??</span> |
79 | | <a name="l00140"></a>00140 |
80 | | <a name="l00143"></a>00143 |
81 | | <a name="l00145"></a>00145 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#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ) <span class="keyword">const</span>; |
82 | | <a name="l00147"></a>00147 <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#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ) <span class="keyword">const</span>; |
83 | | <a name="l00149"></a>00149 <span class="keywordtype">bool</span> <span class="keyword">add</span> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ); |
84 | | <a name="l00151"></a>00151 <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">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#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ) <span class="keyword">const</span>; |
85 | | <a name="l00153"></a>00153 <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">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>; |
86 | | <a name="l00155"></a><a class="code" href="classbdm_1_1RV.html#6f3daf0f857fff53a1c0a445fe160966">00155</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_1RV.html#6f3daf0f857fff53a1c0a445fe160966" title="Select only variables at indeces ind.">operator() </a>( <span class="keyword">const</span> ivec &ind )<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#c0c04ab99ded62e1e05bcefb151ebeb9" title="Select only variables at indeces ind.">subselect</a> ( ind );}; |
87 | | <a name="l00157"></a>00157 <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 ); |
88 | | <a name="l00159"></a>00159 |
89 | | <a name="l00162"></a>00162 |
90 | | <a name="l00164"></a>00164 <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>; |
91 | | <a name="l00167"></a>00167 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>; |
92 | | <a name="l00170"></a>00170 <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>; |
93 | | <a name="l00172"></a><a class="code" href="classbdm_1_1RV.html#9a5c5aeeaf39299d07763377b05a8241">00172</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> );}; |
94 | | <a name="l00174"></a>00174 |
95 | | <a name="l00175"></a>00175 }; |
96 | | <a name="l00176"></a>00176 |
97 | | <a name="l00177"></a>00177 |
98 | | <a name="l00179"></a>00179 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 ); |
| 60 | <a name="l00013"></a>00013 <span class="preprocessor">#ifndef BM_H</span> |
| 61 | <a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define BM_H</span> |
| 62 | <a name="l00015"></a>00015 <span class="preprocessor"></span> |
| 63 | <a name="l00016"></a>00016 |
| 64 | <a name="l00017"></a>00017 <span class="preprocessor">#include "../itpp_ext.h"</span> |
| 65 | <a name="l00018"></a>00018 <span class="preprocessor">#include <map></span> |
| 66 | <a name="l00019"></a>00019 |
| 67 | <a name="l00020"></a>00020 <span class="keyword">namespace </span>bdm { |
| 68 | <a name="l00021"></a>00021 <span class="keyword">using namespace </span>itpp; |
| 69 | <a name="l00022"></a>00022 <span class="keyword">using namespace </span>std; |
| 70 | <a name="l00023"></a>00023 |
| 71 | <a name="l00025"></a><a class="code" href="classbdm_1_1bdmroot.html">00025</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
| 72 | <a name="l00026"></a>00026 <span class="keyword">public</span>: |
| 73 | <a name="l00028"></a><a class="code" href="classbdm_1_1bdmroot.html#9c191bccc52a133d32d84edbc1a19c49">00028</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1bdmroot.html#9c191bccc52a133d32d84edbc1a19c49" title="make sure this is a virtual object">~bdmroot</a>() {} |
| 74 | <a name="l00029"></a>00029 }; |
| 75 | <a name="l00030"></a>00030 |
| 76 | <a name="l00031"></a>00031 <span class="keyword">typedef</span> std::map<string, int> RVmap; |
| 77 | <a name="l00032"></a>00032 <span class="keyword">extern</span> ivec RV_SIZES; |
| 78 | <a name="l00033"></a>00033 <span class="keyword">extern</span> Array<string> RV_NAMES; |
| 79 | <a name="l00034"></a>00034 |
| 80 | <a name="l00036"></a><a class="code" href="classbdm_1_1str.html">00036</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1str.html" title="Structure of RV (used internally), i.e. expanded RVs.">str</a> { |
| 81 | <a name="l00037"></a>00037 <span class="keyword">public</span>: |
| 82 | <a name="l00039"></a><a class="code" href="classbdm_1_1str.html#64675a73fc7324177175f19b3baeb0b0">00039</a> ivec <a class="code" href="classbdm_1_1str.html#64675a73fc7324177175f19b3baeb0b0" title="vector id ids (non-unique!)">ids</a>; |
| 83 | <a name="l00041"></a><a class="code" href="classbdm_1_1str.html#905dc0f240e40432c103708c4a34f80a">00041</a> ivec <a class="code" href="classbdm_1_1str.html#905dc0f240e40432c103708c4a34f80a" title="vector of times">times</a>; |
| 84 | <a name="l00043"></a><a class="code" href="classbdm_1_1str.html#7c6b9dccc6814d7bd1e8e2208a0d3f3f">00043</a> <a class="code" href="classbdm_1_1str.html#7c6b9dccc6814d7bd1e8e2208a0d3f3f" title="Default constructor.">str</a> ( ivec ids0, ivec times0 ) :<a class="code" href="classbdm_1_1str.html#64675a73fc7324177175f19b3baeb0b0" title="vector id ids (non-unique!)">ids</a> ( ids0 ),<a class="code" href="classbdm_1_1str.html#905dc0f240e40432c103708c4a34f80a" title="vector of times">times</a> ( times0 ) { |
| 85 | <a name="l00044"></a>00044 it_assert_debug ( times0.length() ==ids0.length(),<span class="stringliteral">"Incompatible input"</span> ); |
| 86 | <a name="l00045"></a>00045 }; |
| 87 | <a name="l00046"></a>00046 }; |
| 88 | <a name="l00047"></a>00047 |
| 89 | <a name="l00086"></a><a class="code" href="classbdm_1_1RV.html">00086</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> :<span class="keyword">public</span> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
| 90 | <a name="l00087"></a>00087 <span class="keyword">protected</span>: |
| 91 | <a name="l00089"></a><a class="code" href="classbdm_1_1RV.html#0cfe477965243a89eb87a06b024e2fcb">00089</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a>; |
| 92 | <a name="l00091"></a><a class="code" href="classbdm_1_1RV.html#b11bfdceb831ed30d33b852dd4a6b385">00091</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#b11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a>; |
| 93 | <a name="l00093"></a><a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b">00093</a> ivec <a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a>; |
| 94 | <a name="l00095"></a><a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896">00095</a> ivec <a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a>; |
| 95 | <a name="l00096"></a>00096 |
| 96 | <a name="l00097"></a>00097 <span class="keyword">private</span>: |
| 97 | <a name="l00099"></a>00099 <span class="keywordtype">void</span> init ( Array<std::string> in_names, ivec in_sizes, ivec in_times ); |
| 98 | <a name="l00100"></a>00100 <span class="keywordtype">int</span> init ( <span class="keyword">const</span> <span class="keywordtype">string</span> &name, <span class="keywordtype">int</span> size ); |
| 99 | <a name="l00101"></a>00101 <span class="keyword">public</span>: |
| 100 | <a name="l00104"></a>00104 |
| 101 | <a name="l00106"></a><a class="code" href="classbdm_1_1RV.html#3d93da01a64dab31074b25b7d93e5eae">00106</a> <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> ( Array<std::string> in_names, ivec in_sizes, ivec in_times ) {init ( in_names,in_sizes,in_times );}; |
| 102 | <a name="l00108"></a><a class="code" href="classbdm_1_1RV.html#5bd1bd9ec51b91578ecc83a6b2398a20">00108</a> <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> ( Array<std::string> in_names, ivec in_sizes ) {init ( in_names,in_sizes,zeros_i ( in_names.length() ) );}; |
| 103 | <a name="l00110"></a><a class="code" href="classbdm_1_1RV.html#a222dfef569e8f123180d40fde97c1cd">00110</a> <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> ( Array<std::string> in_names ) {init ( in_names,ones_i ( in_names.length() ),zeros_i ( in_names.length() ) );} |
| 104 | <a name="l00112"></a><a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412">00112</a> <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> () :<a class="code" href="classbdm_1_1RV.html#0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a> ( 0 ),<a class="code" href="classbdm_1_1RV.html#b11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a> ( 0 ),<a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( 0 ),<a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> ( 0 ) {}; |
| 105 | <a name="l00114"></a>00114 <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> ( <span class="keywordtype">string</span> name, <span class="keywordtype">int</span> sz, <span class="keywordtype">int</span> tm=0 ); |
| 106 | <a name="l00116"></a>00116 |
| 107 | <a name="l00119"></a>00119 |
| 108 | <a name="l00121"></a>00121 <span class="keyword">friend</span> std::ostream &<a class="code" href="classbdm_1_1RV.html#cad6f15535d10437f6690cb4492176a8" title="Printing output e.g. for debugging.">operator<< </a>( std::ostream &os, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv ); |
| 109 | <a name="l00122"></a>00122 <span class="keywordtype">int</span> _dsize()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a>;} ; |
| 110 | <a name="l00124"></a>00124 <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#39f9b44752376f07e346579b5ff8cbbd" title="Recount size of the corresponding data vector.">countsize</a>() <span class="keyword">const</span>; |
| 111 | <a name="l00125"></a>00125 ivec cumsizes() <span class="keyword">const</span>; |
| 112 | <a name="l00126"></a>00126 <span class="keywordtype">int</span> length()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#b11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a>;} ; |
| 113 | <a name="l00127"></a>00127 <span class="keywordtype">int</span> id ( <span class="keywordtype">int</span> at )<span class="keyword"> const</span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( at );}; |
| 114 | <a name="l00128"></a>00128 <span class="keywordtype">int</span> size ( <span class="keywordtype">int</span> at )<span class="keyword"> const </span>{<span class="keywordflow">return</span> RV_SIZES ( <a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a>(at) );}; |
| 115 | <a name="l00129"></a>00129 <span class="keywordtype">int</span> time ( <span class="keywordtype">int</span> at )<span class="keyword"> const</span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> ( at );}; |
| 116 | <a name="l00130"></a>00130 std::string name ( <span class="keywordtype">int</span> at )<span class="keyword"> const </span>{<span class="keywordflow">return</span> RV_NAMES ( <a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a>(at) );}; |
| 117 | <a name="l00131"></a>00131 <span class="keywordtype">void</span> set_time ( <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;}; |
| 118 | <a name="l00133"></a>00133 |
| 119 | <a name="l00134"></a>00134 <span class="comment">//TODO why not inline and later??</span> |
| 120 | <a name="l00135"></a>00135 |
| 121 | <a name="l00138"></a>00138 |
| 122 | <a name="l00140"></a>00140 ivec <a class="code" href="classbdm_1_1RV.html#1367055b2608ad9d50d01a2da6cec869" title="Find indices of self in another rv,.">findself</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 123 | <a name="l00142"></a>00142 <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#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 124 | <a name="l00144"></a>00144 <span class="keywordtype">bool</span> <span class="keyword">add</span> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ); |
| 125 | <a name="l00146"></a>00146 <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">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#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 126 | <a name="l00148"></a>00148 <a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">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>; |
| 127 | <a name="l00150"></a><a class="code" href="classbdm_1_1RV.html#6f3daf0f857fff53a1c0a445fe160966">00150</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_1RV.html#6f3daf0f857fff53a1c0a445fe160966" title="Select only variables at indeces ind.">operator() </a>( <span class="keyword">const</span> ivec &ind )<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#c0c04ab99ded62e1e05bcefb151ebeb9" title="Select only variables at indeces ind.">subselect</a> ( ind );}; |
| 128 | <a name="l00152"></a><a class="code" href="classbdm_1_1RV.html#452fb5f7ab1eafe17932bf9f458d0415">00152</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_1RV.html#6f3daf0f857fff53a1c0a445fe160966" title="Select only variables at indeces ind.">operator() </a>( <span class="keywordtype">int</span> di1, <span class="keywordtype">int</span> di2 )<span class="keyword"> const </span>{ |
| 129 | <a name="l00153"></a>00153 ivec sz=cumsizes(); |
| 130 | <a name="l00154"></a>00154 <span class="keywordtype">int</span> i1=0; |
| 131 | <a name="l00155"></a>00155 <span class="keywordflow">while</span> ( sz ( i1 ) <di1 ) i1++; |
| 132 | <a name="l00156"></a>00156 <span class="keywordtype">int</span> i2=i1; |
| 133 | <a name="l00157"></a>00157 <span class="keywordflow">while</span> ( sz ( i2 ) <di2 ) i2++; |
| 134 | <a name="l00158"></a>00158 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#c0c04ab99ded62e1e05bcefb151ebeb9" title="Select only variables at indeces ind.">subselect</a> ( linspace ( i1,i2 ) ); |
| 135 | <a name="l00159"></a>00159 }; |
| 136 | <a name="l00161"></a>00161 <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 ); |
| 137 | <a name="l00163"></a>00163 |
| 138 | <a name="l00166"></a>00166 |
| 139 | <a name="l00168"></a>00168 <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>; |
| 140 | <a name="l00171"></a>00171 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>; |
| 141 | <a name="l00174"></a>00174 <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>; |
| 142 | <a name="l00176"></a><a class="code" href="classbdm_1_1RV.html#9a5c5aeeaf39299d07763377b05a8241">00176</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> );}; |
| 143 | <a name="l00178"></a>00178 |
| 144 | <a name="l00179"></a>00179 }; |
120 | | <a name="l00209"></a><a class="code" href="classbdm_1_1epdf.html">00209</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> { |
121 | | <a name="l00210"></a>00210 <span class="keyword">protected</span>: |
122 | | <a name="l00212"></a><a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce">00212</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>; |
123 | | <a name="l00214"></a><a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8">00214</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="Description of the random variable.">rv</a>; |
124 | | <a name="l00215"></a>00215 |
125 | | <a name="l00216"></a>00216 <span class="keyword">public</span>: |
126 | | <a name="l00225"></a>00225 <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#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>(0),<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ( ) {}; |
127 | | <a name="l00226"></a>00226 <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</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> &e) :<a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>(e.<a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>),<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> (e.<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>) {}; |
128 | | <a name="l00228"></a>00228 |
129 | | <a name="l00231"></a>00231 |
130 | | <a name="l00233"></a>00233 <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="l00235"></a>00235 <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="l00237"></a>00237 <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="l00239"></a><a class="code" href="classbdm_1_1epdf.html#34956d4dd3176eeb5937cf48a1546b62">00239</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>{ |
134 | | <a name="l00240"></a>00240 vec x ( Val.cols() ); |
135 | | <a name="l00241"></a>00241 <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 ) ) ;} |
136 | | <a name="l00242"></a>00242 <span class="keywordflow">return</span> x; |
137 | | <a name="l00243"></a>00243 } |
138 | | <a name="l00245"></a><a class="code" href="classbdm_1_1epdf.html#e584eac5579c1b6384947ecf66166c77">00245</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="Description 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;} |
139 | | <a name="l00247"></a><a class="code" href="classbdm_1_1epdf.html#3fb2ece54f720b62ad325e61214fa0a1">00247</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="Description 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="l00249"></a>00249 <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; |
141 | | <a name="l00251"></a>00251 <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; |
142 | | <a name="l00253"></a>00253 |
143 | | <a name="l00259"></a>00259 |
144 | | <a name="l00261"></a><a class="code" href="classbdm_1_1epdf.html#f423e28448dbb69ef4905295ec8de8ff">00261</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1epdf.html#f423e28448dbb69ef4905295ec8de8ff" title="Name its rv.">set_rv</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="Description of the random variable.">rv</a> = rv0; it_assert_debug(<a class="code" href="classbdm_1_1epdf.html#c4b863ff84c7a4882fb3ad18556027f9" title="True if rv is assigned.">isnamed</a>(),<span class="stringliteral">""</span>); }; |
145 | | <a name="l00263"></a><a class="code" href="classbdm_1_1epdf.html#c4b863ff84c7a4882fb3ad18556027f9">00263</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1epdf.html#c4b863ff84c7a4882fb3ad18556027f9" title="True if rv is assigned.">isnamed</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>==<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() );} |
146 | | <a name="l00265"></a><a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21">00265</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="Return name (fails when isnamed is false).">_rv</a>()<span class="keyword"> const </span>{it_assert_debug ( <a class="code" href="classbdm_1_1epdf.html#c4b863ff84c7a4882fb3ad18556027f9" title="True if rv is assigned.">isnamed</a>(),<span class="stringliteral">""</span> ); <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>;} |
147 | | <a name="l00267"></a>00267 |
148 | | <a name="l00270"></a>00270 |
149 | | <a name="l00272"></a><a class="code" href="classbdm_1_1epdf.html#46dfe100cd621716ee5c7ee25a20f24b">00272</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1epdf.html#46dfe100cd621716ee5c7ee25a20f24b" title="Size of the random variable.">dimension</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>;} |
150 | | <a name="l00274"></a>00274 |
151 | | <a name="l00275"></a>00275 }; |
| 166 | <a name="l00209"></a>00209 <span class="keyword">class </span>mpdf; |
| 167 | <a name="l00210"></a>00210 |
| 168 | <a name="l00212"></a>00212 |
| 169 | <a name="l00213"></a><a class="code" href="classbdm_1_1epdf.html">00213</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> { |
| 170 | <a name="l00214"></a>00214 <span class="keyword">protected</span>: |
| 171 | <a name="l00216"></a><a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce">00216</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>; |
| 172 | <a name="l00218"></a><a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8">00218</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="Description of the random variable.">rv</a>; |
| 173 | <a name="l00219"></a>00219 |
| 174 | <a name="l00220"></a>00220 <span class="keyword">public</span>: |
| 175 | <a name="l00232"></a>00232 <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#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> ( 0 ),<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ( ) {}; |
| 176 | <a name="l00233"></a>00233 <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</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> &e ) :<a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> ( e.<a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> ),<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ( e.<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ) {}; |
| 177 | <a name="l00234"></a>00234 epdf ( <span class="keyword">const</span> RV &rv0 ) {<a class="code" href="classbdm_1_1epdf.html#f423e28448dbb69ef4905295ec8de8ff" title="Name its rv.">set_rv</a> ( rv0 );}; |
| 178 | <a name="l00235"></a>00235 <span class="keywordtype">void</span> set_parameters ( <span class="keywordtype">int</span> dim0 ) {<a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>=dim0;} |
| 179 | <a name="l00237"></a>00237 |
| 180 | <a name="l00240"></a>00240 |
| 181 | <a name="l00242"></a><a class="code" href="classbdm_1_1epdf.html#75ba57a89681a8efec488f5796c7cc1b">00242</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#75ba57a89681a8efec488f5796c7cc1b" title="Returns a sample, from density .">sample</a> ()<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"not implemneted"</span> );<span class="keywordflow">return</span> vec ( 0 );}; |
| 182 | <a name="l00244"></a>00244 <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>; |
| 183 | <a name="l00246"></a><a class="code" href="classbdm_1_1epdf.html#deab266d63c236c277538867d5c3f249">00246</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1epdf.html#deab266d63c236c277538867d5c3f249" title="Compute log-probability of argument val.">evallog</a> ( <span class="keyword">const</span> vec &val )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"not implemneted"</span> );<span class="keywordflow">return</span> 0.0;}; |
| 184 | <a name="l00248"></a><a class="code" href="classbdm_1_1epdf.html#34956d4dd3176eeb5937cf48a1546b62">00248</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>{ |
| 185 | <a name="l00249"></a>00249 vec x ( Val.cols() ); |
| 186 | <a name="l00250"></a>00250 <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#deab266d63c236c277538867d5c3f249" title="Compute log-probability of argument val.">evallog</a> ( Val.get_col ( i ) ) ;} |
| 187 | <a name="l00251"></a>00251 <span class="keywordflow">return</span> x; |
| 188 | <a name="l00252"></a>00252 } |
| 189 | <a name="l00254"></a><a class="code" href="classbdm_1_1epdf.html#e584eac5579c1b6384947ecf66166c77">00254</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="Description 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;} |
| 190 | <a name="l00256"></a><a class="code" href="classbdm_1_1epdf.html#3fb2ece54f720b62ad325e61214fa0a1">00256</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="Description 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;} |
| 191 | <a name="l00258"></a><a class="code" href="classbdm_1_1epdf.html#0c8d13d788094605b3cdab20a6e22b75">00258</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#0c8d13d788094605b3cdab20a6e22b75" title="return expected value">mean</a>()<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"not implemneted"</span> );<span class="keywordflow">return</span> vec ( 0 );}; |
| 192 | <a name="l00260"></a><a class="code" href="classbdm_1_1epdf.html#4543d40ccfc5d549b0c831a57a3ed84c">00260</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#4543d40ccfc5d549b0c831a57a3ed84c" title="return expected variance (not covariance!)">variance</a>()<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"not implemneted"</span> );<span class="keywordflow">return</span> vec ( 0 );}; |
| 193 | <a name="l00262"></a>00262 |
| 194 | <a name="l00268"></a>00268 |
| 195 | <a name="l00270"></a><a class="code" href="classbdm_1_1epdf.html#f423e28448dbb69ef4905295ec8de8ff">00270</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1epdf.html#f423e28448dbb69ef4905295ec8de8ff" title="Name its rv.">set_rv</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="Description of the random variable.">rv</a> = rv0; }<span class="comment">//it_assert_debug(isnamed(),""); };</span> |
| 196 | <a name="l00272"></a><a class="code" href="classbdm_1_1epdf.html#c4b863ff84c7a4882fb3ad18556027f9">00272</a> <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1epdf.html#c4b863ff84c7a4882fb3ad18556027f9" title="True if rv is assigned.">isnamed</a>()<span class="keyword"> const </span>{<span class="keywordtype">bool</span> b= ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>==<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() );<span class="keywordflow">return</span> b;} |
| 197 | <a name="l00274"></a><a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21">00274</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="Return name (fails when isnamed is false).">_rv</a>()<span class="keyword"> const </span>{it_assert_debug ( <a class="code" href="classbdm_1_1epdf.html#c4b863ff84c7a4882fb3ad18556027f9" title="True if rv is assigned.">isnamed</a>(),<span class="stringliteral">""</span> ); <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>;} |
153 | | <a name="l00277"></a>00277 |
154 | | <a name="l00279"></a>00279 <span class="comment">//TODO Samplecond can be generalized</span> |
155 | | <a name="l00280"></a>00280 |
156 | | <a name="l00281"></a><a class="code" href="classbdm_1_1mpdf.html">00281</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> { |
157 | | <a name="l00282"></a>00282 <span class="keyword">protected</span>: |
158 | | <a name="l00284"></a><a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6">00284</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>; |
159 | | <a name="l00286"></a><a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288">00286</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>; |
160 | | <a name="l00288"></a><a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0">00288</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>; |
161 | | <a name="l00289"></a>00289 <span class="keyword">public</span>: |
162 | | <a name="l00292"></a>00292 |
163 | | <a name="l00293"></a>00293 <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_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>(0),<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> ( ) {}; |
164 | | <a name="l00295"></a><a class="code" href="classbdm_1_1mpdf.html#7089fcbd918f201fdf4256119e31f173">00295</a> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> (<span class="keyword">const</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> &m ) :<a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>(m.<a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>),<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> (m.<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> ) {}; |
165 | | <a name="l00297"></a>00297 |
166 | | <a name="l00300"></a>00300 |
167 | | <a name="l00302"></a><a class="code" href="classbdm_1_1mpdf.html#f0c1db6fcbb3aae2dd6123884457a367">00302</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 ) { |
168 | | <a name="l00303"></a>00303 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="l00304"></a>00304 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>(); |
170 | | <a name="l00305"></a>00305 <span class="keywordflow">return</span> temp; |
171 | | <a name="l00306"></a>00306 }; |
172 | | <a name="l00308"></a><a class="code" href="classbdm_1_1mpdf.html#afe4185b26baeb03688202e254d3b005">00308</a> <span class="keyword">virtual</span> mat <a class="code" href="classbdm_1_1mpdf.html#afe4185b26baeb03688202e254d3b005" title="Returns.">samplecond_m</a> ( <span class="keyword">const</span> vec &cond, <span class="keywordtype">int</span> N ) { |
173 | | <a name="l00309"></a>00309 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 ); |
174 | | <a name="l00310"></a>00310 mat 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#46dfe100cd621716ee5c7ee25a20f24b" title="Size of the random variable.">dimension</a>(),N ); vec 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#46dfe100cd621716ee5c7ee25a20f24b" title="Size of the random variable.">dimension</a>() ); |
175 | | <a name="l00311"></a>00311 <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 );} |
176 | | <a name="l00312"></a>00312 <span class="keywordflow">return</span> temp; |
177 | | <a name="l00313"></a>00313 }; |
178 | | <a name="l00315"></a><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530">00315</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> );}; |
179 | | <a name="l00316"></a>00316 |
180 | | <a name="l00318"></a><a class="code" href="classbdm_1_1mpdf.html#6336a8a72462e2a56a3989a220f18b1b">00318</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 ) { |
181 | | <a name="l00319"></a>00319 <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; |
182 | | <a name="l00320"></a>00320 }; |
183 | | <a name="l00321"></a>00321 |
184 | | <a name="l00323"></a><a class="code" href="classbdm_1_1mpdf.html#0b0ed1ed663071bb7cf4a1349eb94fcb">00323</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 );}; |
185 | | <a name="l00324"></a>00324 |
186 | | <a name="l00327"></a>00327 |
187 | | <a name="l00328"></a>00328 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> _rv() {<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#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>();} |
188 | | <a name="l00329"></a>00329 RV _rvc() {it_assert_debug ( isnamed(),<span class="stringliteral">""</span> ); <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>;} |
189 | | <a name="l00330"></a>00330 <span class="keywordtype">int</span> dimension() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>->dimension();} |
190 | | <a name="l00331"></a>00331 <span class="keywordtype">int</span> dimensionc() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>;} |
191 | | <a name="l00332"></a>00332 epdf& _epdf() {<span class="keywordflow">return</span> *<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>;} |
192 | | <a name="l00333"></a>00333 epdf* _e() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>;} |
193 | | <a name="l00335"></a>00335 |
194 | | <a name="l00338"></a>00338 <span class="keywordtype">void</span> set_rvc ( <span class="keyword">const</span> RV &rvc0 ) {<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>=rvc0;} |
195 | | <a name="l00339"></a>00339 <span class="keywordtype">void</span> set_rv ( <span class="keyword">const</span> RV &rv0 ) {<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>->set_rv(rv0);} |
196 | | <a name="l00340"></a>00340 <span class="keywordtype">bool</span> isnamed() {<span class="keywordflow">return</span> (<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>->isnamed())&&(<a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>=<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>._dsize());} |
197 | | <a name="l00342"></a>00342 }; |
198 | | <a name="l00343"></a>00343 |
199 | | <a name="l00369"></a><a class="code" href="classbdm_1_1datalink.html">00369</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink.html" title="DataLink is a connection between two data vectors Up and Down.">datalink</a> { |
200 | | <a name="l00370"></a>00370 <span class="keyword">protected</span>: |
201 | | <a name="l00372"></a><a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c">00372</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>; |
202 | | <a name="l00374"></a><a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045">00374</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a>; |
203 | | <a name="l00376"></a><a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb">00376</a> ivec <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>; |
204 | | <a name="l00377"></a>00377 <span class="keyword">public</span>: |
205 | | <a name="l00379"></a><a class="code" href="classbdm_1_1datalink.html#4016403730eb742462614d60393565cd">00379</a> <a class="code" href="classbdm_1_1datalink.html#4016403730eb742462614d60393565cd" title="Constructor.">datalink</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 ) : |
206 | | <a name="l00380"></a>00380 <a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a> ( rv._dsize() ), <a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a> ( rv_up._dsize() ), <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a> ( rv.dataind ( rv_up ) ) { |
207 | | <a name="l00381"></a>00381 it_assert_debug ( <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>.length() ==<a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>,<span class="stringliteral">"rv is not fully in rv_up"</span> ); |
208 | | <a name="l00382"></a>00382 } |
209 | | <a name="l00384"></a><a class="code" href="classbdm_1_1datalink.html#5b5368c3899eed2f670d09142c2548e5">00384</a> vec <a class="code" href="classbdm_1_1datalink.html#5b5368c3899eed2f670d09142c2548e5" title="Get val for myself from val of &quot;Up&quot;.">pushdown</a> ( <span class="keyword">const</span> vec &val_up ) { |
210 | | <a name="l00385"></a>00385 it_assert_debug ( <a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
211 | | <a name="l00386"></a>00386 <span class="keywordflow">return</span> get_vec ( val_up,<a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a> ); |
212 | | <a name="l00387"></a>00387 } |
213 | | <a name="l00389"></a><a class="code" href="classbdm_1_1datalink.html#610e966f2edb1fcd6a5b28267c571793">00389</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink.html#610e966f2edb1fcd6a5b28267c571793" title="Fill val of &quot;Up&quot; by my pieces.">pushup</a> ( vec &val_up, <span class="keyword">const</span> vec &val ) { |
214 | | <a name="l00390"></a>00390 it_assert_debug ( <a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>==val.length(),<span class="stringliteral">"Wrong val"</span> ); |
215 | | <a name="l00391"></a>00391 it_assert_debug ( <a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
216 | | <a name="l00392"></a>00392 set_subvector ( val_up, <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>, val ); |
217 | | <a name="l00393"></a>00393 } |
218 | | <a name="l00394"></a>00394 }; |
| 199 | <a name="l00279"></a>00279 |
| 200 | <a name="l00281"></a><a class="code" href="classbdm_1_1epdf.html#7083a65f7b7a0d0d13b2c516bd2ec29c">00281</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1epdf.html#7083a65f7b7a0d0d13b2c516bd2ec29c" title="Size of the random variable.">dimension</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>;} |
| 201 | <a name="l00283"></a>00283 |
| 202 | <a name="l00284"></a>00284 }; |
| 203 | <a name="l00285"></a>00285 |
| 204 | <a name="l00286"></a>00286 |
| 205 | <a name="l00288"></a>00288 <span class="comment">//TODO Samplecond can be generalized</span> |
| 206 | <a name="l00289"></a>00289 |
| 207 | <a name="l00290"></a><a class="code" href="classbdm_1_1mpdf.html">00290</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> { |
| 208 | <a name="l00291"></a>00291 <span class="keyword">protected</span>: |
| 209 | <a name="l00293"></a><a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6">00293</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>; |
| 210 | <a name="l00295"></a><a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288">00295</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>; |
| 211 | <a name="l00297"></a><a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0">00297</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>; |
| 212 | <a name="l00298"></a>00298 <span class="keyword">public</span>: |
| 213 | <a name="l00301"></a>00301 |
| 214 | <a name="l00302"></a>00302 <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_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> ( 0 ),<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> ( ) {}; |
| 215 | <a name="l00304"></a><a class="code" href="classbdm_1_1mpdf.html#7089fcbd918f201fdf4256119e31f173">00304</a> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> &m ) :<a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> ( m.<a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> ),<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> ( m.<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> ) {}; |
| 216 | <a name="l00306"></a>00306 |
| 217 | <a name="l00309"></a>00309 |
| 218 | <a name="l00311"></a><a class="code" href="classbdm_1_1mpdf.html#f0c1db6fcbb3aae2dd6123884457a367">00311</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 ) { |
| 219 | <a name="l00312"></a>00312 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 ); |
| 220 | <a name="l00313"></a>00313 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#75ba57a89681a8efec488f5796c7cc1b" title="Returns a sample, from density .">sample</a>(); |
| 221 | <a name="l00314"></a>00314 <span class="keywordflow">return</span> temp; |
| 222 | <a name="l00315"></a>00315 }; |
| 223 | <a name="l00317"></a><a class="code" href="classbdm_1_1mpdf.html#afe4185b26baeb03688202e254d3b005">00317</a> <span class="keyword">virtual</span> mat <a class="code" href="classbdm_1_1mpdf.html#afe4185b26baeb03688202e254d3b005" title="Returns.">samplecond_m</a> ( <span class="keyword">const</span> vec &cond, <span class="keywordtype">int</span> N ) { |
| 224 | <a name="l00318"></a>00318 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 ); |
| 225 | <a name="l00319"></a>00319 mat 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#7083a65f7b7a0d0d13b2c516bd2ec29c" title="Size of the random variable.">dimension</a>(),N ); vec 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#7083a65f7b7a0d0d13b2c516bd2ec29c" title="Size of the random variable.">dimension</a>() ); |
| 226 | <a name="l00320"></a>00320 <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#75ba57a89681a8efec488f5796c7cc1b" title="Returns a sample, from density .">sample</a>() ;temp.set_col ( i, smp );} |
| 227 | <a name="l00321"></a>00321 <span class="keywordflow">return</span> temp; |
| 228 | <a name="l00322"></a>00322 }; |
| 229 | <a name="l00324"></a><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530">00324</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> );}; |
| 230 | <a name="l00325"></a>00325 |
| 231 | <a name="l00327"></a><a class="code" href="classbdm_1_1mpdf.html#6336a8a72462e2a56a3989a220f18b1b">00327</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 ) { |
| 232 | <a name="l00328"></a>00328 <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#deab266d63c236c277538867d5c3f249" 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; |
| 233 | <a name="l00329"></a>00329 }; |
| 234 | <a name="l00330"></a>00330 |
| 235 | <a name="l00332"></a><a class="code" href="classbdm_1_1mpdf.html#0b0ed1ed663071bb7cf4a1349eb94fcb">00332</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 );}; |
| 236 | <a name="l00333"></a>00333 |
| 237 | <a name="l00336"></a>00336 |
| 238 | <a name="l00337"></a>00337 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> _rv() {<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#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>();} |
| 239 | <a name="l00338"></a>00338 RV _rvc() {it_assert_debug ( isnamed(),<span class="stringliteral">""</span> ); <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>;} |
| 240 | <a name="l00339"></a>00339 <span class="keywordtype">int</span> dimension() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>->dimension();} |
| 241 | <a name="l00340"></a>00340 <span class="keywordtype">int</span> dimensionc() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>;} |
| 242 | <a name="l00341"></a>00341 epdf& _epdf() {<span class="keywordflow">return</span> *<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>;} |
| 243 | <a name="l00342"></a>00342 epdf* _e() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>;} |
| 244 | <a name="l00344"></a>00344 |
| 245 | <a name="l00347"></a>00347 <span class="keywordtype">void</span> set_rvc ( <span class="keyword">const</span> RV &rvc0 ) {<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>=rvc0;} |
| 246 | <a name="l00348"></a>00348 <span class="keywordtype">void</span> set_rv ( <span class="keyword">const</span> RV &rv0 ) {<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>->set_rv ( rv0 );} |
| 247 | <a name="l00349"></a>00349 <span class="keywordtype">bool</span> isnamed() {<span class="keywordflow">return</span> ( <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>->isnamed() ) && ( <a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>==<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>._dsize() );} |
| 248 | <a name="l00351"></a>00351 }; |
| 249 | <a name="l00352"></a>00352 |
| 250 | <a name="l00378"></a><a class="code" href="classbdm_1_1datalink.html">00378</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink.html" title="DataLink is a connection between two data vectors Up and Down.">datalink</a> { |
| 251 | <a name="l00379"></a>00379 <span class="keyword">protected</span>: |
| 252 | <a name="l00381"></a><a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c">00381</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>; |
| 253 | <a name="l00383"></a><a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045">00383</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a>; |
| 254 | <a name="l00385"></a><a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb">00385</a> ivec <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>; |
| 255 | <a name="l00386"></a>00386 <span class="keyword">public</span>: |
| 256 | <a name="l00388"></a><a class="code" href="classbdm_1_1datalink.html#b8b5d5074fc1310a37c3713d58b900e2">00388</a> <a class="code" href="classbdm_1_1datalink.html#b8b5d5074fc1310a37c3713d58b900e2" title="Constructor.">datalink</a> () {}; |
| 257 | <a name="l00389"></a>00389 <a class="code" href="classbdm_1_1datalink.html#b8b5d5074fc1310a37c3713d58b900e2" title="Constructor.">datalink</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 ) {<a class="code" href="classbdm_1_1datalink.html#fb8337aac8329eb0ca96bfb3ff73ec67" title="set connection, rv must be fully present in rv_up">set_connection</a> ( rv,rv_up );}; |
| 258 | <a name="l00391"></a><a class="code" href="classbdm_1_1datalink.html#fb8337aac8329eb0ca96bfb3ff73ec67">00391</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink.html#fb8337aac8329eb0ca96bfb3ff73ec67" title="set connection, rv must be fully present in rv_up">set_connection</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 ) { |
| 259 | <a name="l00392"></a>00392 <a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a> = rv.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(); |
| 260 | <a name="l00393"></a>00393 <a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a> = rv_up.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(); |
| 261 | <a name="l00394"></a>00394 <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>= ( rv.<a class="code" href="classbdm_1_1RV.html#cbebdb5e0d30101a6eb63550ef701c55">dataind</a> ( rv_up ) ); |
220 | | <a name="l00397"></a><a class="code" href="classbdm_1_1datalink__m2e.html">00397</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> <a class="code" href="classbdm_1_1datalink.html" title="DataLink is a connection between two data vectors Up and Down.">datalink</a> { |
221 | | <a name="l00398"></a>00398 <span class="keyword">protected</span>: |
222 | | <a name="l00400"></a><a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9">00400</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>; |
223 | | <a name="l00402"></a><a class="code" href="classbdm_1_1datalink__m2e.html#43fe3e2d7aa04134053ec15793722783">00402</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>; |
224 | | <a name="l00404"></a><a class="code" href="classbdm_1_1datalink__m2e.html#9e0048d87bda78e9b8d38761440c7abc">00404</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>; |
225 | | <a name="l00405"></a>00405 |
226 | | <a name="l00406"></a>00406 <span class="keyword">public</span>: |
227 | | <a name="l00408"></a><a class="code" href="classbdm_1_1datalink__m2e.html#31bb5b6cd04b4d99a02fc8d1ad5ce202">00408</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 ) : |
228 | | <a name="l00409"></a>00409 <a class="code" href="classbdm_1_1datalink.html" title="DataLink is a connection between two data vectors Up and Down.">datalink</a> ( rv,rv_up ), <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ( rvc._dsize() ) { |
229 | | <a name="l00410"></a>00410 <span class="comment">//establish v2c connection</span> |
230 | | <a name="l00411"></a>00411 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> ); |
231 | | <a name="l00412"></a>00412 } |
232 | | <a name="l00414"></a><a class="code" href="classbdm_1_1datalink__m2e.html#7ba850822e3cf9a4b079afc7e7c01703">00414</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 ) { |
233 | | <a name="l00415"></a>00415 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
234 | | <a name="l00416"></a>00416 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> ) ); |
235 | | <a name="l00417"></a>00417 <span class="keywordflow">return</span> tmp; |
236 | | <a name="l00418"></a>00418 } |
237 | | <a name="l00419"></a>00419 <span class="keywordtype">void</span> pushup_cond ( vec &val_up, <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ) { |
238 | | <a name="l00420"></a>00420 it_assert_debug ( <a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>==val.length(),<span class="stringliteral">"Wrong val"</span> ); |
239 | | <a name="l00421"></a>00421 it_assert_debug ( <a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
240 | | <a name="l00422"></a>00422 set_subvector ( val_up, <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>, val ); |
241 | | <a name="l00423"></a>00423 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 ); |
242 | | <a name="l00424"></a>00424 } |
243 | | <a name="l00425"></a>00425 }; |
244 | | <a name="l00428"></a><a class="code" href="classbdm_1_1datalink__m2m.html">00428</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> { |
245 | | <a name="l00429"></a>00429 <span class="keyword">protected</span>: |
246 | | <a name="l00431"></a><a class="code" href="classbdm_1_1datalink__m2m.html#d64dda6f92654628276bbcebb7600d0d">00431</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>; |
247 | | <a name="l00433"></a><a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5">00433</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>; |
248 | | <a name="l00434"></a>00434 <span class="keyword">public</span>: |
249 | | <a name="l00436"></a><a class="code" href="classbdm_1_1datalink__m2m.html#540c4b60686fdf1a7915300ae11bc41b">00436</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 ) : |
250 | | <a name="l00437"></a>00437 <a class="code" href="classbdm_1_1datalink__m2e.html" title="data link between">datalink_m2e</a> ( rv, rvc, rv_up ) { |
251 | | <a name="l00438"></a>00438 <span class="comment">//establish c2c connection</span> |
252 | | <a name="l00439"></a>00439 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> ); |
253 | | <a name="l00440"></a>00440 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> ); |
254 | | <a name="l00441"></a>00441 } |
255 | | <a name="l00443"></a><a class="code" href="classbdm_1_1datalink__m2m.html#911fb7fcfa80d4e31db8e0cc03141a90">00443</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 ) { |
256 | | <a name="l00444"></a>00444 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
257 | | <a name="l00445"></a>00445 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> ) ); |
258 | | <a name="l00446"></a>00446 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> ) ); |
259 | | <a name="l00447"></a>00447 <span class="keywordflow">return</span> tmp; |
260 | | <a name="l00448"></a>00448 } |
261 | | <a name="l00450"></a>00450 |
262 | | <a name="l00451"></a>00451 }; |
263 | | <a name="l00452"></a>00452 |
264 | | <a name="l00458"></a><a class="code" href="classbdm_1_1logger.html">00458</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> { |
265 | | <a name="l00459"></a>00459 <span class="keyword">protected</span>: |
266 | | <a name="l00461"></a><a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f">00461</a> Array<RV> <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>; |
267 | | <a name="l00463"></a><a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02">00463</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>; |
268 | | <a name="l00464"></a>00464 <span class="keyword">public</span>: |
269 | | <a name="l00466"></a><a class="code" href="classbdm_1_1logger.html#f9c2fe7db5ddbda0098a4a5bd2c29fbf">00466</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 ) {} |
| 263 | <a name="l00396"></a>00396 it_assert_debug ( <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>.length() ==<a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>,<span class="stringliteral">"rv is not fully in rv_up"</span> ); |
| 264 | <a name="l00397"></a>00397 } |
| 265 | <a name="l00399"></a><a class="code" href="classbdm_1_1datalink.html#5b5368c3899eed2f670d09142c2548e5">00399</a> vec <a class="code" href="classbdm_1_1datalink.html#5b5368c3899eed2f670d09142c2548e5" title="Get val for myself from val of &quot;Up&quot;.">pushdown</a> ( <span class="keyword">const</span> vec &val_up ) { |
| 266 | <a name="l00400"></a>00400 it_assert_debug ( <a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
| 267 | <a name="l00401"></a>00401 <span class="keywordflow">return</span> get_vec ( val_up,<a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a> ); |
| 268 | <a name="l00402"></a>00402 } |
| 269 | <a name="l00404"></a><a class="code" href="classbdm_1_1datalink.html#610e966f2edb1fcd6a5b28267c571793">00404</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink.html#610e966f2edb1fcd6a5b28267c571793" title="Fill val of &quot;Up&quot; by my pieces.">pushup</a> ( vec &val_up, <span class="keyword">const</span> vec &val ) { |
| 270 | <a name="l00405"></a>00405 it_assert_debug ( <a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>==val.length(),<span class="stringliteral">"Wrong val"</span> ); |
| 271 | <a name="l00406"></a>00406 it_assert_debug ( <a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
| 272 | <a name="l00407"></a>00407 set_subvector ( val_up, <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>, val ); |
| 273 | <a name="l00408"></a>00408 } |
| 274 | <a name="l00409"></a>00409 }; |
| 275 | <a name="l00410"></a>00410 |
| 276 | <a name="l00412"></a><a class="code" href="classbdm_1_1datalink__m2e.html">00412</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> <a class="code" href="classbdm_1_1datalink.html" title="DataLink is a connection between two data vectors Up and Down.">datalink</a> { |
| 277 | <a name="l00413"></a>00413 <span class="keyword">protected</span>: |
| 278 | <a name="l00415"></a><a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9">00415</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>; |
| 279 | <a name="l00417"></a><a class="code" href="classbdm_1_1datalink__m2e.html#43fe3e2d7aa04134053ec15793722783">00417</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>; |
| 280 | <a name="l00419"></a><a class="code" href="classbdm_1_1datalink__m2e.html#9e0048d87bda78e9b8d38761440c7abc">00419</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>; |
| 281 | <a name="l00420"></a>00420 |
| 282 | <a name="l00421"></a>00421 <span class="keyword">public</span>: |
| 283 | <a name="l00423"></a><a class="code" href="classbdm_1_1datalink__m2e.html#31bb5b6cd04b4d99a02fc8d1ad5ce202">00423</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 ) : |
| 284 | <a name="l00424"></a>00424 <a class="code" href="classbdm_1_1datalink.html" title="DataLink is a connection between two data vectors Up and Down.">datalink</a> ( rv,rv_up ), <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ( rvc._dsize() ) { |
| 285 | <a name="l00425"></a>00425 <span class="comment">//establish v2c connection</span> |
| 286 | <a name="l00426"></a>00426 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> ); |
| 287 | <a name="l00427"></a>00427 } |
| 288 | <a name="l00429"></a><a class="code" href="classbdm_1_1datalink__m2e.html#7ba850822e3cf9a4b079afc7e7c01703">00429</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 ) { |
| 289 | <a name="l00430"></a>00430 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
| 290 | <a name="l00431"></a>00431 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> ) ); |
| 291 | <a name="l00432"></a>00432 <span class="keywordflow">return</span> tmp; |
| 292 | <a name="l00433"></a>00433 } |
| 293 | <a name="l00434"></a>00434 <span class="keywordtype">void</span> pushup_cond ( vec &val_up, <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ) { |
| 294 | <a name="l00435"></a>00435 it_assert_debug ( <a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>==val.length(),<span class="stringliteral">"Wrong val"</span> ); |
| 295 | <a name="l00436"></a>00436 it_assert_debug ( <a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
| 296 | <a name="l00437"></a>00437 set_subvector ( val_up, <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>, val ); |
| 297 | <a name="l00438"></a>00438 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 ); |
| 298 | <a name="l00439"></a>00439 } |
| 299 | <a name="l00440"></a>00440 }; |
| 300 | <a name="l00443"></a><a class="code" href="classbdm_1_1datalink__m2m.html">00443</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> { |
| 301 | <a name="l00444"></a>00444 <span class="keyword">protected</span>: |
| 302 | <a name="l00446"></a><a class="code" href="classbdm_1_1datalink__m2m.html#d64dda6f92654628276bbcebb7600d0d">00446</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>; |
| 303 | <a name="l00448"></a><a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5">00448</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>; |
| 304 | <a name="l00449"></a>00449 <span class="keyword">public</span>: |
| 305 | <a name="l00451"></a><a class="code" href="classbdm_1_1datalink__m2m.html#540c4b60686fdf1a7915300ae11bc41b">00451</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 ) : |
| 306 | <a name="l00452"></a>00452 <a class="code" href="classbdm_1_1datalink__m2e.html" title="data link between">datalink_m2e</a> ( rv, rvc, rv_up ) { |
| 307 | <a name="l00453"></a>00453 <span class="comment">//establish c2c connection</span> |
| 308 | <a name="l00454"></a>00454 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> ); |
| 309 | <a name="l00455"></a>00455 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> ); |
| 310 | <a name="l00456"></a>00456 } |
| 311 | <a name="l00458"></a><a class="code" href="classbdm_1_1datalink__m2m.html#911fb7fcfa80d4e31db8e0cc03141a90">00458</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 ) { |
| 312 | <a name="l00459"></a>00459 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
| 313 | <a name="l00460"></a>00460 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> ) ); |
| 314 | <a name="l00461"></a>00461 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> ) ); |
| 315 | <a name="l00462"></a>00462 <span class="keywordflow">return</span> tmp; |
| 316 | <a name="l00463"></a>00463 } |
| 317 | <a name="l00465"></a>00465 |
| 318 | <a name="l00466"></a>00466 }; |
283 | | <a name="l00484"></a><a class="code" href="classbdm_1_1logger.html#0e3fc7d13e23a8f71fc7c8a5ea68559d">00484</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>() {}; |
284 | | <a name="l00485"></a>00485 |
285 | | <a name="l00487"></a><a class="code" href="classbdm_1_1logger.html#cd6291a73491f755dc7bc88d022eb2fc">00487</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>() {}; |
286 | | <a name="l00488"></a>00488 |
287 | | <a name="l00489"></a>00489 }; |
288 | | <a name="l00490"></a>00490 |
289 | | <a name="l00494"></a><a class="code" href="classbdm_1_1mepdf.html">00494</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> { |
290 | | <a name="l00495"></a>00495 <span class="keyword">public</span>: |
291 | | <a name="l00497"></a><a class="code" href="classbdm_1_1mepdf.html#27cc32d1a810516c25bda51ddf886376">00497</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> ( ) {<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 );}; |
292 | | <a name="l00498"></a><a class="code" href="classbdm_1_1mepdf.html#b2b898058169e7ed9a6dc7cd4e1c147c">00498</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 ) {} |
293 | | <a name="l00499"></a>00499 }; |
294 | | <a name="l00500"></a>00500 |
295 | | <a name="l00503"></a><a class="code" href="classbdm_1_1compositepdf.html">00503</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> { |
296 | | <a name="l00504"></a>00504 <span class="keyword">protected</span>: |
297 | | <a name="l00506"></a><a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a">00506</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a>; |
298 | | <a name="l00508"></a><a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a">00508</a> Array<mpdf*> <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>; |
299 | | <a name="l00509"></a>00509 <span class="keyword">public</span>: |
300 | | <a name="l00510"></a>00510 <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 ) {}; |
301 | | <a name="l00512"></a>00512 <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> ); |
302 | | <a name="l00514"></a>00514 <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 ); |
303 | | <a name="l00515"></a>00515 }; |
304 | | <a name="l00516"></a>00516 |
305 | | <a name="l00524"></a><a class="code" href="classbdm_1_1DS.html">00524</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> { |
306 | | <a name="l00525"></a>00525 <span class="keyword">protected</span>: |
307 | | <a name="l00526"></a>00526 <span class="keywordtype">int</span> dtsize; |
308 | | <a name="l00527"></a>00527 <span class="keywordtype">int</span> utsize; |
309 | | <a name="l00529"></a><a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec">00529</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="Description of data returned by getdata().">Drv</a>; |
310 | | <a name="l00531"></a><a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702">00531</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="Description of data witten by by write().">Urv</a>; <span class="comment">//</span> |
311 | | <a name="l00533"></a><a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867">00533</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; |
312 | | <a name="l00534"></a>00534 <span class="keyword">public</span>: |
313 | | <a name="l00536"></a><a class="code" href="classbdm_1_1DS.html#bedd82e08ae6686b4b1732a122c2201a">00536</a> <a class="code" href="classbdm_1_1DS.html#bedd82e08ae6686b4b1732a122c2201a" title="default constructors">DS</a>() :<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a> ( ),<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> ( ) {}; |
314 | | <a name="l00538"></a><a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba">00538</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> );}; |
315 | | <a name="l00540"></a><a class="code" href="classbdm_1_1DS.html#a0bf451c7fea73ff4150ff9e83da4832">00540</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> );}; |
316 | | <a name="l00542"></a><a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a">00542</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> );}; |
317 | | <a name="l00544"></a><a class="code" href="classbdm_1_1DS.html#6bced13f84f6bf04449728817e049e1d">00544</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> );}; |
318 | | <a name="l00545"></a>00545 |
319 | | <a name="l00547"></a>00547 <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; |
320 | | <a name="l00548"></a>00548 |
321 | | <a name="l00550"></a><a class="code" href="classbdm_1_1DS.html#3c9e417d85052396fe74c164857ee67e">00550</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 ) { |
322 | | <a name="l00551"></a>00551 it_assert_debug ( dtsize==<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(),<span class="stringliteral">""</span> ); |
323 | | <a name="l00552"></a>00552 it_assert_debug ( utsize==<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(),<span class="stringliteral">""</span> ); |
324 | | <a name="l00553"></a>00553 |
325 | | <a name="l00554"></a>00554 <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="Description of data returned by getdata().">Drv</a>,<span class="stringliteral">""</span> ); |
326 | | <a name="l00555"></a>00555 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="Description of data witten by by write().">Urv</a>,<span class="stringliteral">""</span> ); |
327 | | <a name="l00556"></a>00556 } |
328 | | <a name="l00558"></a><a class="code" href="classbdm_1_1DS.html#e03d2c93cddd5c3a03107ddd3ae999cf">00558</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 ) { |
329 | | <a name="l00559"></a>00559 vec tmp ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() +<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ); |
330 | | <a name="l00560"></a>00560 <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( tmp ); |
331 | | <a name="l00561"></a>00561 <span class="comment">// d is first in getdata</span> |
332 | | <a name="l00562"></a>00562 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="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ) ); |
333 | | <a name="l00563"></a>00563 <span class="comment">// u follows after d in getdata</span> |
334 | | <a name="l00564"></a>00564 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="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(), <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ) ); |
335 | | <a name="l00565"></a>00565 } |
336 | | <a name="l00567"></a><a class="code" href="classbdm_1_1DS.html#ed2113851294ed96abe60fc3f05aa660">00567</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="Description of data returned by getdata().">Drv</a>,<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> );} |
337 | | <a name="l00569"></a><a class="code" href="classbdm_1_1DS.html#a6a9a375da64c82fc227bda3418a1f33">00569</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="Description of data witten by by write().">Urv</a>;} |
338 | | <a name="l00570"></a>00570 }; |
339 | | <a name="l00571"></a>00571 |
340 | | <a name="l00576"></a><a class="code" href="classbdm_1_1BM.html">00576</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> { |
341 | | <a name="l00577"></a>00577 <span class="keyword">protected</span>: |
342 | | <a name="l00579"></a><a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed">00579</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>; |
343 | | <a name="l00581"></a><a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a">00581</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
344 | | <a name="l00583"></a><a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee">00583</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>; |
345 | | <a name="l00584"></a>00584 <span class="keyword">public</span>: |
346 | | <a name="l00587"></a>00587 |
347 | | <a name="l00588"></a>00588 <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#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> (0),<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> ( false) {}; |
348 | | <a name="l00589"></a>00589 <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">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#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>(B.<a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</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> ) {} |
349 | | <a name="l00592"></a><a class="code" href="classbdm_1_1BM.html#c0f027ff91d8459937c6f60ff8e553ff">00592</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#c0f027ff91d8459937c6f60ff8e553ff">_copy_</a> () {<span class="keywordflow">return</span> NULL;}; |
350 | | <a name="l00594"></a>00594 |
351 | | <a name="l00597"></a>00597 |
352 | | <a name="l00601"></a>00601 <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; |
353 | | <a name="l00603"></a>00603 <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 ); |
354 | | <a name="l00606"></a><a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">00606</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;} |
355 | | <a name="l00608"></a><a class="code" href="classbdm_1_1BM.html#0e8ebe61fb14990abe1254bd3dda5fae">00608</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;} |
356 | | <a name="l00609"></a>00609 |
357 | | <a name="l00611"></a><a class="code" href="classbdm_1_1BM.html#688d7a2aced1e06aa1c468d73a9e5eba">00611</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#688d7a2aced1e06aa1c468d73a9e5eba" title="Constructs a predictive density .">epredictor</a> ( )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> NULL;}; |
358 | | <a name="l00613"></a><a class="code" href="classbdm_1_1BM.html#598b25e3f3d96a5bc00a5faeb5b3c912">00613</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_1BM.html#598b25e3f3d96a5bc00a5faeb5b3c912" title="Constructs a conditional density 1-step ahead predictor.">predictor</a> ( )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> NULL;}; |
359 | | <a name="l00615"></a>00615 |
360 | | <a name="l00618"></a>00618 |
361 | | <a name="l00619"></a>00619 <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& _drv()<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>;} |
362 | | <a name="l00620"></a>00620 <span class="keywordtype">void</span> set_drv ( <span class="keyword">const</span> RV &rv ) {<a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>=rv;} |
363 | | <a name="l00621"></a>00621 <span class="keywordtype">double</span> _ll()<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>;} |
364 | | <a name="l00622"></a>00622 <span class="keywordtype">void</span> set_evalll ( <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;} |
365 | | <a name="l00623"></a>00623 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf& _epdf() <span class="keyword">const</span> =0; |
366 | | <a name="l00624"></a>00624 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf* _e() <span class="keyword">const</span> =0; |
367 | | <a name="l00626"></a>00626 |
368 | | <a name="l00627"></a>00627 }; |
369 | | <a name="l00628"></a>00628 |
370 | | <a name="l00638"></a><a class="code" href="classbdm_1_1BMcond.html">00638</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> { |
371 | | <a name="l00639"></a>00639 <span class="keyword">protected</span>: |
372 | | <a name="l00641"></a><a class="code" href="classbdm_1_1BMcond.html#9a12750776d977408aada06a70093297">00641</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>; |
373 | | <a name="l00642"></a>00642 <span class="keyword">public</span>: |
374 | | <a name="l00644"></a>00644 <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; |
375 | | <a name="l00646"></a><a class="code" href="classbdm_1_1BMcond.html#ecf4a1c5d2bbb28105564ef3d278c40b">00646</a> <a class="code" href="classbdm_1_1BMcond.html#ecf4a1c5d2bbb28105564ef3d278c40b" title="Default constructor.">BMcond</a> ( ) :<a class="code" href="classbdm_1_1BMcond.html#9a12750776d977408aada06a70093297" title="Identificator of the conditioning variable.">rvc</a> ( ) {}; |
376 | | <a name="l00648"></a><a class="code" href="classbdm_1_1BMcond.html#7d68d46cfcc36f9cc07a15a5403b5a1a">00648</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1BMcond.html#7d68d46cfcc36f9cc07a15a5403b5a1a" title="Destructor for future use.">~BMcond</a>() {}; |
377 | | <a name="l00650"></a><a class="code" href="classbdm_1_1BMcond.html#7506910f93250b44fea505ec4ffb19dc">00650</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>;} |
378 | | <a name="l00651"></a>00651 }; |
379 | | <a name="l00652"></a>00652 |
380 | | <a name="l00653"></a>00653 }; <span class="comment">//namespace</span> |
381 | | <a name="l00655"></a>00655 <span class="comment"></span><span class="preprocessor">#endif // BM_H</span> |
| 327 | <a name="l00485"></a><a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">00485</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> ) { |
| 328 | <a name="l00486"></a>00486 <span class="keywordtype">int</span> id; |
| 329 | <a name="l00487"></a>00487 <span class="keywordflow">if</span> ( rv._dsize() >0 ) { |
| 330 | <a name="l00488"></a>00488 <span class="keywordtype">id</span>=<a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.length(); |
| 331 | <a name="l00489"></a>00489 <a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>=concat ( <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> |
| 332 | <a name="l00490"></a>00490 <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> ); |
| 333 | <a name="l00491"></a>00491 <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( <span class="keywordtype">id</span> ) = rv; |
| 334 | <a name="l00492"></a>00492 } |
| 335 | <a name="l00493"></a>00493 <span class="keywordflow">else</span> { <span class="keywordtype">id</span> =-1;} |
| 336 | <a name="l00494"></a>00494 <span class="keywordflow">return</span> id; <span class="comment">// identifier of the last entry</span> |
| 337 | <a name="l00495"></a>00495 } |
| 338 | <a name="l00496"></a>00496 |
| 339 | <a name="l00498"></a>00498 <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; |
| 340 | <a name="l00499"></a>00499 |
| 341 | <a name="l00501"></a>00501 <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; |
| 342 | <a name="l00502"></a>00502 |
| 343 | <a name="l00504"></a><a class="code" href="classbdm_1_1logger.html#0e3fc7d13e23a8f71fc7c8a5ea68559d">00504</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>() {}; |
| 344 | <a name="l00505"></a>00505 |
| 345 | <a name="l00507"></a><a class="code" href="classbdm_1_1logger.html#cd6291a73491f755dc7bc88d022eb2fc">00507</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>() {}; |
| 346 | <a name="l00508"></a>00508 |
| 347 | <a name="l00509"></a>00509 }; |
| 348 | <a name="l00510"></a>00510 |
| 349 | <a name="l00514"></a><a class="code" href="classbdm_1_1mepdf.html">00514</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> { |
| 350 | <a name="l00515"></a>00515 <span class="keyword">public</span>: |
| 351 | <a name="l00517"></a><a class="code" href="classbdm_1_1mepdf.html#27cc32d1a810516c25bda51ddf886376">00517</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> ( ) {<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 );}; |
| 352 | <a name="l00518"></a><a class="code" href="classbdm_1_1mepdf.html#b2b898058169e7ed9a6dc7cd4e1c147c">00518</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 ) {} |
| 353 | <a name="l00519"></a>00519 }; |
| 354 | <a name="l00520"></a>00520 |
| 355 | <a name="l00523"></a><a class="code" href="classbdm_1_1compositepdf.html">00523</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> { |
| 356 | <a name="l00524"></a>00524 <span class="keyword">protected</span>: |
| 357 | <a name="l00526"></a><a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a">00526</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a>; |
| 358 | <a name="l00528"></a><a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a">00528</a> Array<mpdf*> <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>; |
| 359 | <a name="l00529"></a>00529 <span class="keyword">public</span>: |
| 360 | <a name="l00530"></a>00530 <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 ) {}; |
| 361 | <a name="l00532"></a>00532 <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> ); |
| 362 | <a name="l00534"></a>00534 <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 ); |
| 363 | <a name="l00535"></a>00535 }; |
| 364 | <a name="l00536"></a>00536 |
| 365 | <a name="l00544"></a><a class="code" href="classbdm_1_1DS.html">00544</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> { |
| 366 | <a name="l00545"></a>00545 <span class="keyword">protected</span>: |
| 367 | <a name="l00546"></a>00546 <span class="keywordtype">int</span> dtsize; |
| 368 | <a name="l00547"></a>00547 <span class="keywordtype">int</span> utsize; |
| 369 | <a name="l00549"></a><a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec">00549</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="Description of data returned by getdata().">Drv</a>; |
| 370 | <a name="l00551"></a><a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702">00551</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="Description of data witten by by write().">Urv</a>; <span class="comment">//</span> |
| 371 | <a name="l00553"></a><a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867">00553</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; |
| 372 | <a name="l00554"></a>00554 <span class="keyword">public</span>: |
| 373 | <a name="l00556"></a><a class="code" href="classbdm_1_1DS.html#bedd82e08ae6686b4b1732a122c2201a">00556</a> <a class="code" href="classbdm_1_1DS.html#bedd82e08ae6686b4b1732a122c2201a" title="default constructors">DS</a>() :<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a> ( ),<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> ( ) {}; |
| 374 | <a name="l00558"></a><a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba">00558</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> );}; |
| 375 | <a name="l00560"></a><a class="code" href="classbdm_1_1DS.html#a0bf451c7fea73ff4150ff9e83da4832">00560</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> );}; |
| 376 | <a name="l00562"></a><a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a">00562</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> );}; |
| 377 | <a name="l00564"></a><a class="code" href="classbdm_1_1DS.html#6bced13f84f6bf04449728817e049e1d">00564</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> );}; |
| 378 | <a name="l00565"></a>00565 |
| 379 | <a name="l00567"></a>00567 <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; |
| 380 | <a name="l00568"></a>00568 |
| 381 | <a name="l00570"></a><a class="code" href="classbdm_1_1DS.html#3c9e417d85052396fe74c164857ee67e">00570</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 ) { |
| 382 | <a name="l00571"></a>00571 it_assert_debug ( dtsize==<a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(),<span class="stringliteral">""</span> ); |
| 383 | <a name="l00572"></a>00572 it_assert_debug ( utsize==<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(),<span class="stringliteral">""</span> ); |
| 384 | <a name="l00573"></a>00573 |
| 385 | <a name="l00574"></a>00574 <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">add</a> ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>,<span class="stringliteral">""</span> ); |
| 386 | <a name="l00575"></a>00575 L_ut=L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>,<span class="stringliteral">""</span> ); |
| 387 | <a name="l00576"></a>00576 } |
| 388 | <a name="l00578"></a><a class="code" href="classbdm_1_1DS.html#e03d2c93cddd5c3a03107ddd3ae999cf">00578</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 ) { |
| 389 | <a name="l00579"></a>00579 vec tmp ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() +<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ); |
| 390 | <a name="l00580"></a>00580 <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( tmp ); |
| 391 | <a name="l00581"></a>00581 <span class="comment">// d is first in getdata</span> |
| 392 | <a name="l00582"></a>00582 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="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ) ); |
| 393 | <a name="l00583"></a>00583 <span class="comment">// u follows after d in getdata</span> |
| 394 | <a name="l00584"></a>00584 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="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(), <a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ) ); |
| 395 | <a name="l00585"></a>00585 } |
| 396 | <a name="l00587"></a><a class="code" href="classbdm_1_1DS.html#ed2113851294ed96abe60fc3f05aa660">00587</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> concat ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>,<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> );} |
| 397 | <a name="l00589"></a><a class="code" href="classbdm_1_1DS.html#a6a9a375da64c82fc227bda3418a1f33">00589</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="Description of data witten by by write().">Urv</a>;} |
| 398 | <a name="l00590"></a>00590 }; |
| 399 | <a name="l00591"></a>00591 |
| 400 | <a name="l00596"></a><a class="code" href="classbdm_1_1BM.html">00596</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> { |
| 401 | <a name="l00597"></a>00597 <span class="keyword">protected</span>: |
| 402 | <a name="l00599"></a><a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed">00599</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>; |
| 403 | <a name="l00601"></a><a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a">00601</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
| 404 | <a name="l00603"></a><a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee">00603</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>; |
| 405 | <a name="l00604"></a>00604 <span class="keyword">public</span>: |
| 406 | <a name="l00607"></a>00607 |
| 407 | <a name="l00608"></a>00608 <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#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( 0 ),<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> ( false ) {}; |
| 408 | <a name="l00609"></a>00609 <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">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#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ( B.<a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</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> ) {} |
| 409 | <a name="l00612"></a><a class="code" href="classbdm_1_1BM.html#c0f027ff91d8459937c6f60ff8e553ff">00612</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#c0f027ff91d8459937c6f60ff8e553ff">_copy_</a> () {<span class="keywordflow">return</span> NULL;}; |
| 410 | <a name="l00614"></a>00614 |
| 411 | <a name="l00617"></a>00617 |
| 412 | <a name="l00621"></a>00621 <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; |
| 413 | <a name="l00623"></a>00623 <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 ); |
| 414 | <a name="l00626"></a><a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">00626</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;} |
| 415 | <a name="l00628"></a><a class="code" href="classbdm_1_1BM.html#0e8ebe61fb14990abe1254bd3dda5fae">00628</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;} |
| 416 | <a name="l00629"></a>00629 |
| 417 | <a name="l00631"></a><a class="code" href="classbdm_1_1BM.html#688d7a2aced1e06aa1c468d73a9e5eba">00631</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#688d7a2aced1e06aa1c468d73a9e5eba" title="Constructs a predictive density .">epredictor</a> ( )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> NULL;}; |
| 418 | <a name="l00633"></a><a class="code" href="classbdm_1_1BM.html#598b25e3f3d96a5bc00a5faeb5b3c912">00633</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_1BM.html#598b25e3f3d96a5bc00a5faeb5b3c912" title="Constructs a conditional density 1-step ahead predictor.">predictor</a> ( )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> NULL;}; |
| 419 | <a name="l00635"></a>00635 |
| 420 | <a name="l00638"></a>00638 |
| 421 | <a name="l00639"></a>00639 <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& _drv()<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>;} |
| 422 | <a name="l00640"></a>00640 <span class="keywordtype">void</span> set_drv ( <span class="keyword">const</span> RV &rv ) {<a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>=rv;} |
| 423 | <a name="l00641"></a>00641 <span class="keywordtype">void</span> set_rv ( <span class="keyword">const</span> RV &rv ) {<span class="keyword">const_cast<</span>epdf&<span class="keyword">></span> ( posterior() ).set_rv ( rv );} |
| 424 | <a name="l00642"></a>00642 <span class="keywordtype">double</span> _ll()<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>;} |
| 425 | <a name="l00643"></a>00643 <span class="keywordtype">void</span> set_evalll ( <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;} |
| 426 | <a name="l00644"></a>00644 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf& posterior() <span class="keyword">const</span> =0; |
| 427 | <a name="l00645"></a>00645 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf* _e() <span class="keyword">const</span> =0; |
| 428 | <a name="l00647"></a>00647 |
| 429 | <a name="l00648"></a>00648 }; |
| 430 | <a name="l00649"></a>00649 |
| 431 | <a name="l00659"></a><a class="code" href="classbdm_1_1BMcond.html">00659</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> { |
| 432 | <a name="l00660"></a>00660 <span class="keyword">protected</span>: |
| 433 | <a name="l00662"></a><a class="code" href="classbdm_1_1BMcond.html#9a12750776d977408aada06a70093297">00662</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>; |
| 434 | <a name="l00663"></a>00663 <span class="keyword">public</span>: |
| 435 | <a name="l00665"></a>00665 <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; |
| 436 | <a name="l00667"></a><a class="code" href="classbdm_1_1BMcond.html#ecf4a1c5d2bbb28105564ef3d278c40b">00667</a> <a class="code" href="classbdm_1_1BMcond.html#ecf4a1c5d2bbb28105564ef3d278c40b" title="Default constructor.">BMcond</a> ( ) :<a class="code" href="classbdm_1_1BMcond.html#9a12750776d977408aada06a70093297" title="Identificator of the conditioning variable.">rvc</a> ( ) {}; |
| 437 | <a name="l00669"></a><a class="code" href="classbdm_1_1BMcond.html#7d68d46cfcc36f9cc07a15a5403b5a1a">00669</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1BMcond.html#7d68d46cfcc36f9cc07a15a5403b5a1a" title="Destructor for future use.">~BMcond</a>() {}; |
| 438 | <a name="l00671"></a><a class="code" href="classbdm_1_1BMcond.html#7506910f93250b44fea505ec4ffb19dc">00671</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>;} |
| 439 | <a name="l00672"></a>00672 }; |
| 440 | <a name="l00673"></a>00673 |
| 441 | <a name="l00674"></a>00674 }; <span class="comment">//namespace</span> |
| 442 | <a name="l00675"></a>00675 <span class="preprocessor">#endif // BM_H</span> |