71 | | <a name="l00018"></a>00018 <span class="preprocessor">#include <map></span> |
72 | | <a name="l00019"></a>00019 |
73 | | <a name="l00020"></a>00020 <span class="keyword">namespace </span>bdm { |
74 | | <a name="l00021"></a>00021 <span class="keyword">using namespace </span>itpp; |
75 | | <a name="l00022"></a>00022 <span class="keyword">using namespace </span>std; |
76 | | <a name="l00023"></a>00023 |
77 | | <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> { |
78 | | <a name="l00026"></a>00026 <span class="keyword">public</span>: |
79 | | <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>() {} |
80 | | <a name="l00029"></a>00029 }; |
81 | | <a name="l00030"></a>00030 |
82 | | <a name="l00031"></a>00031 <span class="keyword">typedef</span> std::map<string, int> RVmap; |
83 | | <a name="l00032"></a>00032 <span class="keyword">extern</span> ivec RV_SIZES; |
84 | | <a name="l00033"></a>00033 <span class="keyword">extern</span> Array<string> RV_NAMES; |
85 | | <a name="l00034"></a>00034 |
86 | | <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> { |
87 | | <a name="l00037"></a>00037 <span class="keyword">public</span>: |
88 | | <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>; |
89 | | <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>; |
90 | | <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 ) { |
91 | | <a name="l00044"></a>00044 it_assert_debug ( times0.length() ==ids0.length(),<span class="stringliteral">"Incompatible input"</span> ); |
92 | | <a name="l00045"></a>00045 }; |
93 | | <a name="l00046"></a>00046 }; |
| 71 | <a name="l00018"></a>00018 <span class="preprocessor">#include "../libconfig/libconfig.h++"</span> |
| 72 | <a name="l00019"></a>00019 <span class="preprocessor">#include <map></span> |
| 73 | <a name="l00020"></a>00020 |
| 74 | <a name="l00021"></a>00021 <span class="keyword">using namespace </span>libconfig; |
| 75 | <a name="l00022"></a>00022 |
| 76 | <a name="l00023"></a>00023 <span class="keyword">using namespace </span>itpp; |
| 77 | <a name="l00024"></a>00024 <span class="keyword">using namespace </span>std; |
| 78 | <a name="l00025"></a>00025 |
| 79 | <a name="l00026"></a>00026 <span class="keyword">namespace </span>bdm { |
| 80 | <a name="l00027"></a>00027 |
| 81 | <a name="l00029"></a>00029 |
| 82 | <a name="l00030"></a><a class="code" href="classbdm_1_1bdmroot.html">00030</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a> { |
| 83 | <a name="l00031"></a>00031 <span class="keyword">public</span>: |
| 84 | <a name="l00033"></a><a class="code" href="classbdm_1_1bdmroot.html#9c191bccc52a133d32d84edbc1a19c49">00033</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>() |
| 85 | <a name="l00034"></a>00034 { |
| 86 | <a name="l00035"></a>00035 } |
| 87 | <a name="l00036"></a>00036 |
| 88 | <a name="l00038"></a><a class="code" href="classbdm_1_1bdmroot.html#3d95e9de79ca1d52b06f1b8f80660f09">00038</a> <span class="keyword">virtual</span> <span class="keywordtype">string</span> <a class="code" href="classbdm_1_1bdmroot.html#3d95e9de79ca1d52b06f1b8f80660f09" title="This method returns a basic info about the current instance.">ToString</a>() |
| 89 | <a name="l00039"></a>00039 { |
| 90 | <a name="l00040"></a>00040 <span class="keywordflow">return</span> <span class="stringliteral">""</span>; |
| 91 | <a name="l00041"></a>00041 } |
| 92 | <a name="l00042"></a>00042 |
| 93 | <a name="l00044"></a><a class="code" href="classbdm_1_1bdmroot.html#d4602efd3ad9fb9e4532426e4f488df8">00044</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1bdmroot.html#d4602efd3ad9fb9e4532426e4f488df8" title="This method arrange instance properties according the data stored in the Setting...">from_setting</a>( <span class="keyword">const</span> Setting &root ) |
| 94 | <a name="l00045"></a>00045 { |
| 95 | <a name="l00046"></a>00046 } |
95 | | <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> { |
96 | | <a name="l00087"></a>00087 <span class="keyword">protected</span>: |
97 | | <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>; |
98 | | <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>; |
99 | | <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>; |
100 | | <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>; |
101 | | <a name="l00096"></a>00096 |
102 | | <a name="l00097"></a>00097 <span class="keyword">private</span>: |
103 | | <a name="l00099"></a>00099 <span class="keywordtype">void</span> init ( Array<std::string> in_names, ivec in_sizes, ivec in_times ); |
104 | | <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 ); |
105 | | <a name="l00101"></a>00101 <span class="keyword">public</span>: |
106 | | <a name="l00104"></a>00104 |
107 | | <a name="l00106"></a><a class="code" href="classbdm_1_1RV.html#3d93da01a64dab31074b25b7d93e5eae">00106</a> <a class="code" href="classbdm_1_1RV.html#3d93da01a64dab31074b25b7d93e5eae" title="Full constructor.">RV</a> ( Array<std::string> in_names, ivec in_sizes, ivec in_times ) {init ( in_names,in_sizes,in_times );}; |
108 | | <a name="l00108"></a><a class="code" href="classbdm_1_1RV.html#5bd1bd9ec51b91578ecc83a6b2398a20">00108</a> <a class="code" href="classbdm_1_1RV.html#5bd1bd9ec51b91578ecc83a6b2398a20" title="Constructor with times=0.">RV</a> ( Array<std::string> in_names, ivec in_sizes ) {init ( in_names,in_sizes,zeros_i ( in_names.length() ) );}; |
109 | | <a name="l00110"></a><a class="code" href="classbdm_1_1RV.html#a222dfef569e8f123180d40fde97c1cd">00110</a> <a class="code" href="classbdm_1_1RV.html#a222dfef569e8f123180d40fde97c1cd" title="Constructor with sizes=1, times=0.">RV</a> ( Array<std::string> in_names ) {init ( in_names,ones_i ( in_names.length() ),zeros_i ( in_names.length() ) );} |
110 | | <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 ) {}; |
111 | | <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 ); |
112 | | <a name="l00116"></a>00116 |
| 97 | <a name="l00049"></a><a class="code" href="classbdm_1_1bdmroot.html#a80210bbe266bf26f100f342460a313f">00049</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1bdmroot.html#a80210bbe266bf26f100f342460a313f" title="This method save all the instance properties into the Setting structure.">to_setting</a>( Setting &root ) |
| 98 | <a name="l00050"></a>00050 { |
| 99 | <a name="l00051"></a>00051 } |
| 100 | <a name="l00052"></a>00052 }; |
| 101 | <a name="l00053"></a>00053 |
| 102 | <a name="l00054"></a>00054 <span class="keyword">typedef</span> std::map<string, int> RVmap; |
| 103 | <a name="l00055"></a>00055 <span class="keyword">extern</span> ivec RV_SIZES; |
| 104 | <a name="l00056"></a>00056 <span class="keyword">extern</span> <a class="code" href="classitpp_1_1Array.html">Array<string></a> RV_NAMES; |
| 105 | <a name="l00057"></a>00057 |
| 106 | <a name="l00059"></a><a class="code" href="classbdm_1_1str.html">00059</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> { |
| 107 | <a name="l00060"></a>00060 <span class="keyword">public</span>: |
| 108 | <a name="l00062"></a><a class="code" href="classbdm_1_1str.html#64675a73fc7324177175f19b3baeb0b0">00062</a> ivec <a class="code" href="classbdm_1_1str.html#64675a73fc7324177175f19b3baeb0b0" title="vector id ids (non-unique!)">ids</a>; |
| 109 | <a name="l00064"></a><a class="code" href="classbdm_1_1str.html#905dc0f240e40432c103708c4a34f80a">00064</a> ivec <a class="code" href="classbdm_1_1str.html#905dc0f240e40432c103708c4a34f80a" title="vector of times">times</a>; |
| 110 | <a name="l00066"></a><a class="code" href="classbdm_1_1str.html#7c6b9dccc6814d7bd1e8e2208a0d3f3f">00066</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 ) { |
| 111 | <a name="l00067"></a>00067 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( times0.length() ==ids0.length(),<span class="stringliteral">"Incompatible input"</span> ); |
| 112 | <a name="l00068"></a>00068 }; |
| 113 | <a name="l00069"></a>00069 }; |
| 114 | <a name="l00070"></a>00070 |
| 115 | <a name="l00109"></a><a class="code" href="classbdm_1_1RV.html">00109</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> { |
| 116 | <a name="l00110"></a>00110 <span class="keyword">protected</span>: |
| 117 | <a name="l00112"></a><a class="code" href="classbdm_1_1RV.html#0cfe477965243a89eb87a06b024e2fcb">00112</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a>; |
| 118 | <a name="l00114"></a><a class="code" href="classbdm_1_1RV.html#b11bfdceb831ed30d33b852dd4a6b385">00114</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#b11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a>; |
| 119 | <a name="l00116"></a><a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b">00116</a> ivec <a class="code" href="classbdm_1_1RV.html#0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a>; |
| 120 | <a name="l00118"></a><a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896">00118</a> ivec <a class="code" href="classbdm_1_1RV.html#ef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a>; |
114 | | <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 ); |
115 | | <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>;} ; |
116 | | <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>; |
117 | | <a name="l00125"></a>00125 ivec cumsizes() <span class="keyword">const</span>; |
118 | | <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>;} ; |
119 | | <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 );}; |
120 | | <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 ) );}; |
121 | | <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 );}; |
122 | | <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 ) );}; |
123 | | <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;}; |
124 | | <a name="l00133"></a>00133 |
125 | | <a name="l00134"></a>00134 <span class="comment">//TODO why not inline and later??</span> |
126 | | <a name="l00135"></a>00135 |
127 | | <a name="l00138"></a>00138 |
128 | | <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>; |
129 | | <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>; |
130 | | <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 ); |
131 | | <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>; |
132 | | <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>; |
133 | | <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 );}; |
134 | | <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>{ |
135 | | <a name="l00153"></a>00153 ivec sz=cumsizes(); |
136 | | <a name="l00154"></a>00154 <span class="keywordtype">int</span> i1=0; |
137 | | <a name="l00155"></a>00155 <span class="keywordflow">while</span> ( sz ( i1 ) <di1 ) i1++; |
138 | | <a name="l00156"></a>00156 <span class="keywordtype">int</span> i2=i1; |
139 | | <a name="l00157"></a>00157 <span class="keywordflow">while</span> ( sz ( i2 ) <di2 ) i2++; |
140 | | <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 ) ); |
141 | | <a name="l00159"></a>00159 }; |
142 | | <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 ); |
143 | | <a name="l00163"></a>00163 |
144 | | <a name="l00166"></a>00166 |
145 | | <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>; |
146 | | <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>; |
147 | | <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>; |
148 | | <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> );}; |
149 | | <a name="l00178"></a>00178 |
150 | | <a name="l00179"></a>00179 }; |
151 | | <a name="l00180"></a>00180 |
152 | | <a name="l00181"></a>00181 |
153 | | <a name="l00183"></a>00183 RV concat ( <span class="keyword">const</span> RV &rv1, <span class="keyword">const</span> RV &rv2 ); |
154 | | <a name="l00184"></a>00184 |
155 | | <a name="l00186"></a>00186 <span class="keyword">extern</span> RV RV0; |
156 | | <a name="l00187"></a>00187 |
| 122 | <a name="l00120"></a>00120 <span class="keyword">private</span>: |
| 123 | <a name="l00122"></a>00122 <span class="keywordtype">void</span> init ( <a class="code" href="classitpp_1_1Array.html">Array<std::string></a> in_names, ivec in_sizes, ivec in_times ); |
| 124 | <a name="l00123"></a>00123 <span class="keywordtype">int</span> init ( <span class="keyword">const</span> <span class="keywordtype">string</span> &name, <span class="keywordtype">int</span> size ); |
| 125 | <a name="l00124"></a>00124 <span class="keyword">public</span>: |
| 126 | <a name="l00127"></a>00127 |
| 127 | <a name="l00129"></a><a class="code" href="classbdm_1_1RV.html#3d93da01a64dab31074b25b7d93e5eae">00129</a> <a class="code" href="classbdm_1_1RV.html#3d93da01a64dab31074b25b7d93e5eae" title="Full constructor.">RV</a> ( <a class="code" href="classitpp_1_1Array.html">Array<std::string></a> in_names, ivec in_sizes, ivec in_times ) {init ( in_names,in_sizes,in_times );}; |
| 128 | <a name="l00131"></a><a class="code" href="classbdm_1_1RV.html#5bd1bd9ec51b91578ecc83a6b2398a20">00131</a> <a class="code" href="classbdm_1_1RV.html#5bd1bd9ec51b91578ecc83a6b2398a20" title="Constructor with times=0.">RV</a> ( <a class="code" href="classitpp_1_1Array.html">Array<std::string></a> in_names, ivec in_sizes ) {init ( in_names,in_sizes,<a class="code" href="group__specmat.html#g9df9aa3553b6a5c07924954b85466cec" title="A Int (rows,cols)-matrix of zeros.">zeros_i</a> ( in_names.<a class="code" href="classitpp_1_1Array.html#53629018f146084de506c33c69fa19a3" title="Returns the number of data elements in the array object.">length</a>() ) );}; |
| 129 | <a name="l00133"></a><a class="code" href="classbdm_1_1RV.html#a222dfef569e8f123180d40fde97c1cd">00133</a> <a class="code" href="classbdm_1_1RV.html#a222dfef569e8f123180d40fde97c1cd" title="Constructor with sizes=1, times=0.">RV</a> ( <a class="code" href="classitpp_1_1Array.html">Array<std::string></a> in_names ) {init ( in_names,<a class="code" href="group__specmat.html#g7c2c02190b4aa222cc692641cc3a73c7" title="A Int (rows,cols)-matrix of ones.">ones_i</a> ( in_names.<a class="code" href="classitpp_1_1Array.html#53629018f146084de506c33c69fa19a3" title="Returns the number of data elements in the array object.">length</a>() ),<a class="code" href="group__specmat.html#g9df9aa3553b6a5c07924954b85466cec" title="A Int (rows,cols)-matrix of zeros.">zeros_i</a> ( in_names.<a class="code" href="classitpp_1_1Array.html#53629018f146084de506c33c69fa19a3" title="Returns the number of data elements in the array object.">length</a>() ) );} |
| 130 | <a name="l00135"></a><a class="code" href="classbdm_1_1RV.html#e319ca900261a5005a9b4b353ec16412">00135</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 ) {}; |
| 131 | <a name="l00137"></a>00137 <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 ); |
| 132 | <a name="l00139"></a>00139 |
| 133 | <a name="l00142"></a>00142 |
| 134 | <a name="l00144"></a>00144 <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 ); |
| 135 | <a name="l00145"></a>00145 <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>;} ; |
| 136 | <a name="l00147"></a>00147 <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>; |
| 137 | <a name="l00148"></a>00148 ivec cumsizes() <span class="keyword">const</span>; |
| 138 | <a name="l00149"></a>00149 <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>;} ; |
| 139 | <a name="l00150"></a>00150 <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 );}; |
| 140 | <a name="l00151"></a>00151 <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 ) );}; |
| 141 | <a name="l00152"></a>00152 <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 );}; |
| 142 | <a name="l00153"></a>00153 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 ) );}; |
| 143 | <a name="l00154"></a>00154 <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;}; |
| 144 | <a name="l00156"></a>00156 |
| 145 | <a name="l00157"></a>00157 <span class="comment">//TODO why not inline and later??</span> |
| 146 | <a name="l00158"></a>00158 |
| 147 | <a name="l00161"></a>00161 |
| 148 | <a name="l00163"></a>00163 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>; |
| 149 | <a name="l00165"></a>00165 <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>; |
| 150 | <a name="l00167"></a>00167 <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 ); |
| 151 | <a name="l00169"></a>00169 <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>; |
| 152 | <a name="l00171"></a>00171 <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>; |
| 153 | <a name="l00173"></a><a class="code" href="classbdm_1_1RV.html#6f3daf0f857fff53a1c0a445fe160966">00173</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 );}; |
| 154 | <a name="l00175"></a><a class="code" href="classbdm_1_1RV.html#452fb5f7ab1eafe17932bf9f458d0415">00175</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_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>{ |
| 155 | <a name="l00176"></a>00176 ivec sz=cumsizes(); |
| 156 | <a name="l00177"></a>00177 <span class="keywordtype">int</span> i1=0; |
| 157 | <a name="l00178"></a>00178 <span class="keywordflow">while</span> ( sz ( i1 ) <di1 ) i1++; |
| 158 | <a name="l00179"></a>00179 <span class="keywordtype">int</span> i2=i1; |
| 159 | <a name="l00180"></a>00180 <span class="keywordflow">while</span> ( sz ( i2 ) <di2 ) i2++; |
| 160 | <a name="l00181"></a>00181 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#c0c04ab99ded62e1e05bcefb151ebeb9" title="Select only variables at indeces ind.">subselect</a> ( <a class="code" href="group__specmat.html#ge5632baa525e231b015f3d45f3503cac" title="Linspace (works in the same way as the matlab version).">linspace</a> ( i1,i2 ) ); |
| 161 | <a name="l00182"></a>00182 }; |
| 162 | <a name="l00184"></a>00184 <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 ); |
| 163 | <a name="l00186"></a>00186 |
177 | | <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>; |
178 | | <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>; |
179 | | <a name="l00219"></a>00219 |
180 | | <a name="l00220"></a>00220 <span class="keyword">public</span>: |
181 | | <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> ( ) {}; |
182 | | <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> ) {}; |
183 | | <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 );}; |
184 | | <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;} |
185 | | <a name="l00237"></a>00237 |
186 | | <a name="l00240"></a>00240 |
187 | | <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 );}; |
188 | | <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>; |
189 | | <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;}; |
190 | | <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>{ |
191 | | <a name="l00249"></a>00249 vec x ( Val.cols() ); |
192 | | <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 ) ) ;} |
193 | | <a name="l00251"></a>00251 <span class="keywordflow">return</span> x; |
194 | | <a name="l00252"></a>00252 } |
195 | | <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;} |
196 | | <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;} |
197 | | <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 );}; |
198 | | <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 );}; |
199 | | <a name="l00262"></a><a class="code" href="classbdm_1_1epdf.html#0a7705e80601957f7226d333a0a6d539">00262</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1epdf.html#0a7705e80601957f7226d333a0a6d539" title="Lower and upper bounds of percentage % quantile, returns mean-2*sigma as default...">qbounds</a> ( vec &lb, vec &ub, <span class="keywordtype">double</span> percentage=0.95 )<span class="keyword"> const </span>{ |
200 | | <a name="l00263"></a>00263 vec mea=<a class="code" href="classbdm_1_1epdf.html#0c8d13d788094605b3cdab20a6e22b75" title="return expected value">mean</a>(); vec std=sqrt ( <a class="code" href="classbdm_1_1epdf.html#4543d40ccfc5d549b0c831a57a3ed84c" title="return expected variance (not covariance!)">variance</a>() ); |
201 | | <a name="l00264"></a>00264 lb = mea-2*std; ub=mea+2*std; |
202 | | <a name="l00265"></a>00265 }; |
203 | | <a name="l00267"></a>00267 |
204 | | <a name="l00273"></a>00273 |
205 | | <a name="l00275"></a><a class="code" href="classbdm_1_1epdf.html#f423e28448dbb69ef4905295ec8de8ff">00275</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> |
206 | | <a name="l00277"></a><a class="code" href="classbdm_1_1epdf.html#c4b863ff84c7a4882fb3ad18556027f9">00277</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;} |
207 | | <a name="l00279"></a><a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21">00279</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>;} |
208 | | <a name="l00281"></a>00281 |
209 | | <a name="l00284"></a>00284 |
210 | | <a name="l00286"></a><a class="code" href="classbdm_1_1epdf.html#7083a65f7b7a0d0d13b2c516bd2ec29c">00286</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>;} |
211 | | <a name="l00288"></a>00288 |
212 | | <a name="l00289"></a>00289 }; |
| 180 | <a name="l00216"></a><a class="code" href="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62">00216</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>; |
| 181 | <a name="l00217"></a>00217 <span class="keyword">public</span>: |
| 182 | <a name="l00219"></a><a class="code" href="classbdm_1_1fnc.html#65e9fb11f6cc7884018d8f229bcabbb7">00219</a> <a class="code" href="classbdm_1_1fnc.html#65e9fb11f6cc7884018d8f229bcabbb7" title="default constructor">fnc</a> ( ) {}; |
| 183 | <a name="l00221"></a><a class="code" href="classbdm_1_1fnc.html#6277b11d7fffc7ef8a2fa3e84ae5bad4">00221</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1fnc.html#6277b11d7fffc7ef8a2fa3e84ae5bad4" title="function evaluates numerical value of at cond ">eval</a> ( <span class="keyword">const</span> vec &cond ) { |
| 184 | <a name="l00222"></a>00222 <span class="keywordflow">return</span> vec ( 0 ); |
| 185 | <a name="l00223"></a>00223 }; |
| 186 | <a name="l00224"></a>00224 |
| 187 | <a name="l00226"></a><a class="code" href="classbdm_1_1fnc.html#0786e40fade2663a70d654c1dda5d73e">00226</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1fnc.html#0786e40fade2663a70d654c1dda5d73e" title="function substitutes given value into an appropriate position">condition</a> ( <span class="keyword">const</span> vec &val ) {}; |
| 188 | <a name="l00227"></a>00227 |
| 189 | <a name="l00229"></a><a class="code" href="classbdm_1_1fnc.html#083832294da9d1e40804158b979c4341">00229</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1fnc.html#083832294da9d1e40804158b979c4341" title="access function">dimension</a>()<span class="keyword"> const</span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>;} |
| 190 | <a name="l00230"></a>00230 }; |
| 191 | <a name="l00231"></a>00231 |
| 192 | <a name="l00232"></a>00232 <span class="keyword">class </span>mpdf; |
| 193 | <a name="l00233"></a>00233 |
| 194 | <a name="l00235"></a>00235 |
| 195 | <a name="l00236"></a><a class="code" href="classbdm_1_1epdf.html">00236</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> { |
| 196 | <a name="l00237"></a>00237 <span class="keyword">protected</span>: |
| 197 | <a name="l00239"></a><a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce">00239</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>; |
| 198 | <a name="l00241"></a><a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8">00241</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>; |
| 199 | <a name="l00242"></a>00242 |
| 200 | <a name="l00243"></a>00243 <span class="keyword">public</span>: |
| 201 | <a name="l00255"></a>00255 <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> ( ) {}; |
| 202 | <a name="l00256"></a>00256 <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> ) {}; |
| 203 | <a name="l00257"></a>00257 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 );}; |
| 204 | <a name="l00258"></a>00258 <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;} |
| 205 | <a name="l00260"></a>00260 |
| 206 | <a name="l00263"></a>00263 |
| 207 | <a name="l00265"></a><a class="code" href="classbdm_1_1epdf.html#75ba57a89681a8efec488f5796c7cc1b">00265</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>{<a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a> ( <span class="stringliteral">"not implemneted"</span> );<span class="keywordflow">return</span> vec ( 0 );}; |
| 208 | <a name="l00267"></a>00267 <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>; |
| 209 | <a name="l00269"></a><a class="code" href="classbdm_1_1epdf.html#deab266d63c236c277538867d5c3f249">00269</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>{<a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a> ( <span class="stringliteral">"not implemneted"</span> );<span class="keywordflow">return</span> 0.0;}; |
| 210 | <a name="l00271"></a><a class="code" href="classbdm_1_1epdf.html#34956d4dd3176eeb5937cf48a1546b62">00271</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>{ |
| 211 | <a name="l00272"></a>00272 vec x ( Val.cols() ); |
| 212 | <a name="l00273"></a>00273 <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 ) ) ;} |
| 213 | <a name="l00274"></a>00274 <span class="keywordflow">return</span> x; |
| 214 | <a name="l00275"></a>00275 } |
| 215 | <a name="l00277"></a><a class="code" href="classbdm_1_1epdf.html#e584eac5579c1b6384947ecf66166c77">00277</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>{<a class="code" href="group__errorhandlingfunc.html#g365842195965b61b7ab3ac7938c58b77" title="Display a warning message.">it_warning</a> ( <span class="stringliteral">"Not implemented"</span> ); <span class="keywordflow">return</span> NULL;} |
| 216 | <a name="l00279"></a><a class="code" href="classbdm_1_1epdf.html#3fb2ece54f720b62ad325e61214fa0a1">00279</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>{<a class="code" href="group__errorhandlingfunc.html#g365842195965b61b7ab3ac7938c58b77" title="Display a warning message.">it_warning</a> ( <span class="stringliteral">"Not implemented"</span> ); <span class="keywordflow">return</span> NULL;} |
| 217 | <a name="l00281"></a><a class="code" href="classbdm_1_1epdf.html#0c8d13d788094605b3cdab20a6e22b75">00281</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>{<a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a> ( <span class="stringliteral">"not implemneted"</span> );<span class="keywordflow">return</span> vec ( 0 );}; |
| 218 | <a name="l00283"></a><a class="code" href="classbdm_1_1epdf.html#4543d40ccfc5d549b0c831a57a3ed84c">00283</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>{<a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a> ( <span class="stringliteral">"not implemneted"</span> );<span class="keywordflow">return</span> vec ( 0 );}; |
| 219 | <a name="l00285"></a><a class="code" href="classbdm_1_1epdf.html#0a7705e80601957f7226d333a0a6d539">00285</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1epdf.html#0a7705e80601957f7226d333a0a6d539" title="Lower and upper bounds of percentage % quantile, returns mean-2*sigma as default...">qbounds</a> ( vec &lb, vec &ub, <span class="keywordtype">double</span> percentage=0.95 )<span class="keyword"> const </span>{ |
| 220 | <a name="l00286"></a>00286 vec mea=<a class="code" href="classbdm_1_1epdf.html#0c8d13d788094605b3cdab20a6e22b75" title="return expected value">mean</a>(); vec std=<a class="code" href="group__miscfunc.html#g20af7c97287e8275db8c2b0f650310ac" title="Square root of the elements.">sqrt</a> ( <a class="code" href="classbdm_1_1epdf.html#4543d40ccfc5d549b0c831a57a3ed84c" title="return expected variance (not covariance!)">variance</a>() ); |
| 221 | <a name="l00287"></a>00287 lb = mea-2*std; ub=mea+2*std; |
| 222 | <a name="l00288"></a>00288 }; |
228 | | <a name="l00316"></a><a class="code" href="classbdm_1_1mpdf.html#f0c1db6fcbb3aae2dd6123884457a367">00316</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 ) { |
229 | | <a name="l00317"></a>00317 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 ); |
230 | | <a name="l00318"></a>00318 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>(); |
231 | | <a name="l00319"></a>00319 <span class="keywordflow">return</span> temp; |
232 | | <a name="l00320"></a>00320 }; |
233 | | <a name="l00322"></a><a class="code" href="classbdm_1_1mpdf.html#afe4185b26baeb03688202e254d3b005">00322</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 ) { |
234 | | <a name="l00323"></a>00323 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 ); |
235 | | <a name="l00324"></a>00324 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>() ); |
236 | | <a name="l00325"></a>00325 <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 );} |
237 | | <a name="l00326"></a>00326 <span class="keywordflow">return</span> temp; |
238 | | <a name="l00327"></a>00327 }; |
239 | | <a name="l00329"></a><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530">00329</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> );}; |
240 | | <a name="l00330"></a>00330 |
241 | | <a name="l00332"></a><a class="code" href="classbdm_1_1mpdf.html#6336a8a72462e2a56a3989a220f18b1b">00332</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 ) { |
242 | | <a name="l00333"></a>00333 <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; |
243 | | <a name="l00334"></a>00334 }; |
244 | | <a name="l00335"></a>00335 |
245 | | <a name="l00337"></a><a class="code" href="classbdm_1_1mpdf.html#0b0ed1ed663071bb7cf4a1349eb94fcb">00337</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 );}; |
246 | | <a name="l00338"></a>00338 |
247 | | <a name="l00341"></a>00341 |
248 | | <a name="l00342"></a>00342 <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>();} |
249 | | <a name="l00343"></a>00343 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>;} |
250 | | <a name="l00344"></a>00344 <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();} |
251 | | <a name="l00345"></a>00345 <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>;} |
252 | | <a name="l00346"></a>00346 epdf& _epdf() {<span class="keywordflow">return</span> *<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>;} |
253 | | <a name="l00347"></a>00347 epdf* _e() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>;} |
254 | | <a name="l00349"></a>00349 |
255 | | <a name="l00352"></a>00352 <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;} |
256 | | <a name="l00353"></a>00353 <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 );} |
257 | | <a name="l00354"></a>00354 <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() );} |
258 | | <a name="l00356"></a>00356 }; |
259 | | <a name="l00357"></a>00357 |
260 | | <a name="l00383"></a><a class="code" href="classbdm_1_1datalink.html">00383</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> { |
261 | | <a name="l00384"></a>00384 <span class="keyword">protected</span>: |
262 | | <a name="l00386"></a><a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c">00386</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>; |
263 | | <a name="l00388"></a><a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045">00388</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>; |
264 | | <a name="l00390"></a><a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb">00390</a> ivec <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>; |
265 | | <a name="l00391"></a>00391 <span class="keyword">public</span>: |
266 | | <a name="l00393"></a><a class="code" href="classbdm_1_1datalink.html#b8b5d5074fc1310a37c3713d58b900e2">00393</a> <a class="code" href="classbdm_1_1datalink.html#b8b5d5074fc1310a37c3713d58b900e2" title="Constructor.">datalink</a> () {}; |
267 | | <a name="l00394"></a>00394 <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 );}; |
268 | | <a name="l00396"></a><a class="code" href="classbdm_1_1datalink.html#fb8337aac8329eb0ca96bfb3ff73ec67">00396</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 ) { |
269 | | <a name="l00397"></a>00397 <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>(); |
270 | | <a name="l00398"></a>00398 <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>(); |
271 | | <a name="l00399"></a>00399 <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 ) ); |
272 | | <a name="l00400"></a>00400 |
273 | | <a name="l00401"></a>00401 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> ); |
274 | | <a name="l00402"></a>00402 } |
275 | | <a name="l00404"></a><a class="code" href="classbdm_1_1datalink.html#724486a37002e7a3a73366c3af9b82ad">00404</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink.html#724486a37002e7a3a73366c3af9b82ad" title="set connection using indeces">set_connection</a> ( <span class="keywordtype">int</span> ds, <span class="keywordtype">int</span> us, <span class="keyword">const</span> ivec &upind ) { |
276 | | <a name="l00405"></a>00405 <a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a> = ds; |
277 | | <a name="l00406"></a>00406 <a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a> = us; |
278 | | <a name="l00407"></a>00407 <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>= upind; |
279 | | <a name="l00408"></a>00408 |
280 | | <a name="l00409"></a>00409 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> ); |
281 | | <a name="l00410"></a>00410 } |
282 | | <a name="l00412"></a><a class="code" href="classbdm_1_1datalink.html#5b5368c3899eed2f670d09142c2548e5">00412</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 ) { |
283 | | <a name="l00413"></a>00413 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> ); |
284 | | <a name="l00414"></a>00414 <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> ); |
285 | | <a name="l00415"></a>00415 } |
286 | | <a name="l00417"></a><a class="code" href="classbdm_1_1datalink.html#610e966f2edb1fcd6a5b28267c571793">00417</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 ) { |
287 | | <a name="l00418"></a>00418 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> ); |
288 | | <a name="l00419"></a>00419 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> ); |
289 | | <a name="l00420"></a>00420 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 ); |
290 | | <a name="l00421"></a>00421 } |
291 | | <a name="l00422"></a>00422 }; |
| 235 | <a name="l00316"></a>00316 <span class="comment">//TODO Samplecond can be generalized</span> |
| 236 | <a name="l00317"></a>00317 |
| 237 | <a name="l00318"></a><a class="code" href="classbdm_1_1mpdf.html">00318</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> { |
| 238 | <a name="l00319"></a>00319 <span class="keyword">protected</span>: |
| 239 | <a name="l00321"></a><a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6">00321</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>; |
| 240 | <a name="l00323"></a><a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288">00323</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>; |
| 241 | <a name="l00325"></a><a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0">00325</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>; |
| 242 | <a name="l00326"></a>00326 <span class="keyword">public</span>: |
| 243 | <a name="l00329"></a>00329 |
| 244 | <a name="l00330"></a>00330 <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> ( ) {}; |
| 245 | <a name="l00332"></a><a class="code" href="classbdm_1_1mpdf.html#7089fcbd918f201fdf4256119e31f173">00332</a> <a class="code" href="classbdm_1_1mpdf.html#7089fcbd918f201fdf4256119e31f173" title="copy constructor does not set pointer ep - has to be done in offsprings!">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> ) {}; |
| 246 | <a name="l00334"></a>00334 |
| 247 | <a name="l00337"></a>00337 |
| 248 | <a name="l00339"></a><a class="code" href="classbdm_1_1mpdf.html#f0c1db6fcbb3aae2dd6123884457a367">00339</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 ) { |
| 249 | <a name="l00340"></a>00340 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 ); |
| 250 | <a name="l00341"></a>00341 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>(); |
| 251 | <a name="l00342"></a>00342 <span class="keywordflow">return</span> temp; |
| 252 | <a name="l00343"></a>00343 }; |
| 253 | <a name="l00345"></a><a class="code" href="classbdm_1_1mpdf.html#afe4185b26baeb03688202e254d3b005">00345</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 ) { |
| 254 | <a name="l00346"></a>00346 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 ); |
| 255 | <a name="l00347"></a>00347 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>() ); |
| 256 | <a name="l00348"></a>00348 <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 );} |
| 257 | <a name="l00349"></a>00349 <span class="keywordflow">return</span> temp; |
| 258 | <a name="l00350"></a>00350 }; |
| 259 | <a name="l00352"></a><a class="code" href="classbdm_1_1mpdf.html#db94784a9aacf74c65c5a014f6743530">00352</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 ) {<a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a> ( <span class="stringliteral">"Not implemented"</span> );}; |
| 260 | <a name="l00353"></a>00353 |
| 261 | <a name="l00355"></a><a class="code" href="classbdm_1_1mpdf.html#6336a8a72462e2a56a3989a220f18b1b">00355</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 ) { |
| 262 | <a name="l00356"></a>00356 <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 ); <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( std::isfinite ( tmp ),<span class="stringliteral">"Infinite value"</span> ); <span class="keywordflow">return</span> tmp; |
| 263 | <a name="l00357"></a>00357 }; |
| 264 | <a name="l00358"></a>00358 |
| 265 | <a name="l00360"></a><a class="code" href="classbdm_1_1mpdf.html#0b0ed1ed663071bb7cf4a1349eb94fcb">00360</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 );}; |
| 266 | <a name="l00361"></a>00361 |
| 267 | <a name="l00364"></a>00364 |
| 268 | <a name="l00365"></a>00365 <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>();} |
| 269 | <a name="l00366"></a>00366 RV _rvc() {<a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( 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>;} |
| 270 | <a name="l00367"></a>00367 <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();} |
| 271 | <a name="l00368"></a>00368 <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>;} |
| 272 | <a name="l00369"></a>00369 epdf& _epdf() {<span class="keywordflow">return</span> *<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>;} |
| 273 | <a name="l00370"></a>00370 epdf* _e() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>;} |
| 274 | <a name="l00372"></a>00372 |
| 275 | <a name="l00375"></a>00375 <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;} |
| 276 | <a name="l00376"></a>00376 <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 );} |
| 277 | <a name="l00377"></a>00377 <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() );} |
| 278 | <a name="l00379"></a>00379 }; |
| 279 | <a name="l00380"></a>00380 |
| 280 | <a name="l00406"></a><a class="code" href="classbdm_1_1datalink.html">00406</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> { |
| 281 | <a name="l00407"></a>00407 <span class="keyword">protected</span>: |
| 282 | <a name="l00409"></a><a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c">00409</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>; |
| 283 | <a name="l00411"></a><a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045">00411</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>; |
| 284 | <a name="l00413"></a><a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb">00413</a> ivec <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>; |
| 285 | <a name="l00414"></a>00414 <span class="keyword">public</span>: |
| 286 | <a name="l00416"></a><a class="code" href="classbdm_1_1datalink.html#b8b5d5074fc1310a37c3713d58b900e2">00416</a> <a class="code" href="classbdm_1_1datalink.html#b8b5d5074fc1310a37c3713d58b900e2" title="Constructor.">datalink</a> () {}; |
| 287 | <a name="l00417"></a>00417 <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 );}; |
| 288 | <a name="l00419"></a><a class="code" href="classbdm_1_1datalink.html#fb8337aac8329eb0ca96bfb3ff73ec67">00419</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 ) { |
| 289 | <a name="l00420"></a>00420 <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>(); |
| 290 | <a name="l00421"></a>00421 <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>(); |
| 291 | <a name="l00422"></a>00422 <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 ) ); |
293 | | <a name="l00425"></a><a class="code" href="classbdm_1_1datalink__m2e.html">00425</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> { |
294 | | <a name="l00426"></a>00426 <span class="keyword">protected</span>: |
295 | | <a name="l00428"></a><a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9">00428</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>; |
296 | | <a name="l00430"></a><a class="code" href="classbdm_1_1datalink__m2e.html#43fe3e2d7aa04134053ec15793722783">00430</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>; |
297 | | <a name="l00432"></a><a class="code" href="classbdm_1_1datalink__m2e.html#9e0048d87bda78e9b8d38761440c7abc">00432</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>; |
298 | | <a name="l00433"></a>00433 |
299 | | <a name="l00434"></a>00434 <span class="keyword">public</span>: |
300 | | <a name="l00435"></a>00435 <a class="code" href="classbdm_1_1datalink__m2e.html" title="data link between">datalink_m2e</a>() {}; |
301 | | <a name="l00437"></a><a class="code" href="classbdm_1_1datalink__m2e.html#add918bf877c48714cff51ee4ad989b0">00437</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__m2e.html#add918bf877c48714cff51ee4ad989b0" title="Constructor.">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> &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 ) { |
302 | | <a name="l00438"></a>00438 <a class="code" href="classbdm_1_1datalink__m2e.html#add918bf877c48714cff51ee4ad989b0" title="Constructor.">datalink::set_connection</a> ( rv,rv_up ); |
303 | | <a name="l00439"></a>00439 <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>= rvc.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(); |
304 | | <a name="l00440"></a>00440 <span class="comment">//establish v2c connection</span> |
305 | | <a name="l00441"></a>00441 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> ); |
306 | | <a name="l00442"></a>00442 } |
307 | | <a name="l00444"></a><a class="code" href="classbdm_1_1datalink__m2e.html#7ba850822e3cf9a4b079afc7e7c01703">00444</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 ) { |
308 | | <a name="l00445"></a>00445 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
309 | | <a name="l00446"></a>00446 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> ) ); |
310 | | <a name="l00447"></a>00447 <span class="keywordflow">return</span> tmp; |
311 | | <a name="l00448"></a>00448 } |
312 | | <a name="l00449"></a>00449 <span class="keywordtype">void</span> pushup_cond ( vec &val_up, <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ) { |
313 | | <a name="l00450"></a>00450 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> ); |
314 | | <a name="l00451"></a>00451 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> ); |
315 | | <a name="l00452"></a>00452 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 ); |
316 | | <a name="l00453"></a>00453 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 ); |
317 | | <a name="l00454"></a>00454 } |
318 | | <a name="l00455"></a>00455 }; |
319 | | <a name="l00458"></a><a class="code" href="classbdm_1_1datalink__m2m.html">00458</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> { |
320 | | <a name="l00459"></a>00459 <span class="keyword">protected</span>: |
321 | | <a name="l00461"></a><a class="code" href="classbdm_1_1datalink__m2m.html#d64dda6f92654628276bbcebb7600d0d">00461</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>; |
322 | | <a name="l00463"></a><a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5">00463</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>; |
323 | | <a name="l00464"></a>00464 <span class="keyword">public</span>: |
324 | | <a name="l00466"></a><a class="code" href="classbdm_1_1datalink__m2m.html#3baed32cb66f0e2f731032cec0a4d287">00466</a> <a class="code" href="classbdm_1_1datalink__m2m.html#3baed32cb66f0e2f731032cec0a4d287" title="Constructor.">datalink_m2m</a>() {}; |
325 | | <a name="l00467"></a>00467 <span class="keywordtype">void</span> set_connection ( <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 ) { |
326 | | <a name="l00468"></a>00468 <a class="code" href="classbdm_1_1datalink__m2e.html#add918bf877c48714cff51ee4ad989b0" title="Constructor.">datalink_m2e::set_connection</a> ( rv, rvc, rv_up ); |
327 | | <a name="l00469"></a>00469 <span class="comment">//establish c2c connection</span> |
328 | | <a name="l00470"></a>00470 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> ); |
329 | | <a name="l00471"></a>00471 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> ); |
330 | | <a name="l00472"></a>00472 } |
331 | | <a name="l00474"></a><a class="code" href="classbdm_1_1datalink__m2m.html#911fb7fcfa80d4e31db8e0cc03141a90">00474</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 ) { |
332 | | <a name="l00475"></a>00475 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
333 | | <a name="l00476"></a>00476 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> ) ); |
334 | | <a name="l00477"></a>00477 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> ) ); |
335 | | <a name="l00478"></a>00478 <span class="keywordflow">return</span> tmp; |
336 | | <a name="l00479"></a>00479 } |
337 | | <a name="l00481"></a>00481 |
338 | | <a name="l00482"></a>00482 }; |
339 | | <a name="l00483"></a>00483 |
340 | | <a name="l00489"></a><a class="code" href="classbdm_1_1logger.html">00489</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> { |
341 | | <a name="l00490"></a>00490 <span class="keyword">protected</span>: |
342 | | <a name="l00492"></a><a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f">00492</a> Array<RV> <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>; |
343 | | <a name="l00494"></a><a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02">00494</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>; |
344 | | <a name="l00495"></a>00495 <span class="keyword">public</span>: |
345 | | <a name="l00497"></a><a class="code" href="classbdm_1_1logger.html#f9c2fe7db5ddbda0098a4a5bd2c29fbf">00497</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 ) {} |
346 | | <a name="l00498"></a>00498 |
347 | | <a name="l00501"></a><a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">00501</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> ) { |
348 | | <a name="l00502"></a>00502 <span class="keywordtype">int</span> id; |
349 | | <a name="l00503"></a>00503 <span class="keywordflow">if</span> ( rv.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() >0 ) { |
350 | | <a name="l00504"></a>00504 <span class="keywordtype">id</span>=<a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.length(); |
351 | | <a name="l00505"></a>00505 <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> |
352 | | <a name="l00506"></a>00506 <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> ); |
353 | | <a name="l00507"></a>00507 <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( <span class="keywordtype">id</span> ) = rv; |
354 | | <a name="l00508"></a>00508 } |
355 | | <a name="l00509"></a>00509 <span class="keywordflow">else</span> { <span class="keywordtype">id</span> =-1;} |
356 | | <a name="l00510"></a>00510 <span class="keywordflow">return</span> id; <span class="comment">// identifier of the last entry</span> |
357 | | <a name="l00511"></a>00511 } |
358 | | <a name="l00512"></a>00512 |
359 | | <a name="l00514"></a>00514 <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; |
360 | | <a name="l00515"></a>00515 |
361 | | <a name="l00517"></a>00517 <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; |
362 | | <a name="l00518"></a>00518 |
363 | | <a name="l00520"></a><a class="code" href="classbdm_1_1logger.html#0e3fc7d13e23a8f71fc7c8a5ea68559d">00520</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>() {}; |
| 293 | <a name="l00424"></a>00424 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( <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> ); |
| 294 | <a name="l00425"></a>00425 } |
| 295 | <a name="l00427"></a><a class="code" href="classbdm_1_1datalink.html#724486a37002e7a3a73366c3af9b82ad">00427</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink.html#724486a37002e7a3a73366c3af9b82ad" title="set connection using indeces">set_connection</a> ( <span class="keywordtype">int</span> ds, <span class="keywordtype">int</span> us, <span class="keyword">const</span> ivec &upind ) { |
| 296 | <a name="l00428"></a>00428 <a class="code" href="classbdm_1_1datalink.html#bc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a> = ds; |
| 297 | <a name="l00429"></a>00429 <a class="code" href="classbdm_1_1datalink.html#0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a> = us; |
| 298 | <a name="l00430"></a>00430 <a class="code" href="classbdm_1_1datalink.html#240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indeces of the upper val">v2v_up</a>= upind; |
| 299 | <a name="l00431"></a>00431 |
| 300 | <a name="l00432"></a>00432 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( <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> ); |
| 301 | <a name="l00433"></a>00433 } |
| 302 | <a name="l00435"></a><a class="code" href="classbdm_1_1datalink.html#5b5368c3899eed2f670d09142c2548e5">00435</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 ) { |
| 303 | <a name="l00436"></a>00436 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( <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> ); |
| 304 | <a name="l00437"></a>00437 <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> ); |
| 305 | <a name="l00438"></a>00438 } |
| 306 | <a name="l00440"></a><a class="code" href="classbdm_1_1datalink.html#610e966f2edb1fcd6a5b28267c571793">00440</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 ) { |
| 307 | <a name="l00441"></a>00441 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( <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> ); |
| 308 | <a name="l00442"></a>00442 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( <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> ); |
| 309 | <a name="l00443"></a>00443 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 ); |
| 310 | <a name="l00444"></a>00444 } |
| 311 | <a name="l00445"></a>00445 }; |
| 312 | <a name="l00446"></a>00446 |
| 313 | <a name="l00448"></a><a class="code" href="classbdm_1_1datalink__m2e.html">00448</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> { |
| 314 | <a name="l00449"></a>00449 <span class="keyword">protected</span>: |
| 315 | <a name="l00451"></a><a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9">00451</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>; |
| 316 | <a name="l00453"></a><a class="code" href="classbdm_1_1datalink__m2e.html#43fe3e2d7aa04134053ec15793722783">00453</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>; |
| 317 | <a name="l00455"></a><a class="code" href="classbdm_1_1datalink__m2e.html#9e0048d87bda78e9b8d38761440c7abc">00455</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>; |
| 318 | <a name="l00456"></a>00456 |
| 319 | <a name="l00457"></a>00457 <span class="keyword">public</span>: |
| 320 | <a name="l00458"></a>00458 <a class="code" href="classbdm_1_1datalink__m2e.html" title="data link between">datalink_m2e</a>() {}; |
| 321 | <a name="l00460"></a><a class="code" href="classbdm_1_1datalink__m2e.html#add918bf877c48714cff51ee4ad989b0">00460</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__m2e.html#add918bf877c48714cff51ee4ad989b0" title="Constructor.">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> &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 ) { |
| 322 | <a name="l00461"></a>00461 <a class="code" href="classbdm_1_1datalink__m2e.html#add918bf877c48714cff51ee4ad989b0" title="Constructor.">datalink::set_connection</a> ( rv,rv_up ); |
| 323 | <a name="l00462"></a>00462 <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>= rvc.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(); |
| 324 | <a name="l00463"></a>00463 <span class="comment">//establish v2c connection</span> |
| 325 | <a name="l00464"></a>00464 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> ); |
| 326 | <a name="l00465"></a>00465 } |
| 327 | <a name="l00467"></a><a class="code" href="classbdm_1_1datalink__m2e.html#7ba850822e3cf9a4b079afc7e7c01703">00467</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 ) { |
| 328 | <a name="l00468"></a>00468 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
| 329 | <a name="l00469"></a>00469 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> ) ); |
| 330 | <a name="l00470"></a>00470 <span class="keywordflow">return</span> tmp; |
| 331 | <a name="l00471"></a>00471 } |
| 332 | <a name="l00472"></a>00472 <span class="keywordtype">void</span> pushup_cond ( vec &val_up, <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ) { |
| 333 | <a name="l00473"></a>00473 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( <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> ); |
| 334 | <a name="l00474"></a>00474 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( <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> ); |
| 335 | <a name="l00475"></a>00475 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 ); |
| 336 | <a name="l00476"></a>00476 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 ); |
| 337 | <a name="l00477"></a>00477 } |
| 338 | <a name="l00478"></a>00478 }; |
| 339 | <a name="l00481"></a><a class="code" href="classbdm_1_1datalink__m2m.html">00481</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> { |
| 340 | <a name="l00482"></a>00482 <span class="keyword">protected</span>: |
| 341 | <a name="l00484"></a><a class="code" href="classbdm_1_1datalink__m2m.html#d64dda6f92654628276bbcebb7600d0d">00484</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>; |
| 342 | <a name="l00486"></a><a class="code" href="classbdm_1_1datalink__m2m.html#0ea05c47de4538b7042ff878e6e309a5">00486</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>; |
| 343 | <a name="l00487"></a>00487 <span class="keyword">public</span>: |
| 344 | <a name="l00489"></a><a class="code" href="classbdm_1_1datalink__m2m.html#3baed32cb66f0e2f731032cec0a4d287">00489</a> <a class="code" href="classbdm_1_1datalink__m2m.html#3baed32cb66f0e2f731032cec0a4d287" title="Constructor.">datalink_m2m</a>() {}; |
| 345 | <a name="l00490"></a>00490 <span class="keywordtype">void</span> set_connection ( <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 ) { |
| 346 | <a name="l00491"></a>00491 <a class="code" href="classbdm_1_1datalink__m2e.html#add918bf877c48714cff51ee4ad989b0" title="Constructor.">datalink_m2e::set_connection</a> ( rv, rvc, rv_up ); |
| 347 | <a name="l00492"></a>00492 <span class="comment">//establish c2c connection</span> |
| 348 | <a name="l00493"></a>00493 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> ); |
| 349 | <a name="l00494"></a>00494 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( <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> ); |
| 350 | <a name="l00495"></a>00495 } |
| 351 | <a name="l00497"></a><a class="code" href="classbdm_1_1datalink__m2m.html#911fb7fcfa80d4e31db8e0cc03141a90">00497</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 ) { |
| 352 | <a name="l00498"></a>00498 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
| 353 | <a name="l00499"></a>00499 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> ) ); |
| 354 | <a name="l00500"></a>00500 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> ) ); |
| 355 | <a name="l00501"></a>00501 <span class="keywordflow">return</span> tmp; |
| 356 | <a name="l00502"></a>00502 } |
| 357 | <a name="l00504"></a>00504 |
| 358 | <a name="l00505"></a>00505 }; |
| 359 | <a name="l00506"></a>00506 |
| 360 | <a name="l00512"></a><a class="code" href="classbdm_1_1logger.html">00512</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> { |
| 361 | <a name="l00513"></a>00513 <span class="keyword">protected</span>: |
| 362 | <a name="l00515"></a><a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f">00515</a> <a class="code" href="classitpp_1_1Array.html">Array<RV></a> <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>; |
| 363 | <a name="l00517"></a><a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02">00517</a> <a class="code" href="classitpp_1_1Array.html">Array<string></a> <a class="code" href="classbdm_1_1logger.html#68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>; |
| 364 | <a name="l00518"></a>00518 <span class="keyword">public</span>: |
| 365 | <a name="l00520"></a><a class="code" href="classbdm_1_1logger.html#f9c2fe7db5ddbda0098a4a5bd2c29fbf">00520</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 ) {} |
365 | | <a name="l00523"></a><a class="code" href="classbdm_1_1logger.html#cd6291a73491f755dc7bc88d022eb2fc">00523</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>() {}; |
366 | | <a name="l00524"></a>00524 |
367 | | <a name="l00525"></a>00525 }; |
368 | | <a name="l00526"></a>00526 |
369 | | <a name="l00530"></a><a class="code" href="classbdm_1_1mepdf.html">00530</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> { |
370 | | <a name="l00531"></a>00531 <span class="keyword">public</span>: |
371 | | <a name="l00533"></a><a class="code" href="classbdm_1_1mepdf.html#8c320c7f878fb665e93aec1499ef53ff">00533</a> <a class="code" href="classbdm_1_1mepdf.html#8c320c7f878fb665e93aec1499ef53ff" title="Default constructor.">mepdf</a> ( <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>= em ;}; |
372 | | <a name="l00534"></a>00534 <a class="code" href="classbdm_1_1mepdf.html#8c320c7f878fb665e93aec1499ef53ff" 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 );}; |
373 | | <a name="l00535"></a><a class="code" href="classbdm_1_1mepdf.html#b2b898058169e7ed9a6dc7cd4e1c147c">00535</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 ) {} |
374 | | <a name="l00536"></a>00536 }; |
375 | | <a name="l00537"></a>00537 |
376 | | <a name="l00540"></a><a class="code" href="classbdm_1_1compositepdf.html">00540</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> { |
377 | | <a name="l00541"></a>00541 <span class="keyword">protected</span>: |
378 | | <a name="l00543"></a><a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a">00543</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a>; |
379 | | <a name="l00545"></a><a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a">00545</a> Array<mpdf*> <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>; |
380 | | <a name="l00546"></a>00546 <span class="keyword">public</span>: |
381 | | <a name="l00547"></a>00547 <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 ) {}; |
382 | | <a name="l00549"></a>00549 <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> ); |
383 | | <a name="l00551"></a>00551 <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 ); |
384 | | <a name="l00552"></a>00552 }; |
385 | | <a name="l00553"></a>00553 |
386 | | <a name="l00561"></a><a class="code" href="classbdm_1_1DS.html">00561</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> { |
387 | | <a name="l00562"></a>00562 <span class="keyword">protected</span>: |
388 | | <a name="l00563"></a>00563 <span class="keywordtype">int</span> dtsize; |
389 | | <a name="l00564"></a>00564 <span class="keywordtype">int</span> utsize; |
390 | | <a name="l00566"></a><a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec">00566</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>; |
391 | | <a name="l00568"></a><a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702">00568</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> |
392 | | <a name="l00570"></a><a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867">00570</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; |
| 367 | <a name="l00524"></a><a class="code" href="classbdm_1_1logger.html#47aa3b098a81d02a8ffaea2c9fa09ac7">00524</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> prefix=<span class="stringliteral">""</span> ) { |
| 368 | <a name="l00525"></a>00525 <span class="keywordtype">int</span> id; |
| 369 | <a name="l00526"></a>00526 <span class="keywordflow">if</span> ( rv.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() >0 ) { |
| 370 | <a name="l00527"></a>00527 <span class="keywordtype">id</span>=<a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.<a class="code" href="classitpp_1_1Array.html#53629018f146084de506c33c69fa19a3" title="Returns the number of data elements in the array object.">length</a>(); |
| 371 | <a name="l00528"></a>00528 <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>, prefix); <span class="comment">// diff</span> |
| 372 | <a name="l00529"></a>00529 <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.<a class="code" href="classitpp_1_1Array.html#3709407656d26aae2c5d3e844316d4e0" title="Resizing an Array&lt;T&gt;.">set_length</a> ( <span class="keywordtype">id</span>+1,<span class="keyword">true</span> ); |
| 373 | <a name="l00530"></a>00530 <a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( <span class="keywordtype">id</span> ) = rv; |
| 374 | <a name="l00531"></a>00531 } |
| 375 | <a name="l00532"></a>00532 <span class="keywordflow">else</span> { <span class="keywordtype">id</span> =-1;} |
| 376 | <a name="l00533"></a>00533 <span class="keywordflow">return</span> id; <span class="comment">// identifier of the last entry</span> |
| 377 | <a name="l00534"></a>00534 } |
| 378 | <a name="l00535"></a>00535 |
| 379 | <a name="l00537"></a>00537 <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; |
| 380 | <a name="l00539"></a>00539 <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> <span class="keywordtype">double</span> &d ) =0; |
| 381 | <a name="l00540"></a>00540 |
| 382 | <a name="l00542"></a>00542 <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; |
| 383 | <a name="l00543"></a>00543 |
| 384 | <a name="l00545"></a><a class="code" href="classbdm_1_1logger.html#0e3fc7d13e23a8f71fc7c8a5ea68559d">00545</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>() {}; |
| 385 | <a name="l00546"></a>00546 |
| 386 | <a name="l00548"></a><a class="code" href="classbdm_1_1logger.html#cd6291a73491f755dc7bc88d022eb2fc">00548</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>() {}; |
| 387 | <a name="l00549"></a>00549 |
| 388 | <a name="l00550"></a>00550 }; |
| 389 | <a name="l00551"></a>00551 |
| 390 | <a name="l00555"></a><a class="code" href="classbdm_1_1mepdf.html">00555</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> { |
| 391 | <a name="l00556"></a>00556 <span class="keyword">public</span>: |
| 392 | <a name="l00558"></a><a class="code" href="classbdm_1_1mepdf.html#8c320c7f878fb665e93aec1499ef53ff">00558</a> <a class="code" href="classbdm_1_1mepdf.html#8c320c7f878fb665e93aec1499ef53ff" title="Default constructor.">mepdf</a> ( <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>= em ;}; |
| 393 | <a name="l00559"></a>00559 <a class="code" href="classbdm_1_1mepdf.html#8c320c7f878fb665e93aec1499ef53ff" 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 );}; |
| 394 | <a name="l00560"></a><a class="code" href="classbdm_1_1mepdf.html#b2b898058169e7ed9a6dc7cd4e1c147c">00560</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 ) {} |
| 395 | <a name="l00561"></a>00561 }; |
| 396 | <a name="l00562"></a>00562 |
| 397 | <a name="l00565"></a><a class="code" href="classbdm_1_1compositepdf.html">00565</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> { |
| 398 | <a name="l00566"></a>00566 <span class="keyword">protected</span>: |
| 399 | <a name="l00568"></a><a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a">00568</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a>; |
| 400 | <a name="l00570"></a><a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a">00570</a> <a class="code" href="classitpp_1_1Array.html">Array<mpdf*></a> <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>; |
394 | | <a name="l00573"></a><a class="code" href="classbdm_1_1DS.html#bedd82e08ae6686b4b1732a122c2201a">00573</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> ( ) {}; |
395 | | <a name="l00575"></a><a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba">00575</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> );}; |
396 | | <a name="l00577"></a><a class="code" href="classbdm_1_1DS.html#a0bf451c7fea73ff4150ff9e83da4832">00577</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a0bf451c7fea73ff4150ff9e83da4832" title="Returns data records at indeces.">getdata</a> ( vec &dt, <span class="keyword">const</span> ivec &indeces ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
397 | | <a name="l00579"></a><a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a">00579</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> );}; |
398 | | <a name="l00581"></a><a class="code" href="classbdm_1_1DS.html#6bced13f84f6bf04449728817e049e1d">00581</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#6bced13f84f6bf04449728817e049e1d" title="Accepts action variables at specific indeces.">write</a> ( vec &ut, <span class="keyword">const</span> ivec &indeces ) {it_error ( <span class="stringliteral">"abstract class"</span> );}; |
399 | | <a name="l00582"></a>00582 |
400 | | <a name="l00584"></a>00584 <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; |
401 | | <a name="l00585"></a>00585 |
402 | | <a name="l00587"></a><a class="code" href="classbdm_1_1DS.html#3c9e417d85052396fe74c164857ee67e">00587</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 ) { |
403 | | <a name="l00588"></a>00588 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> ); |
404 | | <a name="l00589"></a>00589 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> ); |
405 | | <a name="l00590"></a>00590 |
406 | | <a name="l00591"></a>00591 <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> ); |
407 | | <a name="l00592"></a>00592 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> ); |
408 | | <a name="l00593"></a>00593 } |
409 | | <a name="l00595"></a><a class="code" href="classbdm_1_1DS.html#e03d2c93cddd5c3a03107ddd3ae999cf">00595</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 ) { |
410 | | <a name="l00596"></a>00596 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>() ); |
411 | | <a name="l00597"></a>00597 <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( tmp ); |
412 | | <a name="l00598"></a>00598 <span class="comment">// d is first in getdata</span> |
413 | | <a name="l00599"></a>00599 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>() ) ); |
414 | | <a name="l00600"></a>00600 <span class="comment">// u follows after d in getdata</span> |
415 | | <a name="l00601"></a>00601 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>() ) ); |
416 | | <a name="l00602"></a>00602 } |
417 | | <a name="l00604"></a><a class="code" href="classbdm_1_1DS.html#ed2113851294ed96abe60fc3f05aa660">00604</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> );} |
418 | | <a name="l00606"></a><a class="code" href="classbdm_1_1DS.html#a6a9a375da64c82fc227bda3418a1f33">00606</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>;} |
419 | | <a name="l00607"></a>00607 }; |
420 | | <a name="l00608"></a>00608 |
421 | | <a name="l00630"></a><a class="code" href="classbdm_1_1BM.html">00630</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> { |
422 | | <a name="l00631"></a>00631 <span class="keyword">protected</span>: |
423 | | <a name="l00633"></a><a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed">00633</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>; |
424 | | <a name="l00635"></a><a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a">00635</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
425 | | <a name="l00637"></a><a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee">00637</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>; |
426 | | <a name="l00638"></a>00638 <span class="keyword">public</span>: |
427 | | <a name="l00641"></a>00641 |
428 | | <a name="l00642"></a>00642 <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> ( true ), <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 3 ), <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a> ( false ) {}; |
429 | | <a name="l00643"></a>00643 <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> ) {} |
430 | | <a name="l00646"></a><a class="code" href="classbdm_1_1BM.html#40f01563651c1e4fe926189e41a6b8ab">00646</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#40f01563651c1e4fe926189e41a6b8ab">_copy_</a> ()<span class="keyword"> const </span>{<span class="keywordflow">return</span> NULL;}; |
431 | | <a name="l00648"></a>00648 |
432 | | <a name="l00651"></a>00651 |
433 | | <a name="l00655"></a>00655 <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; |
434 | | <a name="l00657"></a>00657 <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 ); |
435 | | <a name="l00660"></a><a class="code" href="classbdm_1_1BM.html#50257e0c1e5b5c73153ea6e716ad8ae0">00660</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;} |
436 | | <a name="l00662"></a><a class="code" href="classbdm_1_1BM.html#0e8ebe61fb14990abe1254bd3dda5fae">00662</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;} |
437 | | <a name="l00663"></a>00663 |
438 | | <a name="l00665"></a><a class="code" href="classbdm_1_1BM.html#688d7a2aced1e06aa1c468d73a9e5eba">00665</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;}; |
439 | | <a name="l00667"></a><a class="code" href="classbdm_1_1BM.html#598b25e3f3d96a5bc00a5faeb5b3c912">00667</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;}; |
440 | | <a name="l00669"></a>00669 |
441 | | <a name="l00674"></a>00674 |
442 | | <a name="l00676"></a><a class="code" href="classbdm_1_1BM.html#de95c590d650b2db423d53992f0906cb">00676</a> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rvc; |
443 | | <a name="l00678"></a><a class="code" href="classbdm_1_1BM.html#b5e8e016be16e4029c789063cb3f3b33">00678</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1BM.html#b5e8e016be16e4029c789063cb3f3b33" title="access function">_rvc</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> rvc;} |
| 402 | <a name="l00572"></a>00572 <a class="code" href="classbdm_1_1compositepdf.html" title="Abstract composition of pdfs, will be used for specific classes this abstract class...">compositepdf</a> ( <a class="code" href="classitpp_1_1Array.html">Array<mpdf*></a> A0 ) : <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ( A0.<a class="code" href="group__matrix__functions.html#g97bb6b35d6d4c683c7558842e4500c2d" title="Length of vector.">length</a>() ), <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( A0 ) {}; |
| 403 | <a name="l00574"></a>00574 <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> ); |
| 404 | <a name="l00576"></a>00576 <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 ); |
| 405 | <a name="l00577"></a>00577 }; |
| 406 | <a name="l00578"></a>00578 |
| 407 | <a name="l00586"></a><a class="code" href="classbdm_1_1DS.html">00586</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> { |
| 408 | <a name="l00587"></a>00587 <span class="keyword">protected</span>: |
| 409 | <a name="l00588"></a>00588 <span class="keywordtype">int</span> dtsize; |
| 410 | <a name="l00589"></a>00589 <span class="keywordtype">int</span> utsize; |
| 411 | <a name="l00591"></a><a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec">00591</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>; |
| 412 | <a name="l00593"></a><a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702">00593</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> |
| 413 | <a name="l00595"></a><a class="code" href="classbdm_1_1DS.html#b4b7bdb9d98a11ab587aa0ad803bb867">00595</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; |
| 414 | <a name="l00596"></a>00596 <span class="keyword">public</span>: |
| 415 | <a name="l00598"></a><a class="code" href="classbdm_1_1DS.html#bedd82e08ae6686b4b1732a122c2201a">00598</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> ( ) {}; |
| 416 | <a name="l00600"></a><a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba">00600</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 ) {<a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a> ( <span class="stringliteral">"abstract class"</span> );}; |
| 417 | <a name="l00602"></a><a class="code" href="classbdm_1_1DS.html#a0bf451c7fea73ff4150ff9e83da4832">00602</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a0bf451c7fea73ff4150ff9e83da4832" title="Returns data records at indeces.">getdata</a> ( vec &dt, <span class="keyword">const</span> ivec &indeces ) {<a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a> ( <span class="stringliteral">"abstract class"</span> );}; |
| 418 | <a name="l00604"></a><a class="code" href="classbdm_1_1DS.html#f5baeee8528e5e4c5c7a344b2e3f192a">00604</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 ) {<a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a> ( <span class="stringliteral">"abstract class"</span> );}; |
| 419 | <a name="l00606"></a><a class="code" href="classbdm_1_1DS.html#6bced13f84f6bf04449728817e049e1d">00606</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#6bced13f84f6bf04449728817e049e1d" title="Accepts action variables at specific indeces.">write</a> ( vec &ut, <span class="keyword">const</span> ivec &indeces ) {<a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a> ( <span class="stringliteral">"abstract class"</span> );}; |
| 420 | <a name="l00607"></a>00607 |
| 421 | <a name="l00609"></a>00609 <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; |
| 422 | <a name="l00610"></a>00610 |
| 423 | <a name="l00612"></a><a class="code" href="classbdm_1_1DS.html#3c9e417d85052396fe74c164857ee67e">00612</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 ) { |
| 424 | <a name="l00613"></a>00613 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( 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> ); |
| 425 | <a name="l00614"></a>00614 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a> ( 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> ); |
| 426 | <a name="l00615"></a>00615 |
| 427 | <a name="l00616"></a>00616 <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#47aa3b098a81d02a8ffaea2c9fa09ac7">add</a> ( <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>,<span class="stringliteral">""</span> ); |
| 428 | <a name="l00617"></a>00617 L_ut=L.<a class="code" href="classbdm_1_1logger.html#47aa3b098a81d02a8ffaea2c9fa09ac7">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> ); |
| 429 | <a name="l00618"></a>00618 } |
| 430 | <a name="l00620"></a><a class="code" href="classbdm_1_1DS.html#e03d2c93cddd5c3a03107ddd3ae999cf">00620</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 ) { |
| 431 | <a name="l00621"></a>00621 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>() ); |
| 432 | <a name="l00622"></a>00622 <a class="code" href="classbdm_1_1DS.html#c1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( tmp ); |
| 433 | <a name="l00623"></a>00623 <span class="comment">// d is first in getdata</span> |
| 434 | <a name="l00624"></a>00624 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>() ) ); |
| 435 | <a name="l00625"></a>00625 <span class="comment">// u follows after d in getdata</span> |
| 436 | <a name="l00626"></a>00626 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>() ) ); |
| 437 | <a name="l00627"></a>00627 } |
| 438 | <a name="l00629"></a><a class="code" href="classbdm_1_1DS.html#ed2113851294ed96abe60fc3f05aa660">00629</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> );} |
| 439 | <a name="l00631"></a><a class="code" href="classbdm_1_1DS.html#a6a9a375da64c82fc227bda3418a1f33">00631</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>;} |
| 440 | <a name="l00633"></a><a class="code" href="classbdm_1_1DS.html#821297dfd839d68691324f024e57252f">00633</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#821297dfd839d68691324f024e57252f" title="set random rvariables">set_drv</a> (<span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &drv, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &urv) { <a class="code" href="classbdm_1_1DS.html#d8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>=drv;<a class="code" href="classbdm_1_1DS.html#9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>=urv;} |
| 441 | <a name="l00634"></a>00634 }; |
| 442 | <a name="l00635"></a>00635 |
| 443 | <a name="l00657"></a><a class="code" href="classbdm_1_1BM.html">00657</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> { |
| 444 | <a name="l00658"></a>00658 <span class="keyword">protected</span>: |
| 445 | <a name="l00660"></a><a class="code" href="classbdm_1_1BM.html#c400357e37d27a4834b2b1d9211009ed">00660</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>; |
| 446 | <a name="l00662"></a><a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a">00662</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
| 447 | <a name="l00664"></a><a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee">00664</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>; |
| 448 | <a name="l00665"></a>00665 <span class="keyword">public</span>: |
| 449 | <a name="l00668"></a>00668 |
| 450 | <a name="l00669"></a>00669 <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> ( true ), <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 4 ), <a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(4) { |
| 451 | <a name="l00670"></a>00670 <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a>=-1;<span class="comment">/*empty IDs*/</span> <a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>=0; <a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(0)=1;<span class="comment">/*log only mean*/</span>}; |
| 452 | <a name="l00671"></a>00671 <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> ) {} |
| 453 | <a name="l00674"></a><a class="code" href="classbdm_1_1BM.html#40f01563651c1e4fe926189e41a6b8ab">00674</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#40f01563651c1e4fe926189e41a6b8ab">_copy_</a> ()<span class="keyword"> const </span>{<span class="keywordflow">return</span> NULL;}; |
| 454 | <a name="l00676"></a>00676 |
471 | | <a name="l00717"></a>00717 <span class="comment">// Add mean value</span> |
472 | | <a name="l00718"></a>00718 <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 0 ) =L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( r,name ); |
473 | | <a name="l00719"></a>00719 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a> ) { |
474 | | <a name="l00720"></a>00720 <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 1 ) =L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( r,name+<span class="stringliteral">"_lb"</span> ); |
475 | | <a name="l00721"></a>00721 <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 2 ) =L.<a class="code" href="classbdm_1_1logger.html#cfb4807e20b3d00f3d33e55ada528dc1">add</a> ( r,name+<span class="stringliteral">"_ub"</span> ); |
476 | | <a name="l00722"></a>00722 } |
477 | | <a name="l00723"></a>00723 } |
478 | | <a name="l00724"></a>00724 <span class="keyword">virtual</span> <span class="keywordtype">void</span> logit ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
479 | | <a name="l00725"></a>00725 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 0 ), posterior().mean() ); |
480 | | <a name="l00726"></a>00726 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a5e0000d2c9df99b029eceff222f7d77" title="Option for logging bounds.">opt_L_bounds</a> ) { |
481 | | <a name="l00727"></a>00727 vec ub,lb; |
482 | | <a name="l00728"></a>00728 posterior().<a class="code" href="classbdm_1_1epdf.html#0a7705e80601957f7226d333a0a6d539" title="Lower and upper bounds of percentage % quantile, returns mean-2*sigma as default...">qbounds</a> ( lb,ub ); |
483 | | <a name="l00729"></a>00729 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 1 ), lb ); |
484 | | <a name="l00730"></a>00730 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a> ( 2 ), ub ); |
485 | | <a name="l00731"></a>00731 } |
486 | | <a name="l00732"></a>00732 } |
487 | | <a name="l00734"></a>00734 }; |
488 | | <a name="l00735"></a>00735 |
489 | | <a name="l00736"></a>00736 }; <span class="comment">//namespace</span> |
490 | | <a name="l00737"></a>00737 <span class="preprocessor">#endif // BM_H</span> |
| 473 | <a name="l00717"></a>00717 <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>;} |
| 474 | <a name="l00718"></a>00718 <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;} |
| 475 | <a name="l00719"></a>00719 <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 );} |
| 476 | <a name="l00720"></a>00720 <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>;} |
| 477 | <a name="l00721"></a>00721 <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;} |
| 478 | <a name="l00722"></a>00722 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf& posterior() <span class="keyword">const</span> =0; |
| 479 | <a name="l00723"></a>00723 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf* _e() <span class="keyword">const</span> =0; |
| 480 | <a name="l00725"></a>00725 |
| 481 | <a name="l00728"></a>00728 |
| 482 | <a name="l00730"></a><a class="code" href="classbdm_1_1BM.html#adb539fa2585c8a2a91c54e5aebf330e">00730</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#adb539fa2585c8a2a91c54e5aebf330e" title="Set boolean options from a string recognized are: &quot;logbounds,logll&quot;.">set_options</a> ( <span class="keyword">const</span> <span class="keywordtype">string</span> &opt ) { |
| 483 | <a name="l00731"></a>00731 <a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(0)=1; |
| 484 | <a name="l00732"></a>00732 <span class="keywordflow">if</span> ( opt.find ( <span class="stringliteral">"logbounds"</span> ) !=string::npos ) {<a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(1)=1; <a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(2)=1;} |
| 485 | <a name="l00733"></a>00733 <span class="keywordflow">if</span> ( opt.find ( <span class="stringliteral">"logll"</span> ) !=string::npos ) {<a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(3)=1;} |
| 486 | <a name="l00734"></a>00734 } |
| 487 | <a name="l00736"></a><a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca">00736</a> ivec <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a>; |
| 488 | <a name="l00737"></a>00737 |
| 489 | <a name="l00739"></a><a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207">00739</a> ivec <a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>; |
| 490 | <a name="l00741"></a><a class="code" href="classbdm_1_1BM.html#2298ca6af9b13a78a4c9e18ab43f1827">00741</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#2298ca6af9b13a78a4c9e18ab43f1827" title="Add all logged variables to a logger.">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, <span class="keyword">const</span> <span class="keywordtype">string</span> &name=<span class="stringliteral">""</span> ) { |
| 491 | <a name="l00742"></a>00742 <span class="comment">// internal</span> |
| 492 | <a name="l00743"></a>00743 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> r; |
| 493 | <a name="l00744"></a>00744 <span class="keywordflow">if</span> ( posterior().isnamed() ) {r=posterior().<a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>();} |
| 494 | <a name="l00745"></a>00745 <span class="keywordflow">else</span>{r=<a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ( <span class="stringliteral">"est"</span>, posterior().dimension() );}; |
| 495 | <a name="l00746"></a>00746 |
| 496 | <a name="l00747"></a>00747 <span class="comment">// Add mean value</span> |
| 497 | <a name="l00748"></a>00748 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(0)) <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 0 ) =L.<a class="code" href="classbdm_1_1logger.html#47aa3b098a81d02a8ffaea2c9fa09ac7">add</a> ( r,name+<span class="stringliteral">"mean_"</span> ); |
| 498 | <a name="l00749"></a>00749 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(1)) <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 1 ) =L.<a class="code" href="classbdm_1_1logger.html#47aa3b098a81d02a8ffaea2c9fa09ac7">add</a> ( r,name+<span class="stringliteral">"lb_"</span> ); |
| 499 | <a name="l00750"></a>00750 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(2)) <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 2 ) =L.<a class="code" href="classbdm_1_1logger.html#47aa3b098a81d02a8ffaea2c9fa09ac7">add</a> ( r,name+<span class="stringliteral">"ub_"</span> ); |
| 500 | <a name="l00751"></a>00751 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(3)) <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 3 ) =L.<a class="code" href="classbdm_1_1logger.html#47aa3b098a81d02a8ffaea2c9fa09ac7">add</a> ( <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>(<span class="stringliteral">"ll"</span>,1),name ); <span class="comment">//TODO: "local" RV </span> |
| 501 | <a name="l00752"></a>00752 } |
| 502 | <a name="l00753"></a>00753 <span class="keyword">virtual</span> <span class="keywordtype">void</span> logit ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
| 503 | <a name="l00754"></a>00754 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 0 ), posterior().<a class="code" href="group__statistics.html#gc370b4cfdc6baa037b7442ae6e2c4b5c" title="The mean value.">mean</a>() ); |
| 504 | <a name="l00755"></a>00755 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(1) || <a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(2)) { <span class="comment">//if one of them is off, its LID==-1 and will not be stored</span> |
| 505 | <a name="l00756"></a>00756 vec ub,lb; |
| 506 | <a name="l00757"></a>00757 posterior().<a class="code" href="classbdm_1_1epdf.html#0a7705e80601957f7226d333a0a6d539" title="Lower and upper bounds of percentage % quantile, returns mean-2*sigma as default...">qbounds</a> ( lb,ub ); |
| 507 | <a name="l00758"></a>00758 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 1 ), lb ); |
| 508 | <a name="l00759"></a>00759 L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 2 ), ub ); |
| 509 | <a name="l00760"></a>00760 } |
| 510 | <a name="l00761"></a>00761 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1BM.html#398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>(3)) L.<a class="code" href="classbdm_1_1logger.html#397c014b0aaf3581516e2a105d26a5c9" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 3 ), <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ); |
| 511 | <a name="l00762"></a>00762 } |
| 512 | <a name="l00764"></a>00764 }; |
| 513 | <a name="l00765"></a>00765 |
| 514 | <a name="l00766"></a>00766 |
| 515 | <a name="l00767"></a>00767 }; <span class="comment">//namespace</span> |
| 516 | <a name="l00768"></a>00768 <span class="preprocessor">#endif // BM_H</span> |