82 | | <a name="l00027"></a>00027 <span class="keyword">namespace </span>bdm |
83 | | <a name="l00028"></a>00028 { |
84 | | <a name="l00029"></a>00029 |
85 | | <a name="l00030"></a>00030 <span class="keyword">typedef</span> std::map<string, int> RVmap; |
86 | | <a name="l00032"></a>00032 <span class="keyword">extern</span> ivec RV_SIZES; |
87 | | <a name="l00034"></a>00034 <span class="keyword">extern</span> Array<string> RV_NAMES; |
88 | | <a name="l00035"></a>00035 |
89 | | <a name="l00037"></a><a class="code" href="classbdm_1_1str.html">00037</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1str.html" title="Structure of RV, i.e. RVs expanded into a flat list of IDs, used for debugging.">str</a> |
90 | | <a name="l00038"></a>00038 { |
91 | | <a name="l00039"></a>00039 <span class="keyword">public</span>: |
92 | | <a name="l00041"></a><a class="code" href="classbdm_1_1str.html#a64675a73fc7324177175f19b3baeb0b0">00041</a> ivec <a class="code" href="classbdm_1_1str.html#a64675a73fc7324177175f19b3baeb0b0" title="vector id ids (non-unique!)">ids</a>; |
93 | | <a name="l00043"></a><a class="code" href="classbdm_1_1str.html#a905dc0f240e40432c103708c4a34f80a">00043</a> ivec <a class="code" href="classbdm_1_1str.html#a905dc0f240e40432c103708c4a34f80a" title="vector of times">times</a>; |
94 | | <a name="l00045"></a><a class="code" href="classbdm_1_1str.html#a7c6b9dccc6814d7bd1e8e2208a0d3f3f">00045</a> <a class="code" href="classbdm_1_1str.html#a7c6b9dccc6814d7bd1e8e2208a0d3f3f" title="Default constructor.">str</a> (ivec ids0, ivec times0) : <a class="code" href="classbdm_1_1str.html#a64675a73fc7324177175f19b3baeb0b0" title="vector id ids (non-unique!)">ids</a> (ids0), <a class="code" href="classbdm_1_1str.html#a905dc0f240e40432c103708c4a34f80a" title="vector of times">times</a> (times0) { |
95 | | <a name="l00046"></a>00046 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> (times0.length() == ids0.length(), <span class="stringliteral">"Incompatible input"</span>); |
96 | | <a name="l00047"></a>00047 }; |
97 | | <a name="l00048"></a>00048 }; |
98 | | <a name="l00049"></a>00049 |
99 | | <a name="l00088"></a><a class="code" href="classbdm_1_1RV.html">00088</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_1root.html" title="Root class of BDM objects.">root</a> |
100 | | <a name="l00089"></a>00089 { |
101 | | <a name="l00090"></a>00090 <span class="keyword">protected</span>: |
102 | | <a name="l00092"></a><a class="code" href="classbdm_1_1RV.html#a0cfe477965243a89eb87a06b024e2fcb">00092</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#a0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a>; |
103 | | <a name="l00094"></a><a class="code" href="classbdm_1_1RV.html#ab11bfdceb831ed30d33b852dd4a6b385">00094</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#ab11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a>; |
104 | | <a name="l00096"></a><a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b">00096</a> ivec <a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a>; |
105 | | <a name="l00098"></a><a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896">00098</a> ivec <a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a>; |
106 | | <a name="l00099"></a>00099 |
107 | | <a name="l00100"></a>00100 <span class="keyword">private</span>: |
108 | | <a name="l00102"></a>00102 <span class="keywordtype">void</span> init (<span class="keyword">const</span> Array<std::string> &in_names, <span class="keyword">const</span> ivec &in_sizes, <span class="keyword">const</span> ivec &in_times); |
109 | | <a name="l00103"></a>00103 <span class="keywordtype">int</span> init (<span class="keyword">const</span> <span class="keywordtype">string</span> &name, <span class="keywordtype">int</span> size); |
110 | | <a name="l00104"></a>00104 <span class="keyword">public</span>: |
111 | | <a name="l00107"></a>00107 |
112 | | <a name="l00109"></a><a class="code" href="classbdm_1_1RV.html#a3fa35c2744e687c74f7742990e6aa264">00109</a> <a class="code" href="classbdm_1_1RV.html#a3fa35c2744e687c74f7742990e6aa264" title="Full constructor.">RV</a> (<span class="keyword">const</span> Array<std::string> &in_names, <span class="keyword">const</span> ivec &in_sizes, <span class="keyword">const</span> ivec &in_times) { |
113 | | <a name="l00110"></a>00110 init (in_names, in_sizes, in_times); |
114 | | <a name="l00111"></a>00111 } |
115 | | <a name="l00112"></a>00112 |
116 | | <a name="l00114"></a><a class="code" href="classbdm_1_1RV.html#a381f5d963bb54efd4e76815dc93d50ce">00114</a> <a class="code" href="classbdm_1_1RV.html#a381f5d963bb54efd4e76815dc93d50ce" title="Constructor with times=0.">RV</a> (<span class="keyword">const</span> Array<std::string> &in_names, <span class="keyword">const</span> ivec &in_sizes) { |
117 | | <a name="l00115"></a>00115 init (in_names, in_sizes, zeros_i (in_names.length())); |
118 | | <a name="l00116"></a>00116 } |
119 | | <a name="l00117"></a>00117 |
120 | | <a name="l00119"></a><a class="code" href="classbdm_1_1RV.html#acb47d71d82639ec7ddf2635b21aafd00">00119</a> <a class="code" href="classbdm_1_1RV.html#acb47d71d82639ec7ddf2635b21aafd00" title="Constructor with sizes=1, times=0.">RV</a> (<span class="keyword">const</span> Array<std::string> &in_names) { |
121 | | <a name="l00120"></a>00120 init (in_names, ones_i (in_names.length()), zeros_i (in_names.length())); |
122 | | <a name="l00121"></a>00121 } |
123 | | <a name="l00122"></a>00122 |
124 | | <a name="l00124"></a><a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412">00124</a> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a>() : <a class="code" href="classbdm_1_1RV.html#a0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a> (0), <a class="code" href="classbdm_1_1RV.html#ab11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a> (0), <a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> (0), <a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> (0) {} |
| 82 | <a name="l00027"></a>00027 <span class="keyword">namespace </span>bdm { |
| 83 | <a name="l00029"></a><a class="code" href="classbdm_1_1str.html">00029</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1str.html" title="Structure of RV, i.e. RVs expanded into a flat list of IDs, used for debugging.">str</a> { |
| 84 | <a name="l00030"></a>00030 <span class="keyword">public</span>: |
| 85 | <a name="l00032"></a><a class="code" href="classbdm_1_1str.html#a64675a73fc7324177175f19b3baeb0b0">00032</a> ivec <a class="code" href="classbdm_1_1str.html#a64675a73fc7324177175f19b3baeb0b0" title="vector id ids (non-unique!)">ids</a>; |
| 86 | <a name="l00034"></a><a class="code" href="classbdm_1_1str.html#a905dc0f240e40432c103708c4a34f80a">00034</a> ivec <a class="code" href="classbdm_1_1str.html#a905dc0f240e40432c103708c4a34f80a" title="vector of times">times</a>; |
| 87 | <a name="l00036"></a><a class="code" href="classbdm_1_1str.html#a7c6b9dccc6814d7bd1e8e2208a0d3f3f">00036</a> <a class="code" href="classbdm_1_1str.html#a7c6b9dccc6814d7bd1e8e2208a0d3f3f" title="Default constructor.">str</a> ( ivec ids0, ivec times0 ) : <a class="code" href="classbdm_1_1str.html#a64675a73fc7324177175f19b3baeb0b0" title="vector id ids (non-unique!)">ids</a> ( ids0 ), <a class="code" href="classbdm_1_1str.html#a905dc0f240e40432c103708c4a34f80a" title="vector of times">times</a> ( times0 ) { |
| 88 | <a name="l00037"></a>00037 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( times0.length() == ids0.length(), <span class="stringliteral">"Incompatible input"</span> ); |
| 89 | <a name="l00038"></a>00038 }; |
| 90 | <a name="l00039"></a>00039 }; |
| 91 | <a name="l00040"></a>00040 |
| 92 | <a name="l00079"></a><a class="code" href="classbdm_1_1RV.html">00079</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_1root.html" title="Root class of BDM objects.">root</a> { |
| 93 | <a name="l00080"></a>00080 <span class="keyword">private</span>: |
| 94 | <a name="l00081"></a>00081 <span class="keyword">typedef</span> std::map<string, int> str2int_map; |
| 95 | <a name="l00082"></a>00082 |
| 96 | <a name="l00084"></a>00084 <span class="keyword">static</span> ivec SIZES; |
| 97 | <a name="l00086"></a>00086 <span class="keyword">static</span> Array<string> NAMES; |
| 98 | <a name="l00087"></a>00087 |
| 99 | <a name="l00089"></a>00089 <span class="keyword">const</span> <span class="keyword">static</span> <span class="keywordtype">int</span> BUFFER_STEP; |
| 100 | <a name="l00090"></a>00090 |
| 101 | <a name="l00092"></a>00092 <span class="keyword">static</span> str2int_map MAP; |
| 102 | <a name="l00093"></a>00093 |
| 103 | <a name="l00094"></a>00094 <span class="keyword">public</span>: |
| 104 | <a name="l00095"></a>00095 |
| 105 | <a name="l00096"></a>00096 <span class="keyword">protected</span>: |
| 106 | <a name="l00098"></a><a class="code" href="classbdm_1_1RV.html#a0cfe477965243a89eb87a06b024e2fcb">00098</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#a0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a>; |
| 107 | <a name="l00100"></a><a class="code" href="classbdm_1_1RV.html#ab11bfdceb831ed30d33b852dd4a6b385">00100</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#ab11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a>; |
| 108 | <a name="l00102"></a><a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b">00102</a> ivec <a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a>; |
| 109 | <a name="l00104"></a><a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896">00104</a> ivec <a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a>; |
| 110 | <a name="l00105"></a>00105 |
| 111 | <a name="l00106"></a>00106 <span class="keyword">private</span>: |
| 112 | <a name="l00107"></a>00107 <span class="keyword">enum</span> enum_dummy {dummy}; |
| 113 | <a name="l00108"></a>00108 |
| 114 | <a name="l00110"></a>00110 <span class="keywordtype">void</span> init ( <span class="keyword">const</span> Array<std::string> &in_names, <span class="keyword">const</span> ivec &in_sizes, <span class="keyword">const</span> ivec &in_times ); |
| 115 | <a name="l00111"></a>00111 <span class="keywordtype">int</span> init ( <span class="keyword">const</span> <span class="keywordtype">string</span> &name, <span class="keywordtype">int</span> size ); |
| 116 | <a name="l00114"></a>00114 <span class="keyword">explicit</span> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> ( <span class="keyword">const</span> ivec &ids0, enum_dummy dum ) : <a class="code" href="classbdm_1_1RV.html#a0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a> ( 0 ), <a class="code" href="classbdm_1_1RV.html#ab11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a> ( ids0.<a class="code" href="classbdm_1_1RV.html#ae9ec8c3e756651ff352ab5e3d3acda4b" title="Number of named parts.">length</a>() ), <a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( ids0 ), <a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> ( zeros_i ( ids0.<a class="code" href="classbdm_1_1RV.html#ae9ec8c3e756651ff352ab5e3d3acda4b" title="Number of named parts.">length</a>() ) ) { |
| 117 | <a name="l00115"></a>00115 <a class="code" href="classbdm_1_1RV.html#a0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a> = <a class="code" href="classbdm_1_1RV.html#a39f9b44752376f07e346579b5ff8cbbd" title="Recount size of the corresponding data vector.">countsize</a>(); |
| 118 | <a name="l00116"></a>00116 } |
| 119 | <a name="l00117"></a>00117 <span class="keyword">public</span>: |
| 120 | <a name="l00120"></a>00120 |
| 121 | <a name="l00122"></a><a class="code" href="classbdm_1_1RV.html#a3fa35c2744e687c74f7742990e6aa264">00122</a> <a class="code" href="classbdm_1_1RV.html#a3fa35c2744e687c74f7742990e6aa264" title="Full constructor.">RV</a> ( <span class="keyword">const</span> Array<std::string> &in_names, <span class="keyword">const</span> ivec &in_sizes, <span class="keyword">const</span> ivec &in_times ) { |
| 122 | <a name="l00123"></a>00123 init ( in_names, in_sizes, in_times ); |
| 123 | <a name="l00124"></a>00124 } |
126 | | <a name="l00127"></a>00127 <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" 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); |
127 | | <a name="l00128"></a>00128 |
128 | | <a name="l00129"></a>00129 <span class="comment">// compiler-generated copy constructor is used</span> |
129 | | <a name="l00131"></a>00131 <span class="comment"></span> |
130 | | <a name="l00134"></a>00134 |
131 | | <a name="l00136"></a>00136 <span class="keyword">friend</span> std::ostream &<a class="code" href="classbdm_1_1RV.html#acad6f15535d10437f6690cb4492176a8" title="State 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); |
132 | | <a name="l00137"></a>00137 |
133 | | <a name="l00138"></a>00138 <span class="keywordtype">int</span> _dsize()<span class="keyword"> const </span>{ |
134 | | <a name="l00139"></a>00139 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#a0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a>; |
135 | | <a name="l00140"></a>00140 } |
136 | | <a name="l00141"></a>00141 |
137 | | <a name="l00143"></a><a class="code" href="classbdm_1_1RV.html#a26318eb90cb172ea86d1f45de9131c4e">00143</a> <span class="keyword">const</span> ivec& <a class="code" href="classbdm_1_1RV.html#a26318eb90cb172ea86d1f45de9131c4e" title="access function">_ids</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a>;} |
138 | | <a name="l00144"></a>00144 |
139 | | <a name="l00146"></a>00146 <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#a39f9b44752376f07e346579b5ff8cbbd" title="Recount size of the corresponding data vector.">countsize</a>() <span class="keyword">const</span>; |
140 | | <a name="l00147"></a>00147 ivec cumsizes() <span class="keyword">const</span>; |
141 | | <a name="l00148"></a>00148 <span class="keywordtype">int</span> length()<span class="keyword"> const </span>{ |
142 | | <a name="l00149"></a>00149 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#ab11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a>; |
143 | | <a name="l00150"></a>00150 } |
144 | | <a name="l00151"></a>00151 <span class="keywordtype">int</span> id (<span class="keywordtype">int</span> at)<span class="keyword"> const </span>{ |
145 | | <a name="l00152"></a>00152 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> (at); |
146 | | <a name="l00153"></a>00153 } |
147 | | <a name="l00154"></a>00154 <span class="keywordtype">int</span> size (<span class="keywordtype">int</span> at)<span class="keyword"> const </span>{ |
148 | | <a name="l00155"></a>00155 <span class="keywordflow">return</span> RV_SIZES (<a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> (at)); |
149 | | <a name="l00156"></a>00156 } |
150 | | <a name="l00157"></a>00157 <span class="keywordtype">int</span> time (<span class="keywordtype">int</span> at)<span class="keyword"> const </span>{ |
151 | | <a name="l00158"></a>00158 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> (at); |
152 | | <a name="l00159"></a>00159 } |
153 | | <a name="l00160"></a>00160 std::string name (<span class="keywordtype">int</span> at)<span class="keyword"> const </span>{ |
154 | | <a name="l00161"></a>00161 <span class="keywordflow">return</span> RV_NAMES (<a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> (at)); |
155 | | <a name="l00162"></a>00162 } |
156 | | <a name="l00163"></a>00163 <span class="keywordtype">void</span> set_time (<span class="keywordtype">int</span> at, <span class="keywordtype">int</span> time0) { |
157 | | <a name="l00164"></a>00164 <a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> (at) = time0; |
158 | | <a name="l00165"></a>00165 } |
159 | | <a name="l00167"></a>00167 |
160 | | <a name="l00170"></a>00170 |
161 | | <a name="l00172"></a>00172 ivec <a class="code" href="classbdm_1_1RV.html#a1367055b2608ad9d50d01a2da6cec869" title="Find indices of self in another rv,.">findself</a> (<span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2) <span class="keyword">const</span>; |
162 | | <a name="l00174"></a>00174 <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1RV.html#a3bb011af88ae98f5c97955bb2c95cfee" title="Compare if rv2 is identical to this RV.">equal</a> (<span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2) <span class="keyword">const</span>; |
163 | | <a name="l00176"></a>00176 <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1RV.html#a87841b5ee43997b79789c0c22047e224" title="Add (concat) another variable to the current one,.">add</a> (<span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2); |
164 | | <a name="l00178"></a>00178 <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> <a class="code" href="classbdm_1_1RV.html#aaec44dabdf0a6d90fbae95e1356eda39" title="Subtract another variable from the current one.">subt</a> (<span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2) <span class="keyword">const</span>; |
165 | | <a name="l00180"></a>00180 <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> <a class="code" href="classbdm_1_1RV.html#ac0c04ab99ded62e1e05bcefb151ebeb9" title="Select only variables at indices ind.">subselect</a> (<span class="keyword">const</span> ivec &ind) <span class="keyword">const</span>; |
166 | | <a name="l00181"></a>00181 |
167 | | <a name="l00183"></a><a class="code" href="classbdm_1_1RV.html#a6f3daf0f857fff53a1c0a445fe160966">00183</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#a6f3daf0f857fff53a1c0a445fe160966" title="Select only variables at indices ind.">operator() </a>(<span class="keyword">const</span> ivec &ind)<span class="keyword"> const </span>{ |
168 | | <a name="l00184"></a>00184 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#ac0c04ab99ded62e1e05bcefb151ebeb9" title="Select only variables at indices ind.">subselect</a> (ind); |
169 | | <a name="l00185"></a>00185 } |
170 | | <a name="l00186"></a>00186 |
171 | | <a name="l00188"></a>00188 <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#a6f3daf0f857fff53a1c0a445fe160966" title="Select only variables at indices ind.">operator() </a>(<span class="keywordtype">int</span> di1, <span class="keywordtype">int</span> di2) <span class="keyword">const</span>; |
172 | | <a name="l00189"></a>00189 |
173 | | <a name="l00191"></a>00191 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#abd77cb0899f7fba1d0e34396137b7f1f" title="Shift time by delta.">t</a> (<span class="keywordtype">int</span> delta); |
174 | | <a name="l00193"></a>00193 |
175 | | <a name="l00196"></a>00196 |
176 | | <a name="l00198"></a>00198 <a class="code" href="classbdm_1_1str.html" title="Structure of RV, i.e. RVs expanded into a flat list of IDs, used for debugging.">str</a> <a class="code" href="classbdm_1_1RV.html#a8bdd7f4072749c7cc864b78a418ca388" title="generate str from rv, by expanding sizes">tostr</a>() <span class="keyword">const</span>; |
177 | | <a name="l00201"></a>00201 ivec <a class="code" href="classbdm_1_1RV.html#acbebdb5e0d30101a6eb63550ef701c55">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>; |
178 | | <a name="l00204"></a>00204 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#acbebdb5e0d30101a6eb63550ef701c55">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>; |
179 | | <a name="l00206"></a><a class="code" href="classbdm_1_1RV.html#a9a5c5aeeaf39299d07763377b05a8241">00206</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#a9a5c5aeeaf39299d07763377b05a8241" title="Minimum time-offset.">mint</a>()<span class="keyword"> const </span>{ |
180 | | <a name="l00207"></a>00207 <span class="keywordflow">return</span> min (<a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a>); |
181 | | <a name="l00208"></a>00208 } |
182 | | <a name="l00210"></a>00210 |
183 | | <a name="l00225"></a>00225 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#a6564bdd36b6845a51446a192d33e1194" title="UI for class RV (description of data vectors).">from_setting</a> (<span class="keyword">const</span> Setting &<span class="keyword">set</span>); |
184 | | <a name="l00226"></a>00226 |
185 | | <a name="l00227"></a>00227 <span class="comment">// TODO dodelat void to_setting( Setting &set ) const;</span> |
186 | | <a name="l00229"></a>00229 <span class="comment"></span> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#aab92b361335a644df654cf7cf7e5ffc0" title="Invalidate all named RVs. Use before initializing any RV instances, with care...">clear_all</a>(); |
187 | | <a name="l00230"></a>00230 }; |
188 | | <a name="l00231"></a>00231 <a class="code" href="user__info_8h.html#a4f9de2f17e844047726487b99def99c6" title="Macro for registration of class into map of user-infos, registered class is scriptable...">UIREGISTER</a> (RV); |
189 | | <a name="l00232"></a>00232 SHAREDPTR (RV); |
190 | | <a name="l00233"></a>00233 |
191 | | <a name="l00235"></a>00235 RV concat (<span class="keyword">const</span> RV &rv1, <span class="keyword">const</span> RV &rv2); |
192 | | <a name="l00236"></a>00236 |
193 | | <a name="l00238"></a>00238 <span class="keyword">extern</span> RV RV0; |
| 125 | <a name="l00127"></a><a class="code" href="classbdm_1_1RV.html#a381f5d963bb54efd4e76815dc93d50ce">00127</a> <a class="code" href="classbdm_1_1RV.html#a381f5d963bb54efd4e76815dc93d50ce" title="Constructor with times=0.">RV</a> ( <span class="keyword">const</span> Array<std::string> &in_names, <span class="keyword">const</span> ivec &in_sizes ) { |
| 126 | <a name="l00128"></a>00128 init ( in_names, in_sizes, zeros_i ( in_names.length() ) ); |
| 127 | <a name="l00129"></a>00129 } |
| 128 | <a name="l00130"></a>00130 |
| 129 | <a name="l00132"></a><a class="code" href="classbdm_1_1RV.html#acb47d71d82639ec7ddf2635b21aafd00">00132</a> <a class="code" href="classbdm_1_1RV.html#acb47d71d82639ec7ddf2635b21aafd00" title="Constructor with sizes=1, times=0.">RV</a> ( <span class="keyword">const</span> Array<std::string> &in_names ) { |
| 130 | <a name="l00133"></a>00133 init ( in_names, ones_i ( in_names.length() ), zeros_i ( in_names.length() ) ); |
| 131 | <a name="l00134"></a>00134 } |
| 132 | <a name="l00135"></a>00135 |
| 133 | <a name="l00137"></a><a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412">00137</a> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a>() : <a class="code" href="classbdm_1_1RV.html#a0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a> ( 0 ), <a class="code" href="classbdm_1_1RV.html#ab11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a> ( 0 ), <a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( 0 ), <a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> ( 0 ) {} |
| 134 | <a name="l00138"></a>00138 |
| 135 | <a name="l00140"></a>00140 <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" 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 ); |
| 136 | <a name="l00141"></a>00141 |
| 137 | <a name="l00142"></a>00142 <span class="comment">// compiler-generated copy constructor is used</span> |
| 138 | <a name="l00144"></a>00144 <span class="comment"></span> |
| 139 | <a name="l00147"></a>00147 |
| 140 | <a name="l00149"></a>00149 <span class="keyword">friend</span> std::ostream &<a class="code" href="classbdm_1_1RV.html#acad6f15535d10437f6690cb4492176a8" title="State 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 ); |
| 141 | <a name="l00150"></a>00150 |
| 142 | <a name="l00151"></a><a class="code" href="classbdm_1_1RV.html#ab361a9044e6a43102c4f873b9f566a0f">00151</a> <span class="keywordtype">string</span> <a class="code" href="classbdm_1_1RV.html#ab361a9044e6a43102c4f873b9f566a0f" title="This method returns a basic info about the current instance.">to_string</a>() {ostringstream o; o << <span class="keyword">this</span>; <span class="keywordflow">return</span> o.str();} |
| 143 | <a name="l00152"></a>00152 |
| 144 | <a name="l00154"></a><a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089">00154</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>()<span class="keyword"> const </span>{ |
| 145 | <a name="l00155"></a>00155 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#a0cfe477965243a89eb87a06b024e2fcb" title="size of the data vector">dsize</a>; |
| 146 | <a name="l00156"></a>00156 } |
| 147 | <a name="l00157"></a>00157 |
| 148 | <a name="l00159"></a><a class="code" href="classbdm_1_1RV.html#a26318eb90cb172ea86d1f45de9131c4e">00159</a> <span class="keyword">const</span> ivec& <a class="code" href="classbdm_1_1RV.html#a26318eb90cb172ea86d1f45de9131c4e" title="access function">_ids</a>()<span class="keyword"> const </span>{ |
| 149 | <a name="l00160"></a>00160 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a>; |
| 150 | <a name="l00161"></a>00161 } |
| 151 | <a name="l00162"></a>00162 |
| 152 | <a name="l00164"></a>00164 <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#a39f9b44752376f07e346579b5ff8cbbd" title="Recount size of the corresponding data vector.">countsize</a>() <span class="keyword">const</span>; |
| 153 | <a name="l00166"></a>00166 ivec <a class="code" href="classbdm_1_1RV.html#a412d43294bac38fa1804829e38fa4eaf" title="Vector of cumulative sizes of RV.">cumsizes</a>() <span class="keyword">const</span>; |
| 154 | <a name="l00168"></a><a class="code" href="classbdm_1_1RV.html#ae9ec8c3e756651ff352ab5e3d3acda4b">00168</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#ae9ec8c3e756651ff352ab5e3d3acda4b" title="Number of named parts.">length</a>()<span class="keyword"> const </span>{ |
| 155 | <a name="l00169"></a>00169 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#ab11bfdceb831ed30d33b852dd4a6b385" title="number of individual rvs">len</a>; |
| 156 | <a name="l00170"></a>00170 } |
| 157 | <a name="l00171"></a>00171 <span class="keywordtype">int</span> id ( <span class="keywordtype">int</span> at )<span class="keyword"> const </span>{ |
| 158 | <a name="l00172"></a>00172 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( at ); |
| 159 | <a name="l00173"></a>00173 } |
| 160 | <a name="l00174"></a>00174 <span class="keywordtype">int</span> size ( <span class="keywordtype">int</span> at )<span class="keyword"> const </span>{ |
| 161 | <a name="l00175"></a>00175 <span class="keywordflow">return</span> SIZES ( <a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( at ) ); |
| 162 | <a name="l00176"></a>00176 } |
| 163 | <a name="l00177"></a>00177 <span class="keywordtype">int</span> time ( <span class="keywordtype">int</span> at )<span class="keyword"> const </span>{ |
| 164 | <a name="l00178"></a>00178 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> ( at ); |
| 165 | <a name="l00179"></a>00179 } |
| 166 | <a name="l00180"></a>00180 std::string name ( <span class="keywordtype">int</span> at )<span class="keyword"> const </span>{ |
| 167 | <a name="l00181"></a>00181 <span class="keywordflow">return</span> NAMES ( <a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ( at ) ); |
| 168 | <a name="l00182"></a>00182 } |
| 169 | <a name="l00183"></a>00183 <span class="keywordtype">void</span> set_time ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> time0 ) { |
| 170 | <a name="l00184"></a>00184 <a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a> ( at ) = time0; |
| 171 | <a name="l00185"></a>00185 } |
| 172 | <a name="l00187"></a>00187 |
| 173 | <a name="l00190"></a>00190 |
| 174 | <a name="l00192"></a>00192 ivec <a class="code" href="classbdm_1_1RV.html#a1367055b2608ad9d50d01a2da6cec869" title="Find indices of self in another rv,.">findself</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 175 | <a name="l00194"></a>00194 ivec <a class="code" href="classbdm_1_1RV.html#aa858d36d0264e1f1c89500531162fdf1" title="Find indices of self in another rv, ignore time,.">findself_ids</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 176 | <a name="l00196"></a>00196 <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1RV.html#a3bb011af88ae98f5c97955bb2c95cfee" title="Compare if rv2 is identical to this RV.">equal</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 177 | <a name="l00198"></a>00198 <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1RV.html#a87841b5ee43997b79789c0c22047e224" title="Add (concat) another variable to the current one,.">add</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ); |
| 178 | <a name="l00200"></a>00200 <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> <a class="code" href="classbdm_1_1RV.html#aaec44dabdf0a6d90fbae95e1356eda39" title="Subtract another variable from the current one.">subt</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 179 | <a name="l00202"></a>00202 <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> <a class="code" href="classbdm_1_1RV.html#ac0c04ab99ded62e1e05bcefb151ebeb9" title="Select only variables at indices ind.">subselect</a> ( <span class="keyword">const</span> ivec &ind ) <span class="keyword">const</span>; |
| 180 | <a name="l00203"></a>00203 |
| 181 | <a name="l00205"></a><a class="code" href="classbdm_1_1RV.html#a6f3daf0f857fff53a1c0a445fe160966">00205</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#a6f3daf0f857fff53a1c0a445fe160966" title="Select only variables at indices ind.">operator() </a>( <span class="keyword">const</span> ivec &ind )<span class="keyword"> const </span>{ |
| 182 | <a name="l00206"></a>00206 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#ac0c04ab99ded62e1e05bcefb151ebeb9" title="Select only variables at indices ind.">subselect</a> ( ind ); |
| 183 | <a name="l00207"></a>00207 } |
| 184 | <a name="l00208"></a>00208 |
| 185 | <a name="l00210"></a>00210 <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#a6f3daf0f857fff53a1c0a445fe160966" title="Select only variables at indices ind.">operator() </a>( <span class="keywordtype">int</span> di1, <span class="keywordtype">int</span> di2 ) <span class="keyword">const</span>; |
| 186 | <a name="l00211"></a>00211 |
| 187 | <a name="l00213"></a>00213 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#a449c2b692957528976c189d27236e1ba" title="Shift time by delta.">t_plus</a> ( <span class="keywordtype">int</span> delta ); |
| 188 | <a name="l00215"></a>00215 |
| 189 | <a name="l00218"></a>00218 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> remove_time()<span class="keyword"> const </span>{ |
| 190 | <a name="l00219"></a>00219 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#ae319ca900261a5005a9b4b353ec16412" title="Constructor of empty RV.">RV</a> ( unique ( <a class="code" href="classbdm_1_1RV.html#a0a9a4769ab5a322495bea0cd8091500b" title="Vector of unique IDs.">ids</a> ), dummy ); |
| 191 | <a name="l00220"></a>00220 } |
| 192 | <a name="l00222"></a><a class="code" href="classbdm_1_1RV.html#a627222f49abc5d07e5e8aecac7708ee2">00222</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#a627222f49abc5d07e5e8aecac7708ee2" title="create new RV from the current one with time shifted by given value">copy_t</a>(<span class="keywordtype">int</span> dt)<span class="keyword"> const </span>{ |
| 193 | <a name="l00223"></a>00223 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> tmp=*<span class="keyword">this</span>; |
| 194 | <a name="l00224"></a>00224 tmp.<a class="code" href="classbdm_1_1RV.html#a449c2b692957528976c189d27236e1ba" title="Shift time by delta.">t_plus</a>(dt); |
| 195 | <a name="l00225"></a>00225 <span class="keywordflow">return</span> tmp; |
| 196 | <a name="l00226"></a>00226 } |
| 197 | <a name="l00228"></a><a class="code" href="classbdm_1_1RV.html#ac5819f71d774649412c10b8e1716be1e">00228</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#ac5819f71d774649412c10b8e1716be1e" title="return rvs with expanded delayes and sorted in the order of:">expand_delayes</a>()<span class="keyword"> const </span>{ |
| 198 | <a name="l00229"></a>00229 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rvt = this->remove_time(); <span class="comment">//rv at t=0</span> |
| 199 | <a name="l00230"></a>00230 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> tmp = rvt; |
| 200 | <a name="l00231"></a>00231 <span class="keywordtype">int</span> td = <a class="code" href="classbdm_1_1RV.html#a9a5c5aeeaf39299d07763377b05a8241" title="Minimum time-offset.">mint</a>(); |
| 201 | <a name="l00232"></a>00232 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = -1; i >= td; i-- ) { |
| 202 | <a name="l00233"></a>00233 rvt.<a class="code" href="classbdm_1_1RV.html#a449c2b692957528976c189d27236e1ba" title="Shift time by delta.">t_plus</a> ( -1 ); |
| 203 | <a name="l00234"></a>00234 tmp.<a class="code" href="classbdm_1_1RV.html#a87841b5ee43997b79789c0c22047e224" title="Add (concat) another variable to the current one,.">add</a> ( rvt ); <span class="comment">//shift u1</span> |
| 204 | <a name="l00235"></a>00235 } |
| 205 | <a name="l00236"></a>00236 <span class="keywordflow">return</span> tmp; |
| 206 | <a name="l00237"></a>00237 } |
195 | | <a name="l00241"></a>00241 |
196 | | <a name="l00242"></a><a class="code" href="classbdm_1_1fnc.html">00242</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1fnc.html" title="Class representing function of variable represented by rv.">fnc</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> |
197 | | <a name="l00243"></a>00243 { |
198 | | <a name="l00244"></a>00244 <span class="keyword">protected</span>: |
199 | | <a name="l00246"></a><a class="code" href="classbdm_1_1fnc.html#a52156cb4a52a62d51fc7455985797a62">00246</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1fnc.html#a52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>; |
200 | | <a name="l00247"></a>00247 <span class="keyword">public</span>: |
201 | | <a name="l00249"></a><a class="code" href="classbdm_1_1fnc.html#a65e9fb11f6cc7884018d8f229bcabbb7">00249</a> <a class="code" href="classbdm_1_1fnc.html#a65e9fb11f6cc7884018d8f229bcabbb7" title="default constructor">fnc</a>() {}; |
202 | | <a name="l00251"></a><a class="code" href="classbdm_1_1fnc.html#a6277b11d7fffc7ef8a2fa3e84ae5bad4">00251</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1fnc.html#a6277b11d7fffc7ef8a2fa3e84ae5bad4" title="function evaluates numerical value of at cond ">eval</a> (<span class="keyword">const</span> vec &cond) { |
203 | | <a name="l00252"></a>00252 <span class="keywordflow">return</span> vec (0); |
204 | | <a name="l00253"></a>00253 }; |
205 | | <a name="l00254"></a>00254 |
206 | | <a name="l00256"></a><a class="code" href="classbdm_1_1fnc.html#a0786e40fade2663a70d654c1dda5d73e">00256</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1fnc.html#a0786e40fade2663a70d654c1dda5d73e" title="function substitutes given value into an appropriate position">condition</a> (<span class="keyword">const</span> vec &val) {}; |
207 | | <a name="l00257"></a>00257 |
208 | | <a name="l00259"></a><a class="code" href="classbdm_1_1fnc.html#a083832294da9d1e40804158b979c4341">00259</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1fnc.html#a083832294da9d1e40804158b979c4341" title="access function">dimension</a>()<span class="keyword"> const </span>{ |
209 | | <a name="l00260"></a>00260 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1fnc.html#a52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>; |
210 | | <a name="l00261"></a>00261 } |
211 | | <a name="l00262"></a>00262 }; |
212 | | <a name="l00263"></a>00263 |
213 | | <a name="l00264"></a>00264 <span class="keyword">class </span>mpdf; |
214 | | <a name="l00265"></a>00265 |
215 | | <a name="l00267"></a>00267 |
216 | | <a name="l00268"></a><a class="code" href="classbdm_1_1epdf.html">00268</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_1root.html" title="Root class of BDM objects.">root</a> |
217 | | <a name="l00269"></a>00269 { |
218 | | <a name="l00270"></a>00270 <span class="keyword">protected</span>: |
219 | | <a name="l00272"></a><a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce">00272</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>; |
220 | | <a name="l00274"></a><a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8">00274</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#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>; |
221 | | <a name="l00275"></a>00275 |
222 | | <a name="l00276"></a>00276 <span class="keyword">public</span>: |
223 | | <a name="l00288"></a>00288 <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#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> (0), <a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>() {}; |
224 | | <a name="l00289"></a>00289 <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#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> (e.<a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>), <a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> (e.<a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>) {}; |
225 | | <a name="l00290"></a>00290 epdf (<span class="keyword">const</span> RV &rv0) : <a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> (rv0._dsize()) { |
226 | | <a name="l00291"></a>00291 <a class="code" href="classbdm_1_1epdf.html#af423e28448dbb69ef4905295ec8de8ff" title="Name its rv.">set_rv</a> (rv0); |
227 | | <a name="l00292"></a>00292 }; |
228 | | <a name="l00293"></a>00293 <span class="keywordtype">void</span> set_parameters (<span class="keywordtype">int</span> dim0) { |
229 | | <a name="l00294"></a>00294 <a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> = dim0; |
230 | | <a name="l00295"></a>00295 } |
231 | | <a name="l00297"></a>00297 |
232 | | <a name="l00300"></a>00300 |
233 | | <a name="l00302"></a><a class="code" href="classbdm_1_1epdf.html#a75ba57a89681a8efec488f5796c7cc1b">00302</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#a75ba57a89681a8efec488f5796c7cc1b" title="Returns a sample, from density .">sample</a>()<span class="keyword"> const </span>{ |
234 | | <a name="l00303"></a>00303 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"not implemented"</span>); |
235 | | <a name="l00304"></a>00304 <span class="keywordflow">return</span> vec(); |
236 | | <a name="l00305"></a>00305 } |
237 | | <a name="l00306"></a>00306 |
238 | | <a name="l00308"></a>00308 <span class="keyword">virtual</span> mat <a class="code" href="classbdm_1_1epdf.html#ab4cf45fd83cc7573ede9fe1215256058" title="Returns N samples, from density .">sample_m</a> (<span class="keywordtype">int</span> N) <span class="keyword">const</span>; |
239 | | <a name="l00309"></a>00309 |
240 | | <a name="l00312"></a><a class="code" href="classbdm_1_1epdf.html#adeab266d63c236c277538867d5c3f249">00312</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1epdf.html#adeab266d63c236c277538867d5c3f249">evallog</a> (<span class="keyword">const</span> vec &val)<span class="keyword"> const </span>{ |
241 | | <a name="l00313"></a>00313 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"not implemented"</span>); |
242 | | <a name="l00314"></a>00314 <span class="keywordflow">return</span> 0.0; |
243 | | <a name="l00315"></a>00315 } |
244 | | <a name="l00316"></a>00316 |
245 | | <a name="l00318"></a>00318 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#ad08b68a5abd461f1b6519597e344caf8" title="Compute log-probability of multiple values argument val.">evallog_m</a> (<span class="keyword">const</span> mat &Val) <span class="keyword">const</span>; |
246 | | <a name="l00319"></a>00319 |
247 | | <a name="l00321"></a>00321 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#ad08b68a5abd461f1b6519597e344caf8" title="Compute log-probability of multiple values argument val.">evallog_m</a> (<span class="keyword">const</span> Array<vec> &Avec) <span class="keyword">const</span>; |
248 | | <a name="l00322"></a>00322 |
249 | | <a name="l00324"></a>00324 <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<mpdf></a> <a class="code" href="classbdm_1_1epdf.html#a1499d35b79bce0cfa64fc5cafb9c03b2" 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#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>) <span class="keyword">const</span>; |
250 | | <a name="l00325"></a>00325 |
251 | | <a name="l00327"></a>00327 <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<epdf></a> <a class="code" href="classbdm_1_1epdf.html#aa84b05f5293cab2aeb4e07faffa60906" 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#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>) <span class="keyword">const</span>; |
252 | | <a name="l00328"></a>00328 |
253 | | <a name="l00330"></a><a class="code" href="classbdm_1_1epdf.html#a0c8d13d788094605b3cdab20a6e22b75">00330</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#a0c8d13d788094605b3cdab20a6e22b75" title="return expected value">mean</a>()<span class="keyword"> const </span>{ |
254 | | <a name="l00331"></a>00331 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"not implemneted"</span>); |
255 | | <a name="l00332"></a>00332 <span class="keywordflow">return</span> vec(); |
256 | | <a name="l00333"></a>00333 } |
257 | | <a name="l00334"></a>00334 |
258 | | <a name="l00336"></a><a class="code" href="classbdm_1_1epdf.html#a4543d40ccfc5d549b0c831a57a3ed84c">00336</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#a4543d40ccfc5d549b0c831a57a3ed84c" title="return expected variance (not covariance!)">variance</a>()<span class="keyword"> const </span>{ |
259 | | <a name="l00337"></a>00337 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"not implemneted"</span>); |
260 | | <a name="l00338"></a>00338 <span class="keywordflow">return</span> vec(); |
261 | | <a name="l00339"></a>00339 } |
262 | | <a name="l00340"></a>00340 |
263 | | <a name="l00342"></a><a class="code" href="classbdm_1_1epdf.html#a0a7705e80601957f7226d333a0a6d539">00342</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1epdf.html#a0a7705e80601957f7226d333a0a6d539" 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>{ |
264 | | <a name="l00343"></a>00343 vec mea = <a class="code" href="classbdm_1_1epdf.html#a0c8d13d788094605b3cdab20a6e22b75" title="return expected value">mean</a>(); |
265 | | <a name="l00344"></a>00344 vec std = sqrt (<a class="code" href="classbdm_1_1epdf.html#a4543d40ccfc5d549b0c831a57a3ed84c" title="return expected variance (not covariance!)">variance</a>()); |
266 | | <a name="l00345"></a>00345 lb = mea - 2 * std; |
267 | | <a name="l00346"></a>00346 ub = mea + 2 * std; |
268 | | <a name="l00347"></a>00347 }; |
269 | | <a name="l00349"></a>00349 |
| 208 | <a name="l00242"></a>00242 |
| 209 | <a name="l00244"></a>00244 <a class="code" href="classbdm_1_1str.html" title="Structure of RV, i.e. RVs expanded into a flat list of IDs, used for debugging.">str</a> <a class="code" href="classbdm_1_1RV.html#a8bdd7f4072749c7cc864b78a418ca388" title="generate str from rv, by expanding sizes">tostr</a>() <span class="keyword">const</span>; |
| 210 | <a name="l00247"></a>00247 ivec <a class="code" href="classbdm_1_1RV.html#acbebdb5e0d30101a6eb63550ef701c55" title="when this rv is a part of bigger rv, this function returns indices of self in the...">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>; |
| 211 | <a name="l00249"></a>00249 ivec <a class="code" href="classbdm_1_1RV.html#a0c6e3a1c54a612d2ea390c841aa5eb6f" title="same as dataind but this time crv should not be complete supperset of rv.">dataind_part</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>; |
| 212 | <a name="l00252"></a>00252 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#acbebdb5e0d30101a6eb63550ef701c55" title="when this rv is a part of bigger rv, this function returns indices of self in the...">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>; |
| 213 | <a name="l00254"></a><a class="code" href="classbdm_1_1RV.html#a9a5c5aeeaf39299d07763377b05a8241">00254</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1RV.html#a9a5c5aeeaf39299d07763377b05a8241" title="Minimum time-offset.">mint</a>()<span class="keyword"> const </span>{ |
| 214 | <a name="l00255"></a>00255 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a>.length()>0 ? min (<a class="code" href="classbdm_1_1RV.html#aef6703854820bbf61736738f1bac6896" title="Vector of shifts from current time.">times</a>) : 0; |
| 215 | <a name="l00256"></a>00256 } |
| 216 | <a name="l00258"></a>00258 |
| 217 | <a name="l00273"></a>00273 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#a6564bdd36b6845a51446a192d33e1194" title="UI for class RV (description of data vectors).">from_setting</a> ( <span class="keyword">const</span> Setting &<span class="keyword">set</span> ); |
| 218 | <a name="l00274"></a>00274 |
| 219 | <a name="l00275"></a>00275 <span class="comment">// TODO dodelat void to_setting( Setting &set ) const;</span> |
| 220 | <a name="l00276"></a>00276 |
| 221 | <a name="l00278"></a>00278 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1RV.html#aab92b361335a644df654cf7cf7e5ffc0" title="Invalidate all named RVs. Use before initializing any RV instances, with care...">clear_all</a>(); |
| 222 | <a name="l00280"></a>00280 <span class="keywordtype">string</span> <a class="code" href="classbdm_1_1RV.html#a0743ab524c18d0c6553b29b043fd42bd" title="function for debugging RV related stuff">show_all</a>(); |
| 223 | <a name="l00281"></a>00281 |
| 224 | <a name="l00282"></a>00282 }; |
| 225 | <a name="l00283"></a>00283 <a class="code" href="user__info_8h.html#a4f9de2f17e844047726487b99def99c6" title="Macro for registration of class into map of user-infos, registered class is scriptable...">UIREGISTER</a> ( RV ); |
| 226 | <a name="l00284"></a>00284 SHAREDPTR ( RV ); |
| 227 | <a name="l00285"></a>00285 |
| 228 | <a name="l00287"></a>00287 RV concat ( <span class="keyword">const</span> RV &rv1, <span class="keyword">const</span> RV &rv2 ); |
| 229 | <a name="l00288"></a>00288 |
| 230 | <a name="l00290"></a><a class="code" href="classbdm_1_1fnc.html">00290</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1fnc.html" title="Class representing function of variable represented by rv.">fnc</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> { |
| 231 | <a name="l00291"></a>00291 <span class="keyword">protected</span>: |
| 232 | <a name="l00293"></a><a class="code" href="classbdm_1_1fnc.html#a52156cb4a52a62d51fc7455985797a62">00293</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1fnc.html#a52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>; |
| 233 | <a name="l00294"></a>00294 <span class="keyword">public</span>: |
| 234 | <a name="l00296"></a><a class="code" href="classbdm_1_1fnc.html#a65e9fb11f6cc7884018d8f229bcabbb7">00296</a> <a class="code" href="classbdm_1_1fnc.html#a65e9fb11f6cc7884018d8f229bcabbb7" title="default constructor">fnc</a>() {}; |
| 235 | <a name="l00298"></a><a class="code" href="classbdm_1_1fnc.html#a6277b11d7fffc7ef8a2fa3e84ae5bad4">00298</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1fnc.html#a6277b11d7fffc7ef8a2fa3e84ae5bad4" title="function evaluates numerical value of at cond ">eval</a> ( <span class="keyword">const</span> vec &cond ) { |
| 236 | <a name="l00299"></a>00299 <span class="keywordflow">return</span> vec ( 0 ); |
| 237 | <a name="l00300"></a>00300 }; |
| 238 | <a name="l00301"></a>00301 |
| 239 | <a name="l00303"></a><a class="code" href="classbdm_1_1fnc.html#a0786e40fade2663a70d654c1dda5d73e">00303</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1fnc.html#a0786e40fade2663a70d654c1dda5d73e" title="function substitutes given value into an appropriate position">condition</a> ( <span class="keyword">const</span> vec &val ) {}; |
| 240 | <a name="l00304"></a>00304 |
| 241 | <a name="l00306"></a><a class="code" href="classbdm_1_1fnc.html#a083832294da9d1e40804158b979c4341">00306</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1fnc.html#a083832294da9d1e40804158b979c4341" title="access function">dimension</a>()<span class="keyword"> const </span>{ |
| 242 | <a name="l00307"></a>00307 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1fnc.html#a52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>; |
| 243 | <a name="l00308"></a>00308 } |
| 244 | <a name="l00309"></a>00309 }; |
| 245 | <a name="l00310"></a>00310 |
| 246 | <a name="l00311"></a>00311 <span class="keyword">class </span>mpdf; |
| 247 | <a name="l00312"></a>00312 |
| 248 | <a name="l00314"></a>00314 |
| 249 | <a name="l00315"></a><a class="code" href="classbdm_1_1epdf.html">00315</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_1root.html" title="Root class of BDM objects.">root</a> { |
| 250 | <a name="l00316"></a>00316 <span class="keyword">protected</span>: |
| 251 | <a name="l00318"></a><a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce">00318</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>; |
| 252 | <a name="l00320"></a><a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8">00320</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#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>; |
| 253 | <a name="l00321"></a>00321 |
| 254 | <a name="l00322"></a>00322 <span class="keyword">public</span>: |
| 255 | <a name="l00334"></a>00334 <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#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> ( 0 ), <a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>() {}; |
| 256 | <a name="l00335"></a>00335 <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#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> ( e.<a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> ), <a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ( e.<a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ) {}; |
| 257 | <a name="l00336"></a>00336 epdf ( <span class="keyword">const</span> RV &rv0 ) : <a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> ( rv0._dsize() ) { |
| 258 | <a name="l00337"></a>00337 <a class="code" href="classbdm_1_1epdf.html#af423e28448dbb69ef4905295ec8de8ff" title="Name its rv.">set_rv</a> ( rv0 ); |
| 259 | <a name="l00338"></a>00338 }; |
| 260 | <a name="l00339"></a>00339 <span class="keywordtype">void</span> set_parameters ( <span class="keywordtype">int</span> dim0 ) { |
| 261 | <a name="l00340"></a>00340 <a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> = dim0; |
| 262 | <a name="l00341"></a>00341 } |
| 263 | <a name="l00343"></a>00343 |
| 264 | <a name="l00346"></a>00346 |
| 265 | <a name="l00348"></a><a class="code" href="classbdm_1_1epdf.html#a75ba57a89681a8efec488f5796c7cc1b">00348</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#a75ba57a89681a8efec488f5796c7cc1b" title="Returns a sample, from density .">sample</a>()<span class="keyword"> const </span>{ |
| 266 | <a name="l00349"></a>00349 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"not implemented"</span> ); |
| 267 | <a name="l00350"></a>00350 <span class="keywordflow">return</span> vec(); |
| 268 | <a name="l00351"></a>00351 } |
| 269 | <a name="l00352"></a>00352 |
| 270 | <a name="l00354"></a>00354 <span class="keyword">virtual</span> mat <a class="code" href="classbdm_1_1epdf.html#ab4cf45fd83cc7573ede9fe1215256058" title="Returns N samples, from density .">sample_m</a> ( <span class="keywordtype">int</span> N ) <span class="keyword">const</span>; |
271 | | <a name="l00357"></a><a class="code" href="classbdm_1_1epdf.html#af423e28448dbb69ef4905295ec8de8ff">00357</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1epdf.html#af423e28448dbb69ef4905295ec8de8ff" 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) { |
272 | | <a name="l00358"></a>00358 <a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> = rv0; |
273 | | <a name="l00359"></a>00359 } |
274 | | <a name="l00360"></a>00360 |
275 | | <a name="l00362"></a><a class="code" href="classbdm_1_1epdf.html#ac4b863ff84c7a4882fb3ad18556027f9">00362</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1epdf.html#ac4b863ff84c7a4882fb3ad18556027f9" title="True if rv is assigned.">isnamed</a>()<span class="keyword"> const </span>{ |
276 | | <a name="l00363"></a>00363 <span class="keywordtype">bool</span> b = (<a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> == <a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>._dsize()); |
277 | | <a name="l00364"></a>00364 <span class="keywordflow">return</span> b; |
278 | | <a name="l00365"></a>00365 } |
279 | | <a name="l00366"></a>00366 |
280 | | <a name="l00368"></a><a class="code" href="classbdm_1_1epdf.html#aa4ab378d5e004c3ff3e2d4e64f7bba21">00368</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#aa4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>()<span class="keyword"> const </span>{ |
281 | | <a name="l00369"></a>00369 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> (<a class="code" href="classbdm_1_1epdf.html#ac4b863ff84c7a4882fb3ad18556027f9" title="True if rv is assigned.">isnamed</a>(), <span class="stringliteral">""</span>); |
282 | | <a name="l00370"></a>00370 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>; |
283 | | <a name="l00371"></a>00371 } |
284 | | <a name="l00373"></a>00373 |
285 | | <a name="l00376"></a>00376 |
286 | | <a name="l00378"></a><a class="code" href="classbdm_1_1epdf.html#a7083a65f7b7a0d0d13b2c516bd2ec29c">00378</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1epdf.html#a7083a65f7b7a0d0d13b2c516bd2ec29c" title="Size of the random variable.">dimension</a>()<span class="keyword"> const </span>{ |
287 | | <a name="l00379"></a>00379 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>; |
288 | | <a name="l00380"></a>00380 } |
289 | | <a name="l00388"></a><a class="code" href="classbdm_1_1epdf.html#afa9efc98a065b31c630fe18cc418f725">00388</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1epdf.html#afa9efc98a065b31c630fe18cc418f725">from_setting</a> (<span class="keyword">const</span> Setting &<span class="keyword">set</span>) { |
290 | | <a name="l00389"></a>00389 <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr<RV></a> r = UI::build<RV> ( <span class="keyword">set</span>, <span class="stringliteral">"rv"</span>, UI::optional ); |
291 | | <a name="l00390"></a>00390 <span class="keywordflow">if</span> (r) { |
292 | | <a name="l00391"></a>00391 <a class="code" href="classbdm_1_1epdf.html#af423e28448dbb69ef4905295ec8de8ff" title="Name its rv.">set_rv</a> (*r); |
293 | | <a name="l00392"></a>00392 } |
294 | | <a name="l00393"></a>00393 } |
295 | | <a name="l00394"></a>00394 |
296 | | <a name="l00395"></a>00395 }; |
297 | | <a name="l00396"></a>00396 SHAREDPTR(epdf); |
298 | | <a name="l00397"></a>00397 |
299 | | <a name="l00399"></a><a class="code" href="classbdm_1_1mpdf.html">00399</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> |
300 | | <a name="l00400"></a>00400 { |
301 | | <a name="l00401"></a>00401 <span class="keyword">protected</span>: |
302 | | <a name="l00403"></a><a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6">00403</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>; |
303 | | <a name="l00405"></a><a class="code" href="classbdm_1_1mpdf.html#a5a5f08950daa08b85b01ddf4e1c36288">00405</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#a5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>; |
304 | | <a name="l00406"></a>00406 <span class="keyword">private</span>: |
305 | | <a name="l00408"></a>00408 <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* ep; |
306 | | <a name="l00409"></a>00409 |
307 | | <a name="l00410"></a>00410 <span class="keyword">protected</span>: |
308 | | <a name="l00412"></a><a class="code" href="classbdm_1_1mpdf.html#a147afacb393324bb3f9a7a89e33f835e">00412</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mpdf.html#a147afacb393324bb3f9a7a89e33f835e" title="set internal pointer ep to point to given iepdf ">set_ep</a> (<a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> &iepdf) { |
309 | | <a name="l00413"></a>00413 ep = &iepdf; |
310 | | <a name="l00414"></a>00414 } |
311 | | <a name="l00416"></a><a class="code" href="classbdm_1_1mpdf.html#a7555b377f8b5895c9b759c9628ee3e20">00416</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mpdf.html#a7555b377f8b5895c9b759c9628ee3e20" title="set internal pointer ep to point to given iepdf ">set_ep</a> (<a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> *iepdfp) { |
312 | | <a name="l00417"></a>00417 ep = iepdfp; |
313 | | <a name="l00418"></a>00418 } |
| 272 | <a name="l00358"></a><a class="code" href="classbdm_1_1epdf.html#adeab266d63c236c277538867d5c3f249">00358</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1epdf.html#adeab266d63c236c277538867d5c3f249" title="Compute log-probability of argument val In case the argument is out of suport return...">evallog</a> ( <span class="keyword">const</span> vec &val )<span class="keyword"> const </span>{ |
| 273 | <a name="l00359"></a>00359 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"not implemented"</span> ); |
| 274 | <a name="l00360"></a>00360 <span class="keywordflow">return</span> 0.0; |
| 275 | <a name="l00361"></a>00361 } |
| 276 | <a name="l00362"></a>00362 |
| 277 | <a name="l00364"></a>00364 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#ad08b68a5abd461f1b6519597e344caf8" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( <span class="keyword">const</span> mat &Val ) <span class="keyword">const</span>; |
| 278 | <a name="l00365"></a>00365 |
| 279 | <a name="l00367"></a>00367 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#ad08b68a5abd461f1b6519597e344caf8" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( <span class="keyword">const</span> Array<vec> &Avec ) <span class="keyword">const</span>; |
| 280 | <a name="l00368"></a>00368 |
| 281 | <a name="l00370"></a>00370 <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<mpdf></a> <a class="code" href="classbdm_1_1epdf.html#a1499d35b79bce0cfa64fc5cafb9c03b2" 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#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ) <span class="keyword">const</span>; |
| 282 | <a name="l00371"></a>00371 |
| 283 | <a name="l00373"></a>00373 <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<epdf></a> <a class="code" href="classbdm_1_1epdf.html#aa84b05f5293cab2aeb4e07faffa60906" 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#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ) <span class="keyword">const</span>; |
| 284 | <a name="l00374"></a>00374 |
| 285 | <a name="l00376"></a><a class="code" href="classbdm_1_1epdf.html#a0c8d13d788094605b3cdab20a6e22b75">00376</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#a0c8d13d788094605b3cdab20a6e22b75" title="return expected value">mean</a>()<span class="keyword"> const </span>{ |
| 286 | <a name="l00377"></a>00377 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"not implemneted"</span> ); |
| 287 | <a name="l00378"></a>00378 <span class="keywordflow">return</span> vec(); |
| 288 | <a name="l00379"></a>00379 } |
| 289 | <a name="l00380"></a>00380 |
| 290 | <a name="l00382"></a><a class="code" href="classbdm_1_1epdf.html#a4543d40ccfc5d549b0c831a57a3ed84c">00382</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1epdf.html#a4543d40ccfc5d549b0c831a57a3ed84c" title="return expected variance (not covariance!)">variance</a>()<span class="keyword"> const </span>{ |
| 291 | <a name="l00383"></a>00383 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"not implemneted"</span> ); |
| 292 | <a name="l00384"></a>00384 <span class="keywordflow">return</span> vec(); |
| 293 | <a name="l00385"></a>00385 } |
| 294 | <a name="l00386"></a>00386 |
| 295 | <a name="l00388"></a><a class="code" href="classbdm_1_1epdf.html#a0a7705e80601957f7226d333a0a6d539">00388</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1epdf.html#a0a7705e80601957f7226d333a0a6d539" 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>{ |
| 296 | <a name="l00389"></a>00389 vec mea = <a class="code" href="classbdm_1_1epdf.html#a0c8d13d788094605b3cdab20a6e22b75" title="return expected value">mean</a>(); |
| 297 | <a name="l00390"></a>00390 vec std = sqrt ( <a class="code" href="classbdm_1_1epdf.html#a4543d40ccfc5d549b0c831a57a3ed84c" title="return expected variance (not covariance!)">variance</a>() ); |
| 298 | <a name="l00391"></a>00391 lb = mea - 2 * std; |
| 299 | <a name="l00392"></a>00392 ub = mea + 2 * std; |
| 300 | <a name="l00393"></a>00393 }; |
| 301 | <a name="l00395"></a>00395 |
| 302 | <a name="l00401"></a>00401 |
| 303 | <a name="l00403"></a><a class="code" href="classbdm_1_1epdf.html#af423e28448dbb69ef4905295ec8de8ff">00403</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1epdf.html#af423e28448dbb69ef4905295ec8de8ff" 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 ) { |
| 304 | <a name="l00404"></a>00404 <a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> = rv0; |
| 305 | <a name="l00405"></a>00405 } |
| 306 | <a name="l00406"></a>00406 |
| 307 | <a name="l00408"></a><a class="code" href="classbdm_1_1epdf.html#ac4b863ff84c7a4882fb3ad18556027f9">00408</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1epdf.html#ac4b863ff84c7a4882fb3ad18556027f9" title="True if rv is assigned.">isnamed</a>()<span class="keyword"> const </span>{ |
| 308 | <a name="l00409"></a>00409 <span class="keywordtype">bool</span> b = ( <a class="code" href="classbdm_1_1epdf.html#a16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> == <a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ); |
| 309 | <a name="l00410"></a>00410 <span class="keywordflow">return</span> b; |
| 310 | <a name="l00411"></a>00411 } |
| 311 | <a name="l00412"></a>00412 |
| 312 | <a name="l00414"></a><a class="code" href="classbdm_1_1epdf.html#aa4ab378d5e004c3ff3e2d4e64f7bba21">00414</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#aa4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>()<span class="keyword"> const </span>{ |
| 313 | <a name="l00415"></a>00415 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( <a class="code" href="classbdm_1_1epdf.html#ac4b863ff84c7a4882fb3ad18556027f9" title="True if rv is assigned.">isnamed</a>(), <span class="stringliteral">""</span> ); |
| 314 | <a name="l00416"></a>00416 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1epdf.html#a62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>; |
| 315 | <a name="l00417"></a>00417 } |
329 | | <a name="l00442"></a><a class="code" href="classbdm_1_1mpdf.html#a6336a8a72462e2a56a3989a220f18b1b">00442</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mpdf.html#a6336a8a72462e2a56a3989a220f18b1b" 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) { |
330 | | <a name="l00443"></a>00443 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"Not implemented"</span>); |
331 | | <a name="l00444"></a>00444 <span class="keywordflow">return</span> 0.0; |
332 | | <a name="l00445"></a>00445 } |
333 | | <a name="l00446"></a>00446 |
334 | | <a name="l00448"></a><a class="code" href="classbdm_1_1mpdf.html#a0b0ed1ed663071bb7cf4a1349eb94fcb">00448</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1mpdf.html#a0b0ed1ed663071bb7cf4a1349eb94fcb" title="Matrix version of evallogcond.">evallogcond_m</a> (<span class="keyword">const</span> mat &Dt, <span class="keyword">const</span> vec &cond) { |
335 | | <a name="l00449"></a>00449 vec v(Dt.cols()); |
336 | | <a name="l00450"></a>00450 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<Dt.cols();i++){v(i)= <a class="code" href="classbdm_1_1mpdf.html#a6336a8a72462e2a56a3989a220f18b1b" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a>(Dt.get_col(i),cond);} |
337 | | <a name="l00451"></a>00451 <span class="keywordflow">return</span> v; |
338 | | <a name="l00452"></a>00452 } |
339 | | <a name="l00453"></a>00453 |
340 | | <a name="l00455"></a><a class="code" href="classbdm_1_1mpdf.html#a2a0d03756f59924fd038980ee60bd904">00455</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1mpdf.html#a2a0d03756f59924fd038980ee60bd904" title="Array&lt;vec&gt; version of evallogcond.">evallogcond_m</a> (<span class="keyword">const</span> Array<vec> &Dt, <span class="keyword">const</span> vec &cond) { |
341 | | <a name="l00456"></a>00456 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"Not implemented"</span>); |
342 | | <a name="l00457"></a>00457 <span class="keywordflow">return</span> vec(); |
343 | | <a name="l00458"></a>00458 } |
344 | | <a name="l00459"></a>00459 |
345 | | <a name="l00462"></a>00462 |
346 | | <a name="l00463"></a>00463 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> _rv()<span class="keyword"> const </span>{ |
347 | | <a name="l00464"></a>00464 <span class="keywordflow">return</span> ep-><a class="code" href="classbdm_1_1epdf.html#aa4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>(); |
348 | | <a name="l00465"></a>00465 } |
349 | | <a name="l00466"></a>00466 RV _rvc() { |
350 | | <a name="l00467"></a>00467 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#a5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>; |
351 | | <a name="l00468"></a>00468 } |
352 | | <a name="l00469"></a>00469 |
353 | | <a name="l00470"></a>00470 <span class="keywordtype">int</span> dimension()<span class="keyword"> const </span>{ |
354 | | <a name="l00471"></a>00471 <span class="keywordflow">return</span> ep->dimension(); |
355 | | <a name="l00472"></a>00472 } |
356 | | <a name="l00473"></a>00473 <span class="keywordtype">int</span> dimensionc() { |
357 | | <a name="l00474"></a>00474 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>; |
358 | | <a name="l00475"></a>00475 } |
| 328 | <a name="l00441"></a>00441 }; |
| 329 | <a name="l00442"></a>00442 SHAREDPTR ( epdf ); |
| 330 | <a name="l00443"></a>00443 |
| 331 | <a name="l00445"></a><a class="code" href="classbdm_1_1mpdf.html">00445</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> { |
| 332 | <a name="l00446"></a>00446 <span class="keyword">protected</span>: |
| 333 | <a name="l00448"></a><a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6">00448</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>; |
| 334 | <a name="l00450"></a><a class="code" href="classbdm_1_1mpdf.html#a5a5f08950daa08b85b01ddf4e1c36288">00450</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#a5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>; |
| 335 | <a name="l00451"></a>00451 <span class="keyword">private</span>: |
| 336 | <a name="l00453"></a>00453 <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* ep; |
| 337 | <a name="l00454"></a>00454 |
| 338 | <a name="l00455"></a>00455 <span class="keyword">protected</span>: |
| 339 | <a name="l00457"></a><a class="code" href="classbdm_1_1mpdf.html#a147afacb393324bb3f9a7a89e33f835e">00457</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mpdf.html#a147afacb393324bb3f9a7a89e33f835e" title="set internal pointer ep to point to given iepdf ">set_ep</a> ( <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> &iepdf ) { |
| 340 | <a name="l00458"></a>00458 ep = &iepdf; |
| 341 | <a name="l00459"></a>00459 } |
| 342 | <a name="l00461"></a><a class="code" href="classbdm_1_1mpdf.html#a7555b377f8b5895c9b759c9628ee3e20">00461</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mpdf.html#a7555b377f8b5895c9b759c9628ee3e20" title="set internal pointer ep to point to given iepdf ">set_ep</a> ( <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> *iepdfp ) { |
| 343 | <a name="l00462"></a>00462 ep = iepdfp; |
| 344 | <a name="l00463"></a>00463 } |
| 345 | <a name="l00464"></a>00464 |
| 346 | <a name="l00465"></a>00465 <span class="keyword">public</span>: |
| 347 | <a name="l00468"></a>00468 |
| 348 | <a name="l00469"></a>00469 <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a>() : <a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> ( 0 ), <a class="code" href="classbdm_1_1mpdf.html#a5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>(), ep ( NULL ) { } |
| 349 | <a name="l00470"></a>00470 |
| 350 | <a name="l00471"></a>00471 mpdf ( <span class="keyword">const</span> mpdf &m ) : <a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> ( m.<a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> ), <a class="code" href="classbdm_1_1mpdf.html#a5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> ( m.<a class="code" href="classbdm_1_1mpdf.html#a5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> ), ep ( m.ep ) { } |
| 351 | <a name="l00473"></a>00473 |
360 | | <a name="l00486"></a>00486 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mpdf.html#a30a0bceb948e287d497c578e371b1667">from_setting</a> (<span class="keyword">const</span> Setting &<span class="keyword">set</span>); |
361 | | <a name="l00488"></a>00488 |
362 | | <a name="l00491"></a>00491 <span class="keywordtype">void</span> set_rvc (<span class="keyword">const</span> RV &rvc0) { |
363 | | <a name="l00492"></a>00492 <a class="code" href="classbdm_1_1mpdf.html#a5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> = rvc0; |
364 | | <a name="l00493"></a>00493 } |
365 | | <a name="l00494"></a>00494 <span class="keywordtype">void</span> set_rv (<span class="keyword">const</span> RV &rv0) { |
366 | | <a name="l00495"></a>00495 ep->set_rv (rv0); |
367 | | <a name="l00496"></a>00496 } |
368 | | <a name="l00497"></a>00497 <span class="keywordtype">bool</span> isnamed() { |
369 | | <a name="l00498"></a>00498 <span class="keywordflow">return</span> (ep->isnamed()) && (<a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> == <a class="code" href="classbdm_1_1mpdf.html#a5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>._dsize()); |
370 | | <a name="l00499"></a>00499 } |
371 | | <a name="l00501"></a>00501 }; |
372 | | <a name="l00502"></a>00502 SHAREDPTR(mpdf); |
373 | | <a name="l00503"></a>00503 |
374 | | <a name="l00505"></a>00505 <span class="keyword">template</span> <<span class="keyword">class</span> EPDF> |
375 | | <a name="l00506"></a><a class="code" href="classbdm_1_1mpdf__internal.html">00506</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mpdf__internal.html" title="Mpdf with internal epdf that is modified by function condition.">mpdf_internal</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a> |
376 | | <a name="l00507"></a>00507 { |
377 | | <a name="l00508"></a>00508 <span class="keyword">protected</span> : |
378 | | <a name="l00510"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468">00510</a> EPDF <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>; |
379 | | <a name="l00511"></a>00511 <span class="keyword">public</span>: |
380 | | <a name="l00513"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae054b86262261abe0724f5890218689f">00513</a> <a class="code" href="classbdm_1_1mpdf__internal.html#ae054b86262261abe0724f5890218689f" title="constructor">mpdf_internal</a>() : <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a>(), <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>() {<a class="code" href="classbdm_1_1mpdf.html#a147afacb393324bb3f9a7a89e33f835e" title="set internal pointer ep to point to given iepdf ">set_ep</a> (<a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>);} |
381 | | <a name="l00514"></a>00514 |
382 | | <a name="l00517"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">00517</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">condition</a> (<span class="keyword">const</span> vec &cond) { |
383 | | <a name="l00518"></a>00518 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"Not implemented"</span>); |
384 | | <a name="l00519"></a>00519 } |
385 | | <a name="l00520"></a>00520 |
386 | | <a name="l00522"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a6b4d1cb8d7e230e313b4f0c905874d5a">00522</a> EPDF& <a class="code" href="classbdm_1_1mpdf__internal.html#a6b4d1cb8d7e230e313b4f0c905874d5a" title="access function to iepdf">e</a>() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>;} |
| 353 | <a name="l00478"></a><a class="code" href="classbdm_1_1mpdf.html#af0c1db6fcbb3aae2dd6123884457a367">00478</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1mpdf.html#af0c1db6fcbb3aae2dd6123884457a367" title="Returns a sample from the density conditioned on cond, .">samplecond</a> ( <span class="keyword">const</span> vec &cond ) { |
| 354 | <a name="l00479"></a>00479 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 355 | <a name="l00480"></a>00480 <span class="keywordflow">return</span> vec(); |
| 356 | <a name="l00481"></a>00481 } |
| 357 | <a name="l00482"></a>00482 |
| 358 | <a name="l00484"></a>00484 <span class="keyword">virtual</span> mat <a class="code" href="classbdm_1_1mpdf.html#a6e497d501331057309d2fddf63259d1a" title="Returns.">samplecond_m</a> ( <span class="keyword">const</span> vec &cond, <span class="keywordtype">int</span> N ); |
| 359 | <a name="l00485"></a>00485 |
| 360 | <a name="l00487"></a><a class="code" href="classbdm_1_1mpdf.html#a6336a8a72462e2a56a3989a220f18b1b">00487</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mpdf.html#a6336a8a72462e2a56a3989a220f18b1b" 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 ) { |
| 361 | <a name="l00488"></a>00488 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 362 | <a name="l00489"></a>00489 <span class="keywordflow">return</span> 0.0; |
| 363 | <a name="l00490"></a>00490 } |
| 364 | <a name="l00491"></a>00491 |
| 365 | <a name="l00493"></a><a class="code" href="classbdm_1_1mpdf.html#a0b0ed1ed663071bb7cf4a1349eb94fcb">00493</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1mpdf.html#a0b0ed1ed663071bb7cf4a1349eb94fcb" title="Matrix version of evallogcond.">evallogcond_m</a> ( <span class="keyword">const</span> mat &Dt, <span class="keyword">const</span> vec &cond ) { |
| 366 | <a name="l00494"></a>00494 vec v ( Dt.cols() ); |
| 367 | <a name="l00495"></a>00495 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < Dt.cols(); i++ ) { |
| 368 | <a name="l00496"></a>00496 v ( i ) = <a class="code" href="classbdm_1_1mpdf.html#a6336a8a72462e2a56a3989a220f18b1b" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a> ( Dt.get_col ( i ), cond ); |
| 369 | <a name="l00497"></a>00497 } |
| 370 | <a name="l00498"></a>00498 <span class="keywordflow">return</span> v; |
| 371 | <a name="l00499"></a>00499 } |
| 372 | <a name="l00500"></a>00500 |
| 373 | <a name="l00502"></a><a class="code" href="classbdm_1_1mpdf.html#a2a0d03756f59924fd038980ee60bd904">00502</a> <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1mpdf.html#a2a0d03756f59924fd038980ee60bd904" title="Array&lt;vec&gt; version of evallogcond.">evallogcond_m</a> ( <span class="keyword">const</span> Array<vec> &Dt, <span class="keyword">const</span> vec &cond ) { |
| 374 | <a name="l00503"></a>00503 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 375 | <a name="l00504"></a>00504 <span class="keywordflow">return</span> vec(); |
| 376 | <a name="l00505"></a>00505 } |
| 377 | <a name="l00506"></a>00506 |
| 378 | <a name="l00509"></a>00509 |
| 379 | <a name="l00510"></a>00510 <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>{ |
| 380 | <a name="l00511"></a>00511 <span class="keywordflow">return</span> ep-><a class="code" href="classbdm_1_1epdf.html#aa4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>(); |
| 381 | <a name="l00512"></a>00512 } |
| 382 | <a name="l00513"></a>00513 <span class="keyword">const</span> RV& _rvc()<span class="keyword"> const </span>{ |
| 383 | <a name="l00514"></a>00514 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#a5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>; |
| 384 | <a name="l00515"></a>00515 } |
| 385 | <a name="l00516"></a>00516 |
| 386 | <a name="l00517"></a>00517 <span class="keywordtype">int</span> dimension()<span class="keyword"> const </span>{ |
| 387 | <a name="l00518"></a>00518 <span class="keywordflow">return</span> ep->dimension(); |
| 388 | <a name="l00519"></a>00519 } |
| 389 | <a name="l00520"></a>00520 <span class="keywordtype">int</span> dimensionc() { |
| 390 | <a name="l00521"></a>00521 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a>; |
| 391 | <a name="l00522"></a>00522 } |
395 | | <a name="l00561"></a><a class="code" href="classbdm_1_1datalink.html">00561</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> |
396 | | <a name="l00562"></a>00562 { |
397 | | <a name="l00563"></a>00563 <span class="keyword">protected</span>: |
398 | | <a name="l00565"></a><a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c">00565</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>; |
399 | | <a name="l00566"></a>00566 |
400 | | <a name="l00568"></a><a class="code" href="classbdm_1_1datalink.html#a0f0d0af6848114d96108d3a6af25a045">00568</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink.html#a0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a>; |
401 | | <a name="l00569"></a>00569 |
402 | | <a name="l00571"></a><a class="code" href="classbdm_1_1datalink.html#a240b37d793c6bdc32824ed0a0541b1eb">00571</a> ivec <a class="code" href="classbdm_1_1datalink.html#a240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indices of the upper val">v2v_up</a>; |
403 | | <a name="l00572"></a>00572 |
404 | | <a name="l00573"></a>00573 <span class="keyword">public</span>: |
405 | | <a name="l00575"></a><a class="code" href="classbdm_1_1datalink.html#ab8b5d5074fc1310a37c3713d58b900e2">00575</a> <a class="code" href="classbdm_1_1datalink.html#ab8b5d5074fc1310a37c3713d58b900e2" title="Constructor.">datalink</a>() : <a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a> (0), <a class="code" href="classbdm_1_1datalink.html#a0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a> (0) { } |
406 | | <a name="l00576"></a>00576 |
407 | | <a name="l00578"></a><a class="code" href="classbdm_1_1datalink.html#a4016403730eb742462614d60393565cd">00578</a> <a class="code" href="classbdm_1_1datalink.html#a4016403730eb742462614d60393565cd" title="Convenience 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) { |
408 | | <a name="l00579"></a>00579 <a class="code" href="classbdm_1_1datalink.html#afb8337aac8329eb0ca96bfb3ff73ec67" title="set connection, rv must be fully present in rv_up">set_connection</a> (rv, rv_up); |
409 | | <a name="l00580"></a>00580 } |
410 | | <a name="l00581"></a>00581 |
411 | | <a name="l00583"></a>00583 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink.html#afb8337aac8329eb0ca96bfb3ff73ec67" 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); |
412 | | <a name="l00584"></a>00584 |
413 | | <a name="l00586"></a>00586 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink.html#afb8337aac8329eb0ca96bfb3ff73ec67" title="set connection, rv must be fully present in rv_up">set_connection</a> (<span class="keywordtype">int</span> ds, <span class="keywordtype">int</span> us, <span class="keyword">const</span> ivec &upind); |
414 | | <a name="l00587"></a>00587 |
415 | | <a name="l00589"></a><a class="code" href="classbdm_1_1datalink.html#a5b5368c3899eed2f670d09142c2548e5">00589</a> vec <a class="code" href="classbdm_1_1datalink.html#a5b5368c3899eed2f670d09142c2548e5" title="Get val for myself from val of &quot;Up&quot;.">pushdown</a> (<span class="keyword">const</span> vec &val_up) { |
416 | | <a name="l00590"></a>00590 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> (<a class="code" href="classbdm_1_1datalink.html#a0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a> == val_up.length(), <span class="stringliteral">"Wrong val_up"</span>); |
417 | | <a name="l00591"></a>00591 <span class="keywordflow">return</span> get_vec (val_up, <a class="code" href="classbdm_1_1datalink.html#a240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indices of the upper val">v2v_up</a>); |
418 | | <a name="l00592"></a>00592 } |
419 | | <a name="l00593"></a>00593 |
420 | | <a name="l00595"></a><a class="code" href="classbdm_1_1datalink.html#a610e966f2edb1fcd6a5b28267c571793">00595</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink.html#a610e966f2edb1fcd6a5b28267c571793" title="Fill val of &quot;Up&quot; by my pieces.">pushup</a> (vec &val_up, <span class="keyword">const</span> vec &val) { |
421 | | <a name="l00596"></a>00596 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> (<a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a> == val.length(), <span class="stringliteral">"Wrong val"</span>); |
422 | | <a name="l00597"></a>00597 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> (<a class="code" href="classbdm_1_1datalink.html#a0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a> == val_up.length(), <span class="stringliteral">"Wrong val_up"</span>); |
423 | | <a name="l00598"></a>00598 set_subvector (val_up, <a class="code" href="classbdm_1_1datalink.html#a240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indices of the upper val">v2v_up</a>, val); |
424 | | <a name="l00599"></a>00599 } |
425 | | <a name="l00600"></a>00600 }; |
426 | | <a name="l00601"></a>00601 |
427 | | <a name="l00603"></a><a class="code" href="classbdm_1_1datalink__m2e.html">00603</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__m2e.html" title="Data link with a condition.">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> |
428 | | <a name="l00604"></a>00604 { |
429 | | <a name="l00605"></a>00605 <span class="keyword">protected</span>: |
430 | | <a name="l00607"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9">00607</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>; |
431 | | <a name="l00608"></a>00608 |
432 | | <a name="l00610"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a43fe3e2d7aa04134053ec15793722783">00610</a> ivec <a class="code" href="classbdm_1_1datalink__m2e.html#a43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indices of the upper val">v2c_up</a>; |
433 | | <a name="l00611"></a>00611 |
434 | | <a name="l00613"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc">00613</a> ivec <a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, indices of the local cond">v2c_lo</a>; |
435 | | <a name="l00614"></a>00614 |
436 | | <a name="l00615"></a>00615 <span class="keyword">public</span>: |
437 | | <a name="l00617"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a5ad951e9cf850c9bfe4e492e91a50af6">00617</a> <a class="code" href="classbdm_1_1datalink__m2e.html#a5ad951e9cf850c9bfe4e492e91a50af6" title="Constructor.">datalink_m2e</a>() : <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> (0) { } |
| 395 | <a name="l00538"></a>00538 <span class="keywordtype">void</span> set_rvc ( <span class="keyword">const</span> RV &rvc0 ) { |
| 396 | <a name="l00539"></a>00539 <a class="code" href="classbdm_1_1mpdf.html#a5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> = rvc0; |
| 397 | <a name="l00540"></a>00540 } |
| 398 | <a name="l00541"></a>00541 <span class="keywordtype">void</span> set_rv ( <span class="keyword">const</span> RV &rv0 ) { |
| 399 | <a name="l00542"></a>00542 ep->set_rv ( rv0 ); |
| 400 | <a name="l00543"></a>00543 } |
| 401 | <a name="l00544"></a>00544 <span class="keywordtype">bool</span> isnamed() { |
| 402 | <a name="l00545"></a>00545 <span class="keywordflow">return</span> ( ep->isnamed() ) && ( <a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> == <a class="code" href="classbdm_1_1mpdf.html#a5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>._dsize() ); |
| 403 | <a name="l00546"></a>00546 } |
| 404 | <a name="l00548"></a>00548 }; |
| 405 | <a name="l00549"></a>00549 SHAREDPTR ( mpdf ); |
| 406 | <a name="l00550"></a>00550 |
| 407 | <a name="l00552"></a>00552 <span class="keyword">template</span> <<span class="keyword">class</span> EPDF> |
| 408 | <a name="l00553"></a><a class="code" href="classbdm_1_1mpdf__internal.html">00553</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mpdf__internal.html" title="Mpdf with internal epdf that is modified by function condition.">mpdf_internal</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a> { |
| 409 | <a name="l00554"></a>00554 <span class="keyword">protected</span> : |
| 410 | <a name="l00556"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468">00556</a> EPDF <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>; |
| 411 | <a name="l00557"></a>00557 <span class="keyword">public</span>: |
| 412 | <a name="l00559"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae054b86262261abe0724f5890218689f">00559</a> <a class="code" href="classbdm_1_1mpdf__internal.html#ae054b86262261abe0724f5890218689f" title="constructor">mpdf_internal</a>() : <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a>(), <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>() { |
| 413 | <a name="l00560"></a>00560 <a class="code" href="classbdm_1_1mpdf.html#a147afacb393324bb3f9a7a89e33f835e" title="set internal pointer ep to point to given iepdf ">set_ep</a> ( <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a> ); |
| 414 | <a name="l00561"></a>00561 } |
| 415 | <a name="l00562"></a>00562 |
| 416 | <a name="l00565"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">00565</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( <span class="keyword">const</span> vec &cond ) { |
| 417 | <a name="l00566"></a>00566 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 418 | <a name="l00567"></a>00567 } |
| 419 | <a name="l00568"></a>00568 |
| 420 | <a name="l00570"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a6b4d1cb8d7e230e313b4f0c905874d5a">00570</a> EPDF& <a class="code" href="classbdm_1_1mpdf__internal.html#a6b4d1cb8d7e230e313b4f0c905874d5a" title="access function to iepdf">e</a>() { |
| 421 | <a name="l00571"></a>00571 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>; |
| 422 | <a name="l00572"></a>00572 } |
| 423 | <a name="l00573"></a>00573 |
| 424 | <a name="l00575"></a>00575 vec <a class="code" href="classbdm_1_1mpdf__internal.html#ad8e547695d1cc19219b91164d825c930" title="Reimplements samplecond using condition().">samplecond</a> ( <span class="keyword">const</span> vec &cond ); |
| 425 | <a name="l00577"></a>00577 <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a89076e62b8d7df7616bad68c94591948" title="Reimplements evallogcond using condition().">evallogcond</a> ( <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ); |
| 426 | <a name="l00579"></a>00579 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c" title="Efficient version of evallogcond for matrices.">evallogcond_m</a> ( <span class="keyword">const</span> mat &Dt, <span class="keyword">const</span> vec &cond ); |
| 427 | <a name="l00581"></a>00581 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c" title="Efficient version of evallogcond for matrices.">evallogcond_m</a> ( <span class="keyword">const</span> Array<vec> &Dt, <span class="keyword">const</span> vec &cond ); |
| 428 | <a name="l00583"></a>00583 <span class="keyword">virtual</span> mat <a class="code" href="classbdm_1_1mpdf__internal.html#a9554c554054da2d22cb8e908ae9c8823" title="Efficient version of samplecond.">samplecond_m</a> ( <span class="keyword">const</span> vec &cond, <span class="keywordtype">int</span> N ); |
| 429 | <a name="l00584"></a>00584 }; |
| 430 | <a name="l00585"></a>00585 |
| 431 | <a name="l00611"></a><a class="code" href="classbdm_1_1datalink.html">00611</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> { |
| 432 | <a name="l00612"></a>00612 <span class="keyword">protected</span>: |
| 433 | <a name="l00614"></a><a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c">00614</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>; |
| 434 | <a name="l00615"></a>00615 |
| 435 | <a name="l00617"></a><a class="code" href="classbdm_1_1datalink.html#a0f0d0af6848114d96108d3a6af25a045">00617</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink.html#a0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a>; |
441 | | <a name="l00623"></a>00623 vec <a class="code" href="classbdm_1_1datalink__m2e.html#a7ba850822e3cf9a4b079afc7e7c01703" title="Construct condition.">get_cond</a> (<span class="keyword">const</span> vec &val_up); |
442 | | <a name="l00624"></a>00624 |
443 | | <a name="l00626"></a>00626 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__m2e.html#ab29bc3c7bf2a1d87e77ccaa793d097d5" title="Copy corresponding values to Up.condition.">pushup_cond</a> (vec &val_up, <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond); |
444 | | <a name="l00627"></a>00627 }; |
445 | | <a name="l00628"></a>00628 |
446 | | <a name="l00631"></a><a class="code" href="classbdm_1_1datalink__m2m.html">00631</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 with a condition.">datalink_m2e</a> |
447 | | <a name="l00632"></a>00632 { |
448 | | <a name="l00633"></a>00633 <span class="keyword">protected</span>: |
449 | | <a name="l00635"></a><a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d">00635</a> ivec <a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indices of the upper cond">c2c_up</a>; |
450 | | <a name="l00637"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5">00637</a> ivec <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>; |
451 | | <a name="l00638"></a>00638 |
452 | | <a name="l00639"></a>00639 <span class="keyword">public</span>: |
453 | | <a name="l00641"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a3baed32cb66f0e2f731032cec0a4d287">00641</a> <a class="code" href="classbdm_1_1datalink__m2m.html#a3baed32cb66f0e2f731032cec0a4d287" title="Constructor.">datalink_m2m</a>() {}; |
454 | | <a name="l00643"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a0ed49a99e8a3be264b952558b6f515d4">00643</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__m2m.html#a0ed49a99e8a3be264b952558b6f515d4" title="Set connection between the vectors.">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, <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) { |
455 | | <a name="l00644"></a>00644 <a class="code" href="classbdm_1_1datalink__m2m.html#a0ed49a99e8a3be264b952558b6f515d4" title="Set connection between the vectors.">datalink_m2e::set_connection</a> (rv, rvc, rv_up); |
456 | | <a name="l00645"></a>00645 <span class="comment">//establish c2c connection</span> |
457 | | <a name="l00646"></a>00646 rvc.<a class="code" href="classbdm_1_1RV.html#acbebdb5e0d30101a6eb63550ef701c55">dataind</a> (rvc_up, <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>, <a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indices of the upper cond">c2c_up</a>); |
458 | | <a name="l00647"></a>00647 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> (<a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>.length() + <a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, indices of the local cond">v2c_lo</a>.length() == <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>, <span class="stringliteral">"cond is not fully given"</span>); |
459 | | <a name="l00648"></a>00648 } |
460 | | <a name="l00649"></a>00649 |
461 | | <a name="l00651"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a911fb7fcfa80d4e31db8e0cc03141a90">00651</a> vec <a class="code" href="classbdm_1_1datalink__m2m.html#a911fb7fcfa80d4e31db8e0cc03141a90" 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) { |
462 | | <a name="l00652"></a>00652 vec tmp (<a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>); |
463 | | <a name="l00653"></a>00653 set_subvector (tmp, <a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, indices of the local cond">v2c_lo</a>, val_up (<a class="code" href="classbdm_1_1datalink__m2e.html#a43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indices of the upper val">v2c_up</a>)); |
464 | | <a name="l00654"></a>00654 set_subvector (tmp, <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>, cond_up (<a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indices of the upper cond">c2c_up</a>)); |
465 | | <a name="l00655"></a>00655 <span class="keywordflow">return</span> tmp; |
466 | | <a name="l00656"></a>00656 } |
467 | | <a name="l00658"></a>00658 |
468 | | <a name="l00659"></a>00659 }; |
469 | | <a name="l00660"></a>00660 |
470 | | <a name="l00666"></a><a class="code" href="classbdm_1_1logger.html">00666</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_1root.html" title="Root class of BDM objects.">root</a> |
471 | | <a name="l00667"></a>00667 { |
472 | | <a name="l00668"></a>00668 <span class="keyword">protected</span>: |
473 | | <a name="l00670"></a><a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f">00670</a> Array<RV> <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>; |
474 | | <a name="l00672"></a><a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02">00672</a> Array<string> <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>; |
475 | | <a name="l00673"></a>00673 <span class="keyword">public</span>: |
476 | | <a name="l00675"></a><a class="code" href="classbdm_1_1logger.html#af9c2fe7db5ddbda0098a4a5bd2c29fbf">00675</a> <a class="code" href="classbdm_1_1logger.html#af9c2fe7db5ddbda0098a4a5bd2c29fbf" title="Default constructor.">logger</a>() : <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> (0), <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a> (0) {} |
477 | | <a name="l00676"></a>00676 |
478 | | <a name="l00679"></a><a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7">00679</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7">add</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="keywordtype">string</span> prefix = <span class="stringliteral">""</span>) { |
479 | | <a name="l00680"></a>00680 <span class="keywordtype">int</span> id; |
480 | | <a name="l00681"></a>00681 <span class="keywordflow">if</span> (rv._dsize() > 0) { |
481 | | <a name="l00682"></a>00682 <span class="keywordtype">id</span> = <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.length(); |
482 | | <a name="l00683"></a>00683 <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a> = concat (<a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>, prefix); <span class="comment">// diff</span> |
483 | | <a name="l00684"></a>00684 <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.set_length (<span class="keywordtype">id</span> + 1, <span class="keyword">true</span>); |
484 | | <a name="l00685"></a>00685 <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> (<span class="keywordtype">id</span>) = rv; |
485 | | <a name="l00686"></a>00686 } <span class="keywordflow">else</span> { |
486 | | <a name="l00687"></a>00687 <span class="keywordtype">id</span> = -1; |
487 | | <a name="l00688"></a>00688 } |
488 | | <a name="l00689"></a>00689 <span class="keywordflow">return</span> id; <span class="comment">// identifier of the last entry</span> |
489 | | <a name="l00690"></a>00690 } |
490 | | <a name="l00691"></a>00691 |
491 | | <a name="l00693"></a><a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309">00693</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> (<span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> vec &v) {<a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a>(<span class="stringliteral">"Not implemented"</span>);}; |
492 | | <a name="l00695"></a><a class="code" href="classbdm_1_1logger.html#aaa1d72cd3d2ff6bbf87340154af02ea6">00695</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#aaa1d72cd3d2ff6bbf87340154af02ea6" title="log this double">logit</a> (<span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> <span class="keywordtype">double</span> &d) {<a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a>(<span class="stringliteral">"Not implemented"</span>);}; |
493 | | <a name="l00696"></a>00696 |
494 | | <a name="l00698"></a><a class="code" href="classbdm_1_1logger.html#af137e9a0c905357c5c3fbb16eac34a99">00698</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#af137e9a0c905357c5c3fbb16eac34a99" title="Shifts storage position for another time step.">step</a>() {<a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a>(<span class="stringliteral">"Not implemneted"</span>);}; |
495 | | <a name="l00699"></a>00699 |
496 | | <a name="l00701"></a><a class="code" href="classbdm_1_1logger.html#a0e3fc7d13e23a8f71fc7c8a5ea68559d">00701</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#a0e3fc7d13e23a8f71fc7c8a5ea68559d" title="Finalize storing information.">finalize</a>() {}; |
497 | | <a name="l00702"></a>00702 |
498 | | <a name="l00704"></a><a class="code" href="classbdm_1_1logger.html#acd6291a73491f755dc7bc88d022eb2fc">00704</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#acd6291a73491f755dc7bc88d022eb2fc" title="Initialize the storage.">init</a>() {}; |
499 | | <a name="l00705"></a>00705 |
500 | | <a name="l00706"></a>00706 }; |
501 | | <a name="l00707"></a>00707 |
502 | | <a name="l00711"></a><a class="code" href="classbdm_1_1mepdf.html">00711</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 , where is random variable, rv, and...">mpdf</a> |
503 | | <a name="l00712"></a>00712 { |
504 | | <a name="l00714"></a>00714 <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<epdf></a> iepdf; |
505 | | <a name="l00715"></a>00715 <span class="keyword">public</span>: |
506 | | <a name="l00717"></a><a class="code" href="classbdm_1_1mepdf.html#a4a2b01e7bb510c6b8946757cae6c9155">00717</a> <a class="code" href="classbdm_1_1mepdf.html#a4a2b01e7bb510c6b8946757cae6c9155" title="Default constructor.">mepdf</a>() { } |
507 | | <a name="l00719"></a><a class="code" href="classbdm_1_1mepdf.html#a1f94e70702ff676f53d95ca7ec38e25c">00719</a> <a class="code" href="classbdm_1_1mepdf.html#a1f94e70702ff676f53d95ca7ec38e25c" title="Set internal shared pointer.">mepdf</a> (<a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<epdf></a> em) { |
508 | | <a name="l00720"></a>00720 iepdf = em; |
509 | | <a name="l00721"></a>00721 <a class="code" href="classbdm_1_1mpdf.html#a147afacb393324bb3f9a7a89e33f835e" title="set internal pointer ep to point to given iepdf ">set_ep</a> (*iepdf.<a class="code" href="classbdm_1_1shared__ptr.html#a37ebcfb6750dd7b5630f1d2354c07a96">get</a>()); |
510 | | <a name="l00722"></a>00722 <a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> = 0; |
511 | | <a name="l00723"></a>00723 } |
512 | | <a name="l00724"></a>00724 |
513 | | <a name="l00726"></a><a class="code" href="classbdm_1_1mepdf.html#ab904a90ef78294040b498717cc13015e">00726</a> vec <a class="code" href="classbdm_1_1mepdf.html#ab904a90ef78294040b498717cc13015e" title="empty">samplecond</a>(<span class="keyword">const</span> vec &cond){<span class="keywordflow">return</span> iepdf->sample();} |
514 | | <a name="l00727"></a><a class="code" href="classbdm_1_1mepdf.html#a57decd7718f3789e9d1f10f19def935b">00727</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mepdf.html#a57decd7718f3789e9d1f10f19def935b" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a>(<span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond){<span class="keywordflow">return</span> iepdf->evallog(val);} |
515 | | <a name="l00728"></a>00728 |
516 | | <a name="l00736"></a>00736 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mepdf.html#a27ef18a3e3b1b5de02739d1324bf25fb">from_setting</a> (<span class="keyword">const</span> Setting &<span class="keyword">set</span>); |
517 | | <a name="l00737"></a>00737 }; |
518 | | <a name="l00738"></a>00738 <a class="code" href="user__info_8h.html#a4f9de2f17e844047726487b99def99c6" title="Macro for registration of class into map of user-infos, registered class is scriptable...">UIREGISTER</a> (mepdf); |
519 | | <a name="l00739"></a>00739 SHAREDPTR (mepdf); |
520 | | <a name="l00740"></a>00740 |
521 | | <a name="l00742"></a>00742 RV get_composite_rv ( <span class="keyword">const</span> Array<shared_ptr<mpdf> > &mpdfs, <span class="keywordtype">bool</span> checkoverlap = <span class="keyword">false</span> ); |
522 | | <a name="l00743"></a>00743 |
523 | | <a name="l00751"></a><a class="code" href="classbdm_1_1DS.html">00751</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_1root.html" title="Root class of BDM objects.">root</a> |
524 | | <a name="l00752"></a>00752 { |
525 | | <a name="l00753"></a>00753 <span class="keyword">protected</span>: |
526 | | <a name="l00754"></a>00754 <span class="keywordtype">int</span> dtsize; |
527 | | <a name="l00755"></a>00755 <span class="keywordtype">int</span> utsize; |
528 | | <a name="l00757"></a><a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec">00757</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#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>; |
529 | | <a name="l00759"></a><a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702">00759</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#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>; <span class="comment">//</span> |
530 | | <a name="l00761"></a><a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867">00761</a> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>, L_ut; |
531 | | <a name="l00762"></a>00762 <span class="keyword">public</span>: |
532 | | <a name="l00764"></a><a class="code" href="classbdm_1_1DS.html#abedd82e08ae6686b4b1732a122c2201a">00764</a> <a class="code" href="classbdm_1_1DS.html#abedd82e08ae6686b4b1732a122c2201a" title="default constructors">DS</a>() : <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>(), <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>() {}; |
533 | | <a name="l00765"></a>00765 |
534 | | <a name="l00767"></a><a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba">00767</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> (vec &dt) { |
535 | | <a name="l00768"></a>00768 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"abstract class"</span>); |
536 | | <a name="l00769"></a>00769 } |
537 | | <a name="l00770"></a>00770 |
538 | | <a name="l00772"></a><a class="code" href="classbdm_1_1DS.html#aa0bf451c7fea73ff4150ff9e83da4832">00772</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#aa0bf451c7fea73ff4150ff9e83da4832" title="Returns data records at indeces.">getdata</a> (vec &dt, <span class="keyword">const</span> ivec &indeces) { |
539 | | <a name="l00773"></a>00773 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"abstract class"</span>); |
540 | | <a name="l00774"></a>00774 } |
| 439 | <a name="l00622"></a>00622 <span class="keyword">public</span>: |
| 440 | <a name="l00624"></a><a class="code" href="classbdm_1_1datalink.html#ab8b5d5074fc1310a37c3713d58b900e2">00624</a> <a class="code" href="classbdm_1_1datalink.html#ab8b5d5074fc1310a37c3713d58b900e2" title="Constructor.">datalink</a>() : <a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a> ( 0 ), <a class="code" href="classbdm_1_1datalink.html#a0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a> ( 0 ) { } |
| 441 | <a name="l00625"></a>00625 |
| 442 | <a name="l00627"></a><a class="code" href="classbdm_1_1datalink.html#a4016403730eb742462614d60393565cd">00627</a> <a class="code" href="classbdm_1_1datalink.html#a4016403730eb742462614d60393565cd" title="Convenience 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 ) { |
| 443 | <a name="l00628"></a>00628 <a class="code" href="classbdm_1_1datalink.html#afb8337aac8329eb0ca96bfb3ff73ec67" title="set connection, rv must be fully present in rv_up">set_connection</a> ( rv, rv_up ); |
| 444 | <a name="l00629"></a>00629 } |
| 445 | <a name="l00630"></a>00630 |
| 446 | <a name="l00632"></a>00632 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink.html#afb8337aac8329eb0ca96bfb3ff73ec67" 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 ); |
| 447 | <a name="l00633"></a>00633 |
| 448 | <a name="l00635"></a>00635 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink.html#afb8337aac8329eb0ca96bfb3ff73ec67" title="set connection, rv must be fully present in rv_up">set_connection</a> ( <span class="keywordtype">int</span> ds, <span class="keywordtype">int</span> us, <span class="keyword">const</span> ivec &upind ); |
| 449 | <a name="l00636"></a>00636 |
| 450 | <a name="l00638"></a><a class="code" href="classbdm_1_1datalink.html#a5b5368c3899eed2f670d09142c2548e5">00638</a> vec <a class="code" href="classbdm_1_1datalink.html#a5b5368c3899eed2f670d09142c2548e5" title="Get val for myself from val of &quot;Up&quot;.">pushdown</a> ( <span class="keyword">const</span> vec &val_up ) { |
| 451 | <a name="l00639"></a>00639 vec tmp ( <a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a> ); |
| 452 | <a name="l00640"></a>00640 <a class="code" href="classbdm_1_1datalink.html#abfc15c5e565d4dc1d0110deb5e8c3e6b" title="Get val for vector val_down from val of &quot;Up&quot;.">filldown</a> ( val_up, tmp ); |
| 453 | <a name="l00641"></a>00641 <span class="keywordflow">return</span> tmp; |
| 454 | <a name="l00642"></a>00642 } |
| 455 | <a name="l00644"></a><a class="code" href="classbdm_1_1datalink.html#abfc15c5e565d4dc1d0110deb5e8c3e6b">00644</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink.html#abfc15c5e565d4dc1d0110deb5e8c3e6b" title="Get val for vector val_down from val of &quot;Up&quot;.">filldown</a> ( <span class="keyword">const</span> vec &val_up, vec &val_down ) { |
| 456 | <a name="l00645"></a>00645 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( <a class="code" href="classbdm_1_1datalink.html#a0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a> == val_up.length(), <span class="stringliteral">"Wrong val_up"</span> ); |
| 457 | <a name="l00646"></a>00646 val_down = val_up ( <a class="code" href="classbdm_1_1datalink.html#a240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indices of the upper val">v2v_up</a> ); |
| 458 | <a name="l00647"></a>00647 } |
| 459 | <a name="l00649"></a><a class="code" href="classbdm_1_1datalink.html#a610e966f2edb1fcd6a5b28267c571793">00649</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink.html#a610e966f2edb1fcd6a5b28267c571793" title="Fill val of &quot;Up&quot; by my pieces.">pushup</a> ( vec &val_up, <span class="keyword">const</span> vec &val ) { |
| 460 | <a name="l00650"></a>00650 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( <a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a> == val.length(), <span class="stringliteral">"Wrong val"</span> ); |
| 461 | <a name="l00651"></a>00651 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( <a class="code" href="classbdm_1_1datalink.html#a0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a> == val_up.length(), <span class="stringliteral">"Wrong val_up"</span> ); |
| 462 | <a name="l00652"></a>00652 set_subvector ( val_up, <a class="code" href="classbdm_1_1datalink.html#a240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indices of the upper val">v2v_up</a>, val ); |
| 463 | <a name="l00653"></a>00653 } |
| 464 | <a name="l00655"></a><a class="code" href="classbdm_1_1datalink.html#a340c5a253544a1dc2fd87932a5341c32">00655</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink.html#a340c5a253544a1dc2fd87932a5341c32" title="access functions">_upsize</a>() { |
| 465 | <a name="l00656"></a>00656 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1datalink.html#a0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a>; |
| 466 | <a name="l00657"></a>00657 } |
| 467 | <a name="l00659"></a><a class="code" href="classbdm_1_1datalink.html#a8f0cce4477e906f3090bb803e06d8698">00659</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink.html#a8f0cce4477e906f3090bb803e06d8698" title="access functions">_downsize</a>() { |
| 468 | <a name="l00660"></a>00660 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>; |
| 469 | <a name="l00661"></a>00661 } |
| 470 | <a name="l00662"></a>00662 }; |
| 471 | <a name="l00663"></a>00663 |
| 472 | <a name="l00666"></a><a class="code" href="classbdm_1_1datalink__part.html">00666</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__part.html">datalink_part</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> { |
| 473 | <a name="l00667"></a>00667 <span class="keyword">protected</span>: |
| 474 | <a name="l00669"></a><a class="code" href="classbdm_1_1datalink__part.html#a64f64e7e6357419240bc2b1b0749c943">00669</a> ivec <a class="code" href="classbdm_1_1datalink__part.html#a64f64e7e6357419240bc2b1b0749c943" title="indeces of values in vector downsize">v2v_down</a>; |
| 475 | <a name="l00670"></a>00670 <span class="keyword">public</span>: |
| 476 | <a name="l00671"></a>00671 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__part.html#a6cef1083755c27e4476501abe6f49dce" 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 ); |
| 477 | <a name="l00673"></a><a class="code" href="classbdm_1_1datalink__part.html#aaba9b673ef82584e1bc06cc7a32b0a59">00673</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__part.html#aaba9b673ef82584e1bc06cc7a32b0a59" title="Get val for vector val_down from val of &quot;Up&quot;.">filldown</a> ( <span class="keyword">const</span> vec &val_up, vec &val_down ) { |
| 478 | <a name="l00674"></a>00674 set_subvector ( val_down, <a class="code" href="classbdm_1_1datalink__part.html#a64f64e7e6357419240bc2b1b0749c943" title="indeces of values in vector downsize">v2v_down</a>, val_up ( <a class="code" href="classbdm_1_1datalink.html#a240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indices of the upper val">v2v_up</a> ) ); |
| 479 | <a name="l00675"></a>00675 } |
| 480 | <a name="l00676"></a>00676 }; |
| 481 | <a name="l00677"></a>00677 |
| 482 | <a name="l00682"></a><a class="code" href="classbdm_1_1datalink__buffered.html">00682</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__buffered.html" title="Datalink that buffers delayed values - do not forget to call step().">datalink_buffered</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1datalink__part.html">datalink_part</a> { |
| 483 | <a name="l00683"></a>00683 <span class="keyword">protected</span>: |
| 484 | <a name="l00685"></a><a class="code" href="classbdm_1_1datalink__buffered.html#aa7cb8a47b88b95fde0255a041d076988">00685</a> vec <a class="code" href="classbdm_1_1datalink__buffered.html#aa7cb8a47b88b95fde0255a041d076988" title="History, ordered as .">history</a>; |
| 485 | <a name="l00687"></a><a class="code" href="classbdm_1_1datalink__buffered.html#a211c56b68be3864d535a8b75d735ebdc">00687</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_1datalink__buffered.html#a211c56b68be3864d535a8b75d735ebdc" title="rv of the history">Hrv</a>; |
| 486 | <a name="l00689"></a><a class="code" href="classbdm_1_1datalink__buffered.html#aa1ce2032fe5c86fa87d80baccb9aacd7">00689</a> ivec <a class="code" href="classbdm_1_1datalink__buffered.html#aa1ce2032fe5c86fa87d80baccb9aacd7" title="h2v : indeces in down">h2v_down</a>; |
| 487 | <a name="l00691"></a><a class="code" href="classbdm_1_1datalink__buffered.html#ada58df16761169992059b8cd91d070c5">00691</a> ivec <a class="code" href="classbdm_1_1datalink__buffered.html#ada58df16761169992059b8cd91d070c5" title="h2v : indeces in history">h2v_hist</a>; |
| 488 | <a name="l00693"></a><a class="code" href="classbdm_1_1datalink__buffered.html#a0b09e10e42212497170ed5642bce7dbc">00693</a> ivec <a class="code" href="classbdm_1_1datalink__buffered.html#a0b09e10e42212497170ed5642bce7dbc" title="v2h: indeces of up too be pushed to h">v2h_up</a>; |
| 489 | <a name="l00694"></a>00694 <span class="keyword">public</span>: |
| 490 | <a name="l00695"></a>00695 |
| 491 | <a name="l00696"></a>00696 <a class="code" href="classbdm_1_1datalink__buffered.html" title="Datalink that buffers delayed values - do not forget to call step().">datalink_buffered</a>() : <a class="code" href="classbdm_1_1datalink__part.html">datalink_part</a>(), <a class="code" href="classbdm_1_1datalink__buffered.html#aa7cb8a47b88b95fde0255a041d076988" title="History, ordered as .">history</a> ( 0 ), <a class="code" href="classbdm_1_1datalink__buffered.html#aa1ce2032fe5c86fa87d80baccb9aacd7" title="h2v : indeces in down">h2v_down</a> ( 0 ), <a class="code" href="classbdm_1_1datalink__buffered.html#ada58df16761169992059b8cd91d070c5" title="h2v : indeces in history">h2v_hist</a> ( 0 ) {}; |
| 492 | <a name="l00698"></a><a class="code" href="classbdm_1_1datalink__buffered.html#af137706c55891ba8a8aecc52ea96865f">00698</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__buffered.html#af137706c55891ba8a8aecc52ea96865f" title="push current data to history">step</a> ( <span class="keyword">const</span> vec &val_up ) { |
| 493 | <a name="l00699"></a>00699 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1datalink__buffered.html#a211c56b68be3864d535a8b75d735ebdc" title="rv of the history">Hrv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() > 0 ) { |
| 494 | <a name="l00700"></a>00700 <a class="code" href="classbdm_1_1datalink__buffered.html#aa7cb8a47b88b95fde0255a041d076988" title="History, ordered as .">history</a>.shift_right ( 0, <a class="code" href="classbdm_1_1datalink__buffered.html#a211c56b68be3864d535a8b75d735ebdc" title="rv of the history">Hrv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ); |
| 495 | <a name="l00701"></a>00701 <a class="code" href="classbdm_1_1datalink__buffered.html#aa7cb8a47b88b95fde0255a041d076988" title="History, ordered as .">history</a>.set_subvector ( 0, val_up(<a class="code" href="classbdm_1_1datalink__buffered.html#a0b09e10e42212497170ed5642bce7dbc" title="v2h: indeces of up too be pushed to h">v2h_up</a>) ); <span class="comment">// write U after Drv</span> |
| 496 | <a name="l00702"></a>00702 } |
| 497 | <a name="l00703"></a>00703 } |
| 498 | <a name="l00705"></a><a class="code" href="classbdm_1_1datalink__buffered.html#ae665d66cb42862c1181645c438110a96">00705</a> vec <a class="code" href="classbdm_1_1datalink__buffered.html#ae665d66cb42862c1181645c438110a96" title="Get val for myself from val of &quot;Up&quot;.">pushdown</a> ( <span class="keyword">const</span> vec &val_up ) { |
| 499 | <a name="l00706"></a>00706 vec tmp ( <a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a> ); |
| 500 | <a name="l00707"></a>00707 <a class="code" href="classbdm_1_1datalink__buffered.html#a681745a319728a416486df38aacd579f" title="Get val for vector val_down from val of &quot;Up&quot;.">filldown</a> ( val_up, tmp ); |
| 501 | <a name="l00708"></a>00708 <span class="keywordflow">return</span> tmp; |
| 502 | <a name="l00709"></a>00709 } |
| 503 | <a name="l00710"></a>00710 |
| 504 | <a name="l00711"></a><a class="code" href="classbdm_1_1datalink__buffered.html#a681745a319728a416486df38aacd579f">00711</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__buffered.html#a681745a319728a416486df38aacd579f" title="Get val for vector val_down from val of &quot;Up&quot;.">filldown</a> ( <span class="keyword">const</span> vec &val_up, vec &val_down ) { |
| 505 | <a name="l00712"></a>00712 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( val_down.length() >= <a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a>, <span class="stringliteral">"short val_down"</span> ); |
| 506 | <a name="l00713"></a>00713 |
| 507 | <a name="l00714"></a>00714 set_subvector ( val_down, <a class="code" href="classbdm_1_1datalink__part.html#a64f64e7e6357419240bc2b1b0749c943" title="indeces of values in vector downsize">v2v_down</a>, val_up ( <a class="code" href="classbdm_1_1datalink.html#a240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indices of the upper val">v2v_up</a> ) ); <span class="comment">// copy direct values</span> |
| 508 | <a name="l00715"></a>00715 set_subvector ( val_down, <a class="code" href="classbdm_1_1datalink__buffered.html#aa1ce2032fe5c86fa87d80baccb9aacd7" title="h2v : indeces in down">h2v_down</a>, <a class="code" href="classbdm_1_1datalink__buffered.html#aa7cb8a47b88b95fde0255a041d076988" title="History, ordered as .">history</a> ( <a class="code" href="classbdm_1_1datalink__buffered.html#ada58df16761169992059b8cd91d070c5" title="h2v : indeces in history">h2v_hist</a> ) ); <span class="comment">// copy delayed values</span> |
| 509 | <a name="l00716"></a>00716 } |
| 510 | <a name="l00717"></a>00717 |
| 511 | <a name="l00718"></a><a class="code" href="classbdm_1_1datalink__buffered.html#aadefa427312905425ebab8531da1846a">00718</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__buffered.html#aadefa427312905425ebab8531da1846a" 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 ) { |
| 512 | <a name="l00719"></a>00719 <span class="comment">// create link between up and down</span> |
| 513 | <a name="l00720"></a>00720 <a class="code" href="classbdm_1_1datalink__buffered.html#aadefa427312905425ebab8531da1846a" title="set connection, rv must be fully present in rv_up">datalink_part::set_connection</a> ( rv, rv_up ); |
| 514 | <a name="l00721"></a>00721 |
| 515 | <a name="l00722"></a>00722 <span class="comment">// create rvs of history</span> |
| 516 | <a name="l00723"></a>00723 <span class="comment">// we can store only what we get in rv_up - everything else is removed</span> |
| 517 | <a name="l00724"></a>00724 ivec valid_ids = rv.<a class="code" href="classbdm_1_1RV.html#aa858d36d0264e1f1c89500531162fdf1" title="Find indices of self in another rv, ignore time,.">findself_ids</a> ( rv_up ); |
| 518 | <a name="l00725"></a>00725 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rv_hist = rv.<a class="code" href="classbdm_1_1RV.html#ac0c04ab99ded62e1e05bcefb151ebeb9" title="Select only variables at indices ind.">subselect</a> ( find ( valid_ids >= 0 ) ); <span class="comment">// select only rvs that are in rv_up</span> |
| 519 | <a name="l00726"></a>00726 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rv_hist0 =rv_hist.remove_time(); <span class="comment">// these RVs will form history at time =0</span> |
| 520 | <a name="l00727"></a>00727 <a class="code" href="classbdm_1_1datalink__buffered.html#a0b09e10e42212497170ed5642bce7dbc" title="v2h: indeces of up too be pushed to h">v2h_up</a> = rv_hist0.<a class="code" href="classbdm_1_1RV.html#acbebdb5e0d30101a6eb63550ef701c55" title="when this rv is a part of bigger rv, this function returns indices of self in the...">dataind</a>(rv_up); <span class="comment">// indeces of elements of rv_up to be copied</span> |
| 521 | <a name="l00728"></a>00728 <span class="comment">// now we need to know what is needed from Up</span> |
| 522 | <a name="l00729"></a>00729 rv_hist = rv_hist.<a class="code" href="classbdm_1_1RV.html#ac5819f71d774649412c10b8e1716be1e" title="return rvs with expanded delayes and sorted in the order of:">expand_delayes</a>(); <span class="comment">// full regressor - including time 0</span> |
| 523 | <a name="l00730"></a>00730 <a class="code" href="classbdm_1_1datalink__buffered.html#a211c56b68be3864d535a8b75d735ebdc" title="rv of the history">Hrv</a>=rv_hist.<a class="code" href="classbdm_1_1RV.html#aaec44dabdf0a6d90fbae95e1356eda39" title="Subtract another variable from the current one.">subt</a>(rv_hist0); <span class="comment">// remove time 0</span> |
| 524 | <a name="l00731"></a>00731 <a class="code" href="classbdm_1_1datalink__buffered.html#aa7cb8a47b88b95fde0255a041d076988" title="History, ordered as .">history</a> = zeros ( <a class="code" href="classbdm_1_1datalink__buffered.html#a211c56b68be3864d535a8b75d735ebdc" title="rv of the history">Hrv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ); |
| 525 | <a name="l00732"></a>00732 |
| 526 | <a name="l00733"></a>00733 <a class="code" href="classbdm_1_1datalink__buffered.html#a211c56b68be3864d535a8b75d735ebdc" title="rv of the history">Hrv</a>.<a class="code" href="classbdm_1_1RV.html#acbebdb5e0d30101a6eb63550ef701c55" title="when this rv is a part of bigger rv, this function returns indices of self in the...">dataind</a> ( rv, <a class="code" href="classbdm_1_1datalink__buffered.html#ada58df16761169992059b8cd91d070c5" title="h2v : indeces in history">h2v_hist</a>, <a class="code" href="classbdm_1_1datalink__buffered.html#aa1ce2032fe5c86fa87d80baccb9aacd7" title="h2v : indeces in down">h2v_down</a> ); |
| 527 | <a name="l00734"></a>00734 |
| 528 | <a name="l00735"></a>00735 <a class="code" href="classbdm_1_1datalink.html#abc8ff50395fc1066a1e486dea18d987c" title="Remember how long val should be.">downsize</a> = <a class="code" href="classbdm_1_1datalink__part.html#a64f64e7e6357419240bc2b1b0749c943" title="indeces of values in vector downsize">v2v_down</a>.length() + <a class="code" href="classbdm_1_1datalink__buffered.html#aa1ce2032fe5c86fa87d80baccb9aacd7" title="h2v : indeces in down">h2v_down</a>.length(); |
| 529 | <a name="l00736"></a>00736 <a class="code" href="classbdm_1_1datalink.html#a0f0d0af6848114d96108d3a6af25a045" title="Remember how long val of &quot;Up&quot; should be.">upsize</a> = <a class="code" href="classbdm_1_1datalink.html#a240b37d793c6bdc32824ed0a0541b1eb" title="val-to-val link, indices of the upper val">v2v_up</a>.length(); |
| 530 | <a name="l00737"></a>00737 } |
| 531 | <a name="l00738"></a>00738 }; |
| 532 | <a name="l00739"></a>00739 |
| 533 | <a name="l00741"></a><a class="code" href="classbdm_1_1datalink__2to1__buffered.html">00741</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__2to1__buffered.html" title="buffered datalink from 2 vectors to 1">datalink_2to1_buffered</a> { |
| 534 | <a name="l00742"></a>00742 <span class="keyword">protected</span>: |
| 535 | <a name="l00743"></a>00743 <a class="code" href="classbdm_1_1datalink__buffered.html" title="Datalink that buffers delayed values - do not forget to call step().">datalink_buffered</a> dl1; |
| 536 | <a name="l00744"></a>00744 <a class="code" href="classbdm_1_1datalink__buffered.html" title="Datalink that buffers delayed values - do not forget to call step().">datalink_buffered</a> dl2; |
| 537 | <a name="l00745"></a>00745 <span class="keyword">public</span>: |
| 538 | <a name="l00747"></a><a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aef1441b4885ae4d8e95b3ff28e575364">00747</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aef1441b4885ae4d8e95b3ff28e575364" title="set connection between RVs">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_up1, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up2 ) { |
| 539 | <a name="l00748"></a>00748 dl1.<a class="code" href="classbdm_1_1datalink__buffered.html#aadefa427312905425ebab8531da1846a" title="set connection, rv must be fully present in rv_up">set_connection</a> ( rv, rv_up1 ); |
| 540 | <a name="l00749"></a>00749 dl2.<a class="code" href="classbdm_1_1datalink__buffered.html#aadefa427312905425ebab8531da1846a" title="set connection, rv must be fully present in rv_up">set_connection</a> ( rv, rv_up2 ); |
| 541 | <a name="l00750"></a>00750 } |
| 542 | <a name="l00751"></a>00751 <span class="keywordtype">void</span> filldown ( <span class="keyword">const</span> vec &val1, <span class="keyword">const</span> vec &val2, vec &val_down ) { |
| 543 | <a name="l00752"></a>00752 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( val_down.length() >= dl1.<a class="code" href="classbdm_1_1datalink.html#a8f0cce4477e906f3090bb803e06d8698" title="access functions">_downsize</a>() + dl2.<a class="code" href="classbdm_1_1datalink.html#a8f0cce4477e906f3090bb803e06d8698" title="access functions">_downsize</a>(), <span class="stringliteral">"short val_down"</span> ); |
| 544 | <a name="l00753"></a>00753 dl1.<a class="code" href="classbdm_1_1datalink__buffered.html#a681745a319728a416486df38aacd579f" title="Get val for vector val_down from val of &quot;Up&quot;.">filldown</a> ( val1, val_down ); |
| 545 | <a name="l00754"></a>00754 dl2.<a class="code" href="classbdm_1_1datalink__buffered.html#a681745a319728a416486df38aacd579f" title="Get val for vector val_down from val of &quot;Up&quot;.">filldown</a> ( val2, val_down ); |
| 546 | <a name="l00755"></a>00755 } |
| 547 | <a name="l00756"></a>00756 <span class="keywordtype">void</span> step ( <span class="keyword">const</span> vec &dt, <span class="keyword">const</span> vec &ut ) { |
| 548 | <a name="l00757"></a>00757 dl1.step ( dt ); |
| 549 | <a name="l00758"></a>00758 dl2.step ( ut ); |
| 550 | <a name="l00759"></a>00759 } |
| 551 | <a name="l00760"></a>00760 }; |
| 552 | <a name="l00761"></a>00761 |
| 553 | <a name="l00762"></a>00762 |
| 554 | <a name="l00763"></a>00763 |
| 555 | <a name="l00765"></a><a class="code" href="classbdm_1_1datalink__m2e.html">00765</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__m2e.html" title="Data link with a condition.">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> { |
| 556 | <a name="l00766"></a>00766 <span class="keyword">protected</span>: |
| 557 | <a name="l00768"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9">00768</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>; |
| 558 | <a name="l00769"></a>00769 |
| 559 | <a name="l00771"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a43fe3e2d7aa04134053ec15793722783">00771</a> ivec <a class="code" href="classbdm_1_1datalink__m2e.html#a43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indices of the upper val">v2c_up</a>; |
| 560 | <a name="l00772"></a>00772 |
| 561 | <a name="l00774"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc">00774</a> ivec <a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, indices of the local cond">v2c_lo</a>; |
550 | | <a name="l00787"></a>00787 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a9a14c64d881e838ddc3a5617ee8a973b" title="Moves from to , i.e. perfroms the actions and reads response of the system.">step</a>() = 0; |
551 | | <a name="l00788"></a>00788 |
552 | | <a name="l00790"></a><a class="code" href="classbdm_1_1DS.html#a3c9e417d85052396fe74c164857ee67e">00790</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a3c9e417d85052396fe74c164857ee67e" 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) { |
553 | | <a name="l00791"></a>00791 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> (dtsize == <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>._dsize(), <span class="stringliteral">"invalid DS: dtsize different from Drv"</span>); |
554 | | <a name="l00792"></a>00792 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> (utsize == <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>._dsize(), <span class="stringliteral">"invalid DS: utsize different from Urv"</span>); |
555 | | <a name="l00793"></a>00793 |
556 | | <a name="l00794"></a>00794 <a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a> = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7">add</a> (<a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>, <span class="stringliteral">""</span>); |
557 | | <a name="l00795"></a>00795 L_ut = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7">add</a> (<a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>, <span class="stringliteral">""</span>); |
558 | | <a name="l00796"></a>00796 } |
559 | | <a name="l00798"></a><a class="code" href="classbdm_1_1DS.html#ae03d2c93cddd5c3a03107ddd3ae999cf">00798</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#ae03d2c93cddd5c3a03107ddd3ae999cf" 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) { |
560 | | <a name="l00799"></a>00799 vec tmp (<a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>._dsize() + <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>._dsize()); |
561 | | <a name="l00800"></a>00800 <a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> (tmp); |
562 | | <a name="l00801"></a>00801 <span class="comment">// d is first in getdata</span> |
563 | | <a name="l00802"></a>00802 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> (<a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>, tmp.left (<a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>._dsize())); |
564 | | <a name="l00803"></a>00803 <span class="comment">// u follows after d in getdata</span> |
565 | | <a name="l00804"></a>00804 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> (L_ut, tmp.mid (<a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>._dsize(), <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>._dsize())); |
566 | | <a name="l00805"></a>00805 } |
567 | | <a name="l00807"></a><a class="code" href="classbdm_1_1DS.html#aed2113851294ed96abe60fc3f05aa660">00807</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#aed2113851294ed96abe60fc3f05aa660" title="access function">_drv</a>()<span class="keyword"> const </span>{ |
568 | | <a name="l00808"></a>00808 <span class="keywordflow">return</span> concat (<a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>, <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>); |
569 | | <a name="l00809"></a>00809 } |
570 | | <a name="l00811"></a><a class="code" href="classbdm_1_1DS.html#aa6a9a375da64c82fc227bda3418a1f33">00811</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#aa6a9a375da64c82fc227bda3418a1f33" title="access function">_urv</a>()<span class="keyword"> const </span>{ |
571 | | <a name="l00812"></a>00812 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>; |
572 | | <a name="l00813"></a>00813 } |
573 | | <a name="l00815"></a><a class="code" href="classbdm_1_1DS.html#a821297dfd839d68691324f024e57252f">00815</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a821297dfd839d68691324f024e57252f" 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) { |
574 | | <a name="l00816"></a>00816 <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a> = drv; |
575 | | <a name="l00817"></a>00817 <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> = urv; |
576 | | <a name="l00818"></a>00818 } |
| 570 | <a name="l00787"></a>00787 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__m2e.html#ab29bc3c7bf2a1d87e77ccaa793d097d5" title="Copy corresponding values to Up.condition.">pushup_cond</a> ( vec &val_up, <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ); |
| 571 | <a name="l00788"></a>00788 }; |
| 572 | <a name="l00789"></a>00789 |
| 573 | <a name="l00792"></a><a class="code" href="classbdm_1_1datalink__m2m.html">00792</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__m2m.html" title="DataLink is a connection between mpdf and its superordinate (Up) This class links...">datalink_m2m</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1datalink__m2e.html" title="Data link with a condition.">datalink_m2e</a> { |
| 574 | <a name="l00793"></a>00793 <span class="keyword">protected</span>: |
| 575 | <a name="l00795"></a><a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d">00795</a> ivec <a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indices of the upper cond">c2c_up</a>; |
| 576 | <a name="l00797"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5">00797</a> ivec <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>; |
| 577 | <a name="l00798"></a>00798 |
| 578 | <a name="l00799"></a>00799 <span class="keyword">public</span>: |
| 579 | <a name="l00801"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a3baed32cb66f0e2f731032cec0a4d287">00801</a> <a class="code" href="classbdm_1_1datalink__m2m.html#a3baed32cb66f0e2f731032cec0a4d287" title="Constructor.">datalink_m2m</a>() {}; |
| 580 | <a name="l00803"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a0ed49a99e8a3be264b952558b6f515d4">00803</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__m2m.html#a0ed49a99e8a3be264b952558b6f515d4" title="Set connection between the vectors.">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, <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 ) { |
| 581 | <a name="l00804"></a>00804 <a class="code" href="classbdm_1_1datalink__m2m.html#a0ed49a99e8a3be264b952558b6f515d4" title="Set connection between the vectors.">datalink_m2e::set_connection</a> ( rv, rvc, rv_up ); |
| 582 | <a name="l00805"></a>00805 <span class="comment">//establish c2c connection</span> |
| 583 | <a name="l00806"></a>00806 rvc.<a class="code" href="classbdm_1_1RV.html#acbebdb5e0d30101a6eb63550ef701c55" title="when this rv is a part of bigger rv, this function returns indices of self in the...">dataind</a> ( rvc_up, <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>, <a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indices of the upper cond">c2c_up</a> ); |
| 584 | <a name="l00807"></a>00807 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>.length() + <a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, indices of the local cond">v2c_lo</a>.length() == <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>, <span class="stringliteral">"cond is not fully given"</span> ); |
| 585 | <a name="l00808"></a>00808 } |
| 586 | <a name="l00809"></a>00809 |
| 587 | <a name="l00811"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a911fb7fcfa80d4e31db8e0cc03141a90">00811</a> vec <a class="code" href="classbdm_1_1datalink__m2m.html#a911fb7fcfa80d4e31db8e0cc03141a90" 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 ) { |
| 588 | <a name="l00812"></a>00812 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
| 589 | <a name="l00813"></a>00813 set_subvector ( tmp, <a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, indices of the local cond">v2c_lo</a>, val_up ( <a class="code" href="classbdm_1_1datalink__m2e.html#a43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indices of the upper val">v2c_up</a> ) ); |
| 590 | <a name="l00814"></a>00814 set_subvector ( tmp, <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>, cond_up ( <a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indices of the upper cond">c2c_up</a> ) ); |
| 591 | <a name="l00815"></a>00815 <span class="keywordflow">return</span> tmp; |
| 592 | <a name="l00816"></a>00816 } |
| 593 | <a name="l00818"></a>00818 |
579 | | <a name="l00842"></a><a class="code" href="classbdm_1_1BM.html">00842</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_1root.html" title="Root class of BDM objects.">root</a> |
580 | | <a name="l00843"></a>00843 { |
581 | | <a name="l00844"></a>00844 <span class="keyword">protected</span>: |
582 | | <a name="l00846"></a><a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed">00846</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#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>; |
583 | | <a name="l00848"></a><a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a">00848</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
584 | | <a name="l00850"></a><a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee">00850</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>; |
585 | | <a name="l00851"></a>00851 <span class="keyword">public</span>: |
586 | | <a name="l00854"></a>00854 |
587 | | <a name="l00855"></a>00855 <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#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> (0), <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" 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#a109c1a626a69031658e3a44e9e500cca" 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#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> (4) { |
588 | | <a name="l00856"></a>00856 <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> = -1;<span class="comment">/*empty IDs*/</span> |
589 | | <a name="l00857"></a>00857 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> = 0; |
590 | | <a name="l00858"></a>00858 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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> |
591 | | <a name="l00859"></a>00859 }; |
592 | | <a name="l00860"></a>00860 <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#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> (B.<a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>), <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> (B.<a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>), <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" 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#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>) {} |
593 | | <a name="l00863"></a><a class="code" href="classbdm_1_1BM.html#a40f01563651c1e4fe926189e41a6b8ab">00863</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#a40f01563651c1e4fe926189e41a6b8ab">_copy_</a>()<span class="keyword"> const </span>{ |
594 | | <a name="l00864"></a>00864 <span class="keywordflow">return</span> NULL; |
595 | | <a name="l00865"></a>00865 }; |
| 596 | <a name="l00826"></a><a class="code" href="classbdm_1_1logger.html">00826</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_1root.html" title="Root class of BDM objects.">root</a> { |
| 597 | <a name="l00827"></a>00827 <span class="keyword">protected</span>: |
| 598 | <a name="l00829"></a><a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f">00829</a> Array<RV> <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>; |
| 599 | <a name="l00831"></a><a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02">00831</a> Array<string> <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>; |
| 600 | <a name="l00832"></a>00832 <span class="keyword">public</span>: |
| 601 | <a name="l00834"></a><a class="code" href="classbdm_1_1logger.html#af9c2fe7db5ddbda0098a4a5bd2c29fbf">00834</a> <a class="code" href="classbdm_1_1logger.html#af9c2fe7db5ddbda0098a4a5bd2c29fbf" title="Default constructor.">logger</a>() : <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( 0 ), <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a> ( 0 ) {} |
| 602 | <a name="l00835"></a>00835 |
| 603 | <a name="l00838"></a><a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7">00838</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</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="keywordtype">string</span> prefix = <span class="stringliteral">""</span> ) { |
| 604 | <a name="l00839"></a>00839 <span class="keywordtype">int</span> id; |
| 605 | <a name="l00840"></a>00840 <span class="keywordflow">if</span> ( rv.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() > 0 ) { |
| 606 | <a name="l00841"></a>00841 <span class="keywordtype">id</span> = <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.length(); |
| 607 | <a name="l00842"></a>00842 <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a> = concat ( <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>, prefix ); <span class="comment">// diff</span> |
| 608 | <a name="l00843"></a>00843 <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.set_length ( <span class="keywordtype">id</span> + 1, <span class="keyword">true</span> ); |
| 609 | <a name="l00844"></a>00844 <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( <span class="keywordtype">id</span> ) = rv; |
| 610 | <a name="l00845"></a>00845 } <span class="keywordflow">else</span> { |
| 611 | <a name="l00846"></a>00846 <span class="keywordtype">id</span> = -1; |
| 612 | <a name="l00847"></a>00847 } |
| 613 | <a name="l00848"></a>00848 <span class="keywordflow">return</span> id; <span class="comment">// identifier of the last entry</span> |
| 614 | <a name="l00849"></a>00849 } |
| 615 | <a name="l00850"></a>00850 |
| 616 | <a name="l00852"></a><a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309">00852</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> vec &v ) { |
| 617 | <a name="l00853"></a>00853 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 618 | <a name="l00854"></a>00854 }; |
| 619 | <a name="l00856"></a><a class="code" href="classbdm_1_1logger.html#aaa1d72cd3d2ff6bbf87340154af02ea6">00856</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#aaa1d72cd3d2ff6bbf87340154af02ea6" title="log this double">logit</a> ( <span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> <span class="keywordtype">double</span> &d ) { |
| 620 | <a name="l00857"></a>00857 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 621 | <a name="l00858"></a>00858 }; |
| 622 | <a name="l00859"></a>00859 |
| 623 | <a name="l00861"></a><a class="code" href="classbdm_1_1logger.html#af137e9a0c905357c5c3fbb16eac34a99">00861</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#af137e9a0c905357c5c3fbb16eac34a99" title="Shifts storage position for another time step.">step</a>() { |
| 624 | <a name="l00862"></a>00862 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemneted"</span> ); |
| 625 | <a name="l00863"></a>00863 }; |
| 626 | <a name="l00864"></a>00864 |
| 627 | <a name="l00866"></a><a class="code" href="classbdm_1_1logger.html#a0e3fc7d13e23a8f71fc7c8a5ea68559d">00866</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#a0e3fc7d13e23a8f71fc7c8a5ea68559d" title="Finalize storing information.">finalize</a>() {}; |
598 | | <a name="l00874"></a>00874 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a60b1779a577367c369a932cabd3a6188" title="Incremental Bayes rule.">bayes</a> (<span class="keyword">const</span> vec &dt) = 0; |
599 | | <a name="l00876"></a>00876 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a1dee3fddaf021e62d925289660a707dc" title="Batch Bayes rule (columns of Dt are observations).">bayesB</a> (<span class="keyword">const</span> mat &Dt); |
600 | | <a name="l00879"></a><a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">00879</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> (<span class="keyword">const</span> vec &dt)<span class="keyword"> const </span>{ |
601 | | <a name="l00880"></a>00880 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"Not implemented"</span>); |
602 | | <a name="l00881"></a>00881 <span class="keywordflow">return</span> 0.0; |
603 | | <a name="l00882"></a>00882 } |
604 | | <a name="l00883"></a>00883 |
605 | | <a name="l00885"></a><a class="code" href="classbdm_1_1BM.html#a0e8ebe61fb14990abe1254bd3dda5fae">00885</a> vec <a class="code" href="classbdm_1_1BM.html#a0e8ebe61fb14990abe1254bd3dda5fae" title="Matrix version of logpred.">logpred_m</a> (<span class="keyword">const</span> mat &dt)<span class="keyword"> const </span>{ |
606 | | <a name="l00886"></a>00886 vec tmp (dt.cols()); |
607 | | <a name="l00887"></a>00887 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < dt.cols(); i++) { |
608 | | <a name="l00888"></a>00888 tmp (i) = <a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> (dt.get_col (i)); |
609 | | <a name="l00889"></a>00889 } |
610 | | <a name="l00890"></a>00890 <span class="keywordflow">return</span> tmp; |
611 | | <a name="l00891"></a>00891 } |
612 | | <a name="l00892"></a>00892 |
613 | | <a name="l00894"></a><a class="code" href="classbdm_1_1BM.html#a688d7a2aced1e06aa1c468d73a9e5eba">00894</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#a688d7a2aced1e06aa1c468d73a9e5eba" title="Constructs a predictive density .">epredictor</a>()<span class="keyword"> const </span>{ |
614 | | <a name="l00895"></a>00895 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"Not implemented"</span>); |
615 | | <a name="l00896"></a>00896 <span class="keywordflow">return</span> NULL; |
616 | | <a name="l00897"></a>00897 }; |
617 | | <a name="l00899"></a><a class="code" href="classbdm_1_1BM.html#a598b25e3f3d96a5bc00a5faeb5b3c912">00899</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a>* <a class="code" href="classbdm_1_1BM.html#a598b25e3f3d96a5bc00a5faeb5b3c912" title="Constructs conditional density of 1-step ahead predictor .">predictor</a>()<span class="keyword"> const </span>{ |
618 | | <a name="l00900"></a>00900 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"Not implemented"</span>); |
619 | | <a name="l00901"></a>00901 <span class="keywordflow">return</span> NULL; |
620 | | <a name="l00902"></a>00902 }; |
621 | | <a name="l00904"></a>00904 |
622 | | <a name="l00909"></a>00909 |
623 | | <a name="l00911"></a><a class="code" href="classbdm_1_1BM.html#ade95c590d650b2db423d53992f0906cb">00911</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#ade95c590d650b2db423d53992f0906cb" title="Name of extension variable.">rvc</a>; |
624 | | <a name="l00913"></a><a class="code" href="classbdm_1_1BM.html#ab5e8e016be16e4029c789063cb3f3b33">00913</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#ab5e8e016be16e4029c789063cb3f3b33" title="access function">_rvc</a>()<span class="keyword"> const </span>{ |
625 | | <a name="l00914"></a>00914 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#ade95c590d650b2db423d53992f0906cb" title="Name of extension variable.">rvc</a>; |
626 | | <a name="l00915"></a>00915 } |
627 | | <a name="l00916"></a>00916 |
628 | | <a name="l00918"></a><a class="code" href="classbdm_1_1BM.html#a6799f4b16a6a59ed58b1d0d6e17116f4">00918</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a6799f4b16a6a59ed58b1d0d6e17116f4" title="Substitute val for rvc.">condition</a> (<span class="keyword">const</span> vec &val) { |
629 | | <a name="l00919"></a>00919 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> (<span class="stringliteral">"Not implemented!"</span>); |
630 | | <a name="l00920"></a>00920 } |
631 | | <a name="l00921"></a>00921 |
632 | | <a name="l00923"></a>00923 |
633 | | <a name="l00924"></a>00924 |
634 | | <a name="l00927"></a>00927 |
635 | | <a name="l00928"></a>00928 <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>{ |
636 | | <a name="l00929"></a>00929 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>; |
637 | | <a name="l00930"></a>00930 } |
638 | | <a name="l00931"></a>00931 <span class="keywordtype">void</span> set_drv (<span class="keyword">const</span> RV &rv) { |
639 | | <a name="l00932"></a>00932 <a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> = rv; |
640 | | <a name="l00933"></a>00933 } |
641 | | <a name="l00934"></a>00934 <span class="keywordtype">void</span> set_rv (<span class="keyword">const</span> RV &rv) { |
642 | | <a name="l00935"></a>00935 <span class="keyword">const_cast<</span>epdf&<span class="keyword">></span> (posterior()).set_rv (rv); |
643 | | <a name="l00936"></a>00936 } |
644 | | <a name="l00937"></a>00937 <span class="keywordtype">double</span> _ll()<span class="keyword"> const </span>{ |
645 | | <a name="l00938"></a>00938 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
646 | | <a name="l00939"></a>00939 } |
647 | | <a name="l00940"></a>00940 <span class="keywordtype">void</span> set_evalll (<span class="keywordtype">bool</span> evl0) { |
648 | | <a name="l00941"></a>00941 <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> = evl0; |
649 | | <a name="l00942"></a>00942 } |
650 | | <a name="l00943"></a>00943 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf& posterior() <span class="keyword">const</span> = 0; |
651 | | <a name="l00945"></a>00945 |
652 | | <a name="l00948"></a>00948 |
653 | | <a name="l00950"></a><a class="code" href="classbdm_1_1BM.html#aadb539fa2585c8a2a91c54e5aebf330e">00950</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#aadb539fa2585c8a2a91c54e5aebf330e" 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) { |
654 | | <a name="l00951"></a>00951 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> (0) = 1; |
655 | | <a name="l00952"></a>00952 <span class="keywordflow">if</span> (opt.find (<span class="stringliteral">"logbounds"</span>) != string::npos) { |
656 | | <a name="l00953"></a>00953 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> (1) = 1; |
657 | | <a name="l00954"></a>00954 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> (2) = 1; |
658 | | <a name="l00955"></a>00955 } |
659 | | <a name="l00956"></a>00956 <span class="keywordflow">if</span> (opt.find (<span class="stringliteral">"logll"</span>) != string::npos) { |
660 | | <a name="l00957"></a>00957 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> (3) = 1; |
661 | | <a name="l00958"></a>00958 } |
662 | | <a name="l00959"></a>00959 } |
663 | | <a name="l00961"></a><a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca">00961</a> ivec <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a>; |
664 | | <a name="l00962"></a>00962 |
665 | | <a name="l00964"></a><a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207">00964</a> ivec <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>; |
666 | | <a name="l00966"></a><a class="code" href="classbdm_1_1BM.html#a2298ca6af9b13a78a4c9e18ab43f1827">00966</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a2298ca6af9b13a78a4c9e18ab43f1827" 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>) { |
667 | | <a name="l00967"></a>00967 <span class="comment">// internal</span> |
668 | | <a name="l00968"></a>00968 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> r; |
669 | | <a name="l00969"></a>00969 <span class="keywordflow">if</span> (posterior().isnamed()) { |
670 | | <a name="l00970"></a>00970 r = posterior().<a class="code" href="classbdm_1_1epdf.html#aa4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>(); |
671 | | <a name="l00971"></a>00971 } <span class="keywordflow">else</span> { |
672 | | <a name="l00972"></a>00972 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()); |
673 | | <a name="l00973"></a>00973 }; |
| 631 | <a name="l00871"></a>00871 }; |
| 632 | <a name="l00872"></a>00872 |
| 633 | <a name="l00876"></a><a class="code" href="classbdm_1_1mepdf.html">00876</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 , where is random variable, rv, and...">mpdf</a> { |
| 634 | <a name="l00878"></a>00878 <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<epdf></a> iepdf; |
| 635 | <a name="l00879"></a>00879 <span class="keyword">public</span>: |
| 636 | <a name="l00881"></a><a class="code" href="classbdm_1_1mepdf.html#a4a2b01e7bb510c6b8946757cae6c9155">00881</a> <a class="code" href="classbdm_1_1mepdf.html#a4a2b01e7bb510c6b8946757cae6c9155" title="Default constructor.">mepdf</a>() { } |
| 637 | <a name="l00883"></a><a class="code" href="classbdm_1_1mepdf.html#a1f94e70702ff676f53d95ca7ec38e25c">00883</a> <a class="code" href="classbdm_1_1mepdf.html#a1f94e70702ff676f53d95ca7ec38e25c" title="Set internal shared pointer.">mepdf</a> ( <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<epdf></a> em ) { |
| 638 | <a name="l00884"></a>00884 iepdf = em; |
| 639 | <a name="l00885"></a>00885 <a class="code" href="classbdm_1_1mpdf.html#a147afacb393324bb3f9a7a89e33f835e" title="set internal pointer ep to point to given iepdf ">set_ep</a> ( *iepdf.<a class="code" href="classbdm_1_1shared__ptr.html#a37ebcfb6750dd7b5630f1d2354c07a96">get</a>() ); |
| 640 | <a name="l00886"></a>00886 <a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> = 0; |
| 641 | <a name="l00887"></a>00887 } |
| 642 | <a name="l00888"></a>00888 |
| 643 | <a name="l00890"></a><a class="code" href="classbdm_1_1mepdf.html#ab904a90ef78294040b498717cc13015e">00890</a> vec <a class="code" href="classbdm_1_1mepdf.html#ab904a90ef78294040b498717cc13015e" title="empty">samplecond</a> ( <span class="keyword">const</span> vec &cond ) { |
| 644 | <a name="l00891"></a>00891 <span class="keywordflow">return</span> iepdf->sample(); |
| 645 | <a name="l00892"></a>00892 } |
| 646 | <a name="l00893"></a><a class="code" href="classbdm_1_1mepdf.html#a57decd7718f3789e9d1f10f19def935b">00893</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mepdf.html#a57decd7718f3789e9d1f10f19def935b" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a> ( <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ) { |
| 647 | <a name="l00894"></a>00894 <span class="keywordflow">return</span> iepdf->evallog ( val ); |
| 648 | <a name="l00895"></a>00895 } |
| 649 | <a name="l00896"></a>00896 |
| 650 | <a name="l00904"></a>00904 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mepdf.html#a27ef18a3e3b1b5de02739d1324bf25fb" title="Load from structure with elements:.">from_setting</a> ( <span class="keyword">const</span> Setting &<span class="keyword">set</span> ); |
| 651 | <a name="l00905"></a>00905 }; |
| 652 | <a name="l00906"></a>00906 <a class="code" href="user__info_8h.html#a4f9de2f17e844047726487b99def99c6" title="Macro for registration of class into map of user-infos, registered class is scriptable...">UIREGISTER</a> ( mepdf ); |
| 653 | <a name="l00907"></a>00907 SHAREDPTR ( mepdf ); |
| 654 | <a name="l00908"></a>00908 |
| 655 | <a name="l00910"></a>00910 RV get_composite_rv ( <span class="keyword">const</span> Array<shared_ptr<mpdf> > &mpdfs, <span class="keywordtype">bool</span> checkoverlap = <span class="keyword">false</span> ); |
| 656 | <a name="l00911"></a>00911 |
| 657 | <a name="l00927"></a><a class="code" href="classbdm_1_1DS.html">00927</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_1root.html" title="Root class of BDM objects.">root</a> { |
| 658 | <a name="l00928"></a>00928 <span class="keyword">protected</span>: |
| 659 | <a name="l00930"></a><a class="code" href="classbdm_1_1DS.html#af96cae44624e79638a91ec4f2c7c81a9">00930</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#af96cae44624e79638a91ec4f2c7c81a9" title="size of data returned by getdata() ">dtsize</a>; |
| 660 | <a name="l00932"></a><a class="code" href="classbdm_1_1DS.html#ad7467046a0bd05bc992cc5e1bdedb983">00932</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#ad7467046a0bd05bc992cc5e1bdedb983" title="size of data">utsize</a>; |
| 661 | <a name="l00934"></a><a class="code" href="classbdm_1_1DS.html#a22a4b29aa6e9f3bf17bcc4b28567e8bd">00934</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#a22a4b29aa6e9f3bf17bcc4b28567e8bd" title="size of output">ytsize</a>; |
| 662 | <a name="l00936"></a><a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec">00936</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#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>; |
| 663 | <a name="l00938"></a><a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702">00938</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#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>; <span class="comment">//</span> |
| 664 | <a name="l00940"></a><a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995">00940</a> <span class="comment"></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#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a>; <span class="comment">//</span> |
| 665 | <a name="l00942"></a><a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867">00942</a> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>, L_ut; |
| 666 | <a name="l00943"></a>00943 <span class="keyword">public</span>: |
| 667 | <a name="l00945"></a><a class="code" href="classbdm_1_1DS.html#abedd82e08ae6686b4b1732a122c2201a">00945</a> <a class="code" href="classbdm_1_1DS.html#abedd82e08ae6686b4b1732a122c2201a" title="default constructors">DS</a>() : <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>(), <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>(),<a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a>() {}; |
| 668 | <a name="l00946"></a>00946 |
| 669 | <a name="l00948"></a><a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba">00948</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( vec &dt ) { |
| 670 | <a name="l00949"></a>00949 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"abstract class"</span> ); |
| 671 | <a name="l00950"></a>00950 } |
| 672 | <a name="l00951"></a>00951 |
| 673 | <a name="l00953"></a><a class="code" href="classbdm_1_1DS.html#aa0bf451c7fea73ff4150ff9e83da4832">00953</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#aa0bf451c7fea73ff4150ff9e83da4832" title="Returns data records at indeces.">getdata</a> ( vec &dt, <span class="keyword">const</span> ivec &indeces ) { |
| 674 | <a name="l00954"></a>00954 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"abstract class"</span> ); |
| 675 | <a name="l00955"></a>00955 } |
| 676 | <a name="l00956"></a>00956 |
| 677 | <a name="l00958"></a><a class="code" href="classbdm_1_1DS.html#af5baeee8528e5e4c5c7a344b2e3f192a">00958</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#af5baeee8528e5e4c5c7a344b2e3f192a" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut ) { |
| 678 | <a name="l00959"></a>00959 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"abstract class"</span> ); |
| 679 | <a name="l00960"></a>00960 } |
| 680 | <a name="l00961"></a>00961 |
| 681 | <a name="l00963"></a><a class="code" href="classbdm_1_1DS.html#a6bced13f84f6bf04449728817e049e1d">00963</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a6bced13f84f6bf04449728817e049e1d" title="Accepts action variables at specific indeces.">write</a> ( vec &ut, <span class="keyword">const</span> ivec &indeces ) { |
| 682 | <a name="l00964"></a>00964 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"abstract class"</span> ); |
| 683 | <a name="l00965"></a>00965 } |
| 684 | <a name="l00966"></a>00966 |
| 685 | <a name="l00968"></a>00968 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a9a14c64d881e838ddc3a5617ee8a973b" title="Moves from to , i.e. perfroms the actions and reads response of the system.">step</a>() = 0; |
| 686 | <a name="l00969"></a>00969 |
| 687 | <a name="l00971"></a><a class="code" href="classbdm_1_1DS.html#a3c9e417d85052396fe74c164857ee67e">00971</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a3c9e417d85052396fe74c164857ee67e" 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 ) { |
| 688 | <a name="l00972"></a>00972 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( <a class="code" href="classbdm_1_1DS.html#af96cae44624e79638a91ec4f2c7c81a9" title="size of data returned by getdata() ">dtsize</a> == <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>(), <span class="stringliteral">"invalid DS: dtsize ("</span> + num2str ( <a class="code" href="classbdm_1_1DS.html#af96cae44624e79638a91ec4f2c7c81a9" title="size of data returned by getdata() ">dtsize</a> ) + <span class="stringliteral">") different from Drv "</span> + num2str ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ) ); |
| 689 | <a name="l00973"></a>00973 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( <a class="code" href="classbdm_1_1DS.html#ad7467046a0bd05bc992cc5e1bdedb983" title="size of data">utsize</a> == <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>(), <span class="stringliteral">"invalid DS: utsize ("</span> + num2str ( <a class="code" href="classbdm_1_1DS.html#ad7467046a0bd05bc992cc5e1bdedb983" title="size of data">utsize</a> ) + <span class="stringliteral">") different from Urv "</span> + num2str ( <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ) ); |
675 | | <a name="l00975"></a>00975 <span class="comment">// Add mean value</span> |
676 | | <a name="l00976"></a>00976 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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#a109c1a626a69031658e3a44e9e500cca" 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#a47aa3b098a81d02a8ffaea2c9fa09ac7">add</a> (r, name + <span class="stringliteral">"mean_"</span>); |
677 | | <a name="l00977"></a>00977 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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#a109c1a626a69031658e3a44e9e500cca" 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#a47aa3b098a81d02a8ffaea2c9fa09ac7">add</a> (r, name + <span class="stringliteral">"lb_"</span>); |
678 | | <a name="l00978"></a>00978 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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#a109c1a626a69031658e3a44e9e500cca" 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#a47aa3b098a81d02a8ffaea2c9fa09ac7">add</a> (r, name + <span class="stringliteral">"ub_"</span>); |
679 | | <a name="l00979"></a>00979 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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#a109c1a626a69031658e3a44e9e500cca" 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#a47aa3b098a81d02a8ffaea2c9fa09ac7">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> |
680 | | <a name="l00980"></a>00980 } |
681 | | <a name="l00981"></a>00981 <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) { |
682 | | <a name="l00982"></a>00982 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> (<a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> (0), posterior().mean()); |
683 | | <a name="l00983"></a>00983 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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#a398b7e7a162cf37d0022d6126495f207" 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> |
684 | | <a name="l00984"></a>00984 vec ub, lb; |
685 | | <a name="l00985"></a>00985 posterior().<a class="code" href="classbdm_1_1epdf.html#a0a7705e80601957f7226d333a0a6d539" title="Lower and upper bounds of percentage % quantile, returns mean-2*sigma as default...">qbounds</a> (lb, ub); |
686 | | <a name="l00986"></a>00986 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> (<a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> (1), lb); |
687 | | <a name="l00987"></a>00987 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> (<a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> (2), ub); |
688 | | <a name="l00988"></a>00988 } |
689 | | <a name="l00989"></a>00989 <span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> (<a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" 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#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>); |
690 | | <a name="l00990"></a>00990 } |
691 | | <a name="l00992"></a><a class="code" href="classbdm_1_1BM.html#a23c6a8f71f922023ab08dcb0487a86de">00992</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a23c6a8f71f922023ab08dcb0487a86de" title="This method arrange instance properties according the data stored in the Setting...">from_setting</a> (<span class="keyword">const</span> Setting &<span class="keyword">set</span>){ |
692 | | <a name="l00993"></a>00993 <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr<RV></a> r = UI::build<RV> ( <span class="keyword">set</span>, <span class="stringliteral">"drv"</span>, UI::optional ); |
693 | | <a name="l00994"></a>00994 <span class="keywordflow">if</span> (r) { |
694 | | <a name="l00995"></a>00995 set_drv (*r); |
695 | | <a name="l00996"></a>00996 } |
696 | | <a name="l00997"></a>00997 <span class="keywordtype">string</span> opt; |
697 | | <a name="l00998"></a>00998 <span class="keywordflow">if</span>(!<a class="code" href="classbdm_1_1UI.html#acd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a>(opt, <span class="keyword">set</span>, <span class="stringliteral">"options"</span>, UI::optional)) { |
698 | | <a name="l00999"></a>00999 <a class="code" href="classbdm_1_1BM.html#aadb539fa2585c8a2a91c54e5aebf330e" title="Set boolean options from a string, recognized are: &quot;logbounds,logll&quot;.">set_options</a>(opt); |
699 | | <a name="l01000"></a>01000 } |
700 | | <a name="l01001"></a>01001 } |
701 | | <a name="l01002"></a>01002 |
702 | | <a name="l01003"></a>01003 }; |
703 | | <a name="l01004"></a>01004 |
704 | | <a name="l01005"></a>01005 <span class="keyword">typedef</span> Array<shared_ptr<epdf> > epdf_array; |
705 | | <a name="l01006"></a>01006 |
706 | | <a name="l01007"></a>01007 <span class="keyword">typedef</span> Array<shared_ptr<mpdf> > mpdf_array; |
707 | | <a name="l01008"></a>01008 |
708 | | <a name="l01009"></a>01009 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
709 | | <a name="l01010"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ad8e547695d1cc19219b91164d825c930">01010</a> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ad8e547695d1cc19219b91164d825c930" title="Reimplements samplecond using condition().">mpdf_internal<EPDF>::samplecond</a> (<span class="keyword">const</span> vec &cond) |
710 | | <a name="l01011"></a>01011 { |
711 | | <a name="l01012"></a>01012 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">condition</a> (cond); |
712 | | <a name="l01013"></a>01013 vec temp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.sample(); |
713 | | <a name="l01014"></a>01014 <span class="keywordflow">return</span> temp; |
714 | | <a name="l01015"></a>01015 } |
715 | | <a name="l01016"></a>01016 |
716 | | <a name="l01017"></a>01017 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
717 | | <a name="l01018"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a9554c554054da2d22cb8e908ae9c8823">01018</a> mat <a class="code" href="classbdm_1_1mpdf__internal.html#a9554c554054da2d22cb8e908ae9c8823" title="Efficient version of samplecond.">mpdf_internal<EPDF>::samplecond_m</a> (<span class="keyword">const</span> vec &cond, <span class="keywordtype">int</span> N) |
718 | | <a name="l01019"></a>01019 { |
719 | | <a name="l01020"></a>01020 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">condition</a> (cond); |
720 | | <a name="l01021"></a>01021 mat temp (dimension(), N); |
721 | | <a name="l01022"></a>01022 vec smp (dimension()); |
722 | | <a name="l01023"></a>01023 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < N; i++) { |
723 | | <a name="l01024"></a>01024 smp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.sample(); |
724 | | <a name="l01025"></a>01025 temp.set_col (i, smp); |
725 | | <a name="l01026"></a>01026 } |
726 | | <a name="l01027"></a>01027 |
727 | | <a name="l01028"></a>01028 <span class="keywordflow">return</span> temp; |
728 | | <a name="l01029"></a>01029 } |
729 | | <a name="l01030"></a>01030 |
730 | | <a name="l01031"></a>01031 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
731 | | <a name="l01032"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a89076e62b8d7df7616bad68c94591948">01032</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a89076e62b8d7df7616bad68c94591948" title="Reimplements evallogcond using condition().">mpdf_internal<EPDF>::evallogcond</a> (<span class="keyword">const</span> vec &dt, <span class="keyword">const</span> vec &cond) |
732 | | <a name="l01033"></a>01033 { |
733 | | <a name="l01034"></a>01034 <span class="keywordtype">double</span> tmp; |
734 | | <a name="l01035"></a>01035 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">condition</a> (cond); |
735 | | <a name="l01036"></a>01036 tmp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog (dt); |
736 | | <a name="l01037"></a>01037 <span class="keywordflow">return</span> tmp; |
737 | | <a name="l01038"></a>01038 } |
738 | | <a name="l01039"></a>01039 |
739 | | <a name="l01040"></a>01040 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
740 | | <a name="l01041"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c">01041</a> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c" title="Efficient version of evallogcond for matrices.">mpdf_internal<EPDF>::evallogcond_m</a> (<span class="keyword">const</span> mat &Dt, <span class="keyword">const</span> vec &cond) |
741 | | <a name="l01042"></a>01042 { |
742 | | <a name="l01043"></a>01043 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">condition</a> (cond); |
743 | | <a name="l01044"></a>01044 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog_m (Dt); |
744 | | <a name="l01045"></a>01045 } |
745 | | <a name="l01046"></a>01046 |
746 | | <a name="l01047"></a>01047 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
747 | | <a name="l01048"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae82db07ce8af02f29cfd81e014edb3db">01048</a> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c" title="Efficient version of evallogcond for matrices.">mpdf_internal<EPDF>::evallogcond_m</a> (<span class="keyword">const</span> Array<vec> &Dt, <span class="keyword">const</span> vec &cond) |
748 | | <a name="l01049"></a>01049 { |
749 | | <a name="l01050"></a>01050 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">condition</a> (cond); |
750 | | <a name="l01051"></a>01051 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog_m (Dt); |
751 | | <a name="l01052"></a>01052 } |
| 691 | <a name="l00975"></a>00975 <a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a> = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>, <span class="stringliteral">""</span> ); |
| 692 | <a name="l00976"></a>00976 L_ut = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>, <span class="stringliteral">""</span> ); |
| 693 | <a name="l00977"></a>00977 } |
| 694 | <a name="l00979"></a><a class="code" href="classbdm_1_1DS.html#ae03d2c93cddd5c3a03107ddd3ae999cf">00979</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#ae03d2c93cddd5c3a03107ddd3ae999cf" 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 ) { |
| 695 | <a name="l00980"></a>00980 vec tmp ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() + <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ); |
| 696 | <a name="l00981"></a>00981 <a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( tmp ); |
| 697 | <a name="l00982"></a>00982 <span class="comment">// d is first in getdata</span> |
| 698 | <a name="l00983"></a>00983 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>, tmp.left ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ) ); |
| 699 | <a name="l00984"></a>00984 <span class="comment">// u follows after d in getdata</span> |
| 700 | <a name="l00985"></a>00985 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( L_ut, tmp.mid ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>(), <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ) ); |
| 701 | <a name="l00986"></a>00986 } |
| 702 | <a name="l00988"></a><a class="code" href="classbdm_1_1DS.html#a069497b610296be053d862a2493be0ce">00988</a> <span class="keyword">virtual</span> <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#a069497b610296be053d862a2493be0ce" title="access function">_drv</a>()<span class="keyword"> const </span>{ |
| 703 | <a name="l00989"></a>00989 <span class="comment">// return concat (Drv, Urv);// why!!!</span> |
| 704 | <a name="l00990"></a>00990 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>;<span class="comment">// why!!!</span> |
| 705 | <a name="l00991"></a>00991 } |
| 706 | <a name="l00993"></a><a class="code" href="classbdm_1_1DS.html#aa6a9a375da64c82fc227bda3418a1f33">00993</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#aa6a9a375da64c82fc227bda3418a1f33" title="access function">_urv</a>()<span class="keyword"> const </span>{ |
| 707 | <a name="l00994"></a>00994 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>; |
| 708 | <a name="l00995"></a>00995 } |
| 709 | <a name="l00997"></a><a class="code" href="classbdm_1_1DS.html#ac09878f86907329ac631a3df8755c558">00997</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#ac09878f86907329ac631a3df8755c558" title="access function">_yrv</a>()<span class="keyword"> const </span>{ |
| 710 | <a name="l00998"></a>00998 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a>; |
| 711 | <a name="l00999"></a>00999 } |
| 712 | <a name="l01001"></a><a class="code" href="classbdm_1_1DS.html#a3a92d77fd97fdb6bf1c8edb1e38c6bbc">01001</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a3a92d77fd97fdb6bf1c8edb1e38c6bbc" title="set random variables">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> &yrv, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &urv) { |
| 713 | <a name="l01002"></a>01002 <a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a> = yrv; |
| 714 | <a name="l01003"></a>01003 <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a> = concat(yrv,urv); |
| 715 | <a name="l01004"></a>01004 <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> = urv; |
| 716 | <a name="l01005"></a>01005 } |
| 717 | <a name="l01006"></a>01006 }; |
| 718 | <a name="l01007"></a>01007 |
| 719 | <a name="l01029"></a><a class="code" href="classbdm_1_1BM.html">01029</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_1root.html" title="Root class of BDM objects.">root</a> { |
| 720 | <a name="l01030"></a>01030 <span class="keyword">protected</span>: |
| 721 | <a name="l01032"></a><a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed">01032</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#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>; |
| 722 | <a name="l01034"></a><a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a">01034</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
| 723 | <a name="l01036"></a><a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee">01036</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>; |
| 724 | <a name="l01037"></a>01037 <span class="keyword">public</span>: |
| 725 | <a name="l01040"></a>01040 |
| 726 | <a name="l01041"></a>01041 <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#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( 0 ), <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" 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#a109c1a626a69031658e3a44e9e500cca" 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#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 4 ) { |
| 727 | <a name="l01042"></a>01042 <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> = -1;<span class="comment">/*empty IDs*/</span> |
| 728 | <a name="l01043"></a>01043 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> = 0; |
| 729 | <a name="l01044"></a>01044 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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> |
| 730 | <a name="l01045"></a>01045 }; |
| 731 | <a name="l01046"></a>01046 <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#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ( B.<a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ), <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( B.<a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ), <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" 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#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {} |
| 732 | <a name="l01049"></a><a class="code" href="classbdm_1_1BM.html#a40f01563651c1e4fe926189e41a6b8ab">01049</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#a40f01563651c1e4fe926189e41a6b8ab">_copy_</a>()<span class="keyword"> const </span>{ |
| 733 | <a name="l01050"></a>01050 <span class="keywordflow">return</span> NULL; |
| 734 | <a name="l01051"></a>01051 }; |
753 | | <a name="l01054"></a>01054 }; <span class="comment">//namespace</span> |
754 | | <a name="l01055"></a>01055 <span class="preprocessor">#endif // BDMBASE_H</span> |
| 736 | <a name="l01056"></a>01056 |
| 737 | <a name="l01060"></a>01060 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a60b1779a577367c369a932cabd3a6188" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &dt ) = 0; |
| 738 | <a name="l01062"></a>01062 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a1dee3fddaf021e62d925289660a707dc" title="Batch Bayes rule (columns of Dt are observations).">bayesB</a> ( <span class="keyword">const</span> mat &Dt ); |
| 739 | <a name="l01065"></a><a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">01065</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( <span class="keyword">const</span> vec &dt )<span class="keyword"> const </span>{ |
| 740 | <a name="l01066"></a>01066 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 741 | <a name="l01067"></a>01067 <span class="keywordflow">return</span> 0.0; |
| 742 | <a name="l01068"></a>01068 } |
| 743 | <a name="l01069"></a>01069 |
| 744 | <a name="l01071"></a><a class="code" href="classbdm_1_1BM.html#a0e8ebe61fb14990abe1254bd3dda5fae">01071</a> vec <a class="code" href="classbdm_1_1BM.html#a0e8ebe61fb14990abe1254bd3dda5fae" title="Matrix version of logpred.">logpred_m</a> ( <span class="keyword">const</span> mat &dt )<span class="keyword"> const </span>{ |
| 745 | <a name="l01072"></a>01072 vec tmp ( dt.cols() ); |
| 746 | <a name="l01073"></a>01073 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < dt.cols(); i++ ) { |
| 747 | <a name="l01074"></a>01074 tmp ( i ) = <a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( dt.get_col ( i ) ); |
| 748 | <a name="l01075"></a>01075 } |
| 749 | <a name="l01076"></a>01076 <span class="keywordflow">return</span> tmp; |
| 750 | <a name="l01077"></a>01077 } |
| 751 | <a name="l01078"></a>01078 |
| 752 | <a name="l01080"></a><a class="code" href="classbdm_1_1BM.html#a688d7a2aced1e06aa1c468d73a9e5eba">01080</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#a688d7a2aced1e06aa1c468d73a9e5eba" title="Constructs a predictive density .">epredictor</a>()<span class="keyword"> const </span>{ |
| 753 | <a name="l01081"></a>01081 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 754 | <a name="l01082"></a>01082 <span class="keywordflow">return</span> NULL; |
| 755 | <a name="l01083"></a>01083 }; |
| 756 | <a name="l01085"></a><a class="code" href="classbdm_1_1BM.html#a598b25e3f3d96a5bc00a5faeb5b3c912">01085</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a>* <a class="code" href="classbdm_1_1BM.html#a598b25e3f3d96a5bc00a5faeb5b3c912" title="Constructs conditional density of 1-step ahead predictor .">predictor</a>()<span class="keyword"> const </span>{ |
| 757 | <a name="l01086"></a>01086 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 758 | <a name="l01087"></a>01087 <span class="keywordflow">return</span> NULL; |
| 759 | <a name="l01088"></a>01088 }; |
| 760 | <a name="l01090"></a>01090 |
| 761 | <a name="l01095"></a>01095 |
| 762 | <a name="l01097"></a><a class="code" href="classbdm_1_1BM.html#ade95c590d650b2db423d53992f0906cb">01097</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#ade95c590d650b2db423d53992f0906cb" title="Name of extension variable.">rvc</a>; |
| 763 | <a name="l01099"></a><a class="code" href="classbdm_1_1BM.html#ab5e8e016be16e4029c789063cb3f3b33">01099</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#ab5e8e016be16e4029c789063cb3f3b33" title="access function">_rvc</a>()<span class="keyword"> const </span>{ |
| 764 | <a name="l01100"></a>01100 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#ade95c590d650b2db423d53992f0906cb" title="Name of extension variable.">rvc</a>; |
| 765 | <a name="l01101"></a>01101 } |
| 766 | <a name="l01102"></a>01102 |
| 767 | <a name="l01104"></a><a class="code" href="classbdm_1_1BM.html#a6799f4b16a6a59ed58b1d0d6e17116f4">01104</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a6799f4b16a6a59ed58b1d0d6e17116f4" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &val ) { |
| 768 | <a name="l01105"></a>01105 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented!"</span> ); |
| 769 | <a name="l01106"></a>01106 } |
| 770 | <a name="l01107"></a>01107 |
| 771 | <a name="l01109"></a>01109 |
| 772 | <a name="l01110"></a>01110 |
| 773 | <a name="l01113"></a>01113 |
| 774 | <a name="l01114"></a>01114 <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>{ |
| 775 | <a name="l01115"></a>01115 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>; |
| 776 | <a name="l01116"></a>01116 } |
| 777 | <a name="l01117"></a>01117 <span class="keywordtype">void</span> set_drv ( <span class="keyword">const</span> RV &rv ) { |
| 778 | <a name="l01118"></a>01118 <a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> = rv; |
| 779 | <a name="l01119"></a>01119 } |
| 780 | <a name="l01120"></a>01120 <span class="keywordtype">void</span> set_rv ( <span class="keyword">const</span> RV &rv ) { |
| 781 | <a name="l01121"></a>01121 <span class="keyword">const_cast<</span>epdf&<span class="keyword">></span> ( posterior() ).set_rv ( rv ); |
| 782 | <a name="l01122"></a>01122 } |
| 783 | <a name="l01123"></a>01123 <span class="keywordtype">double</span> _ll()<span class="keyword"> const </span>{ |
| 784 | <a name="l01124"></a>01124 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
| 785 | <a name="l01125"></a>01125 } |
| 786 | <a name="l01126"></a>01126 <span class="keywordtype">void</span> set_evalll ( <span class="keywordtype">bool</span> evl0 ) { |
| 787 | <a name="l01127"></a>01127 <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> = evl0; |
| 788 | <a name="l01128"></a>01128 } |
| 789 | <a name="l01129"></a>01129 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf& posterior() <span class="keyword">const</span> = 0; |
| 790 | <a name="l01131"></a>01131 |
| 791 | <a name="l01134"></a>01134 |
| 792 | <a name="l01136"></a><a class="code" href="classbdm_1_1BM.html#aadb539fa2585c8a2a91c54e5aebf330e">01136</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#aadb539fa2585c8a2a91c54e5aebf330e" 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 ) { |
| 793 | <a name="l01137"></a>01137 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 0 ) = 1; |
| 794 | <a name="l01138"></a>01138 <span class="keywordflow">if</span> ( opt.find ( <span class="stringliteral">"logbounds"</span> ) != string::npos ) { |
| 795 | <a name="l01139"></a>01139 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 1 ) = 1; |
| 796 | <a name="l01140"></a>01140 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 2 ) = 1; |
| 797 | <a name="l01141"></a>01141 } |
| 798 | <a name="l01142"></a>01142 <span class="keywordflow">if</span> ( opt.find ( <span class="stringliteral">"logll"</span> ) != string::npos ) { |
| 799 | <a name="l01143"></a>01143 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 3 ) = 1; |
| 800 | <a name="l01144"></a>01144 } |
| 801 | <a name="l01145"></a>01145 } |
| 802 | <a name="l01147"></a><a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca">01147</a> ivec <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a>; |
| 803 | <a name="l01148"></a>01148 |
| 804 | <a name="l01150"></a><a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207">01150</a> ivec <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>; |
| 805 | <a name="l01152"></a><a class="code" href="classbdm_1_1BM.html#a2298ca6af9b13a78a4c9e18ab43f1827">01152</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a2298ca6af9b13a78a4c9e18ab43f1827" 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> ) { |
| 806 | <a name="l01153"></a>01153 <span class="comment">// internal</span> |
| 807 | <a name="l01154"></a>01154 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> r; |
| 808 | <a name="l01155"></a>01155 <span class="keywordflow">if</span> ( posterior().isnamed() ) { |
| 809 | <a name="l01156"></a>01156 r = posterior().<a class="code" href="classbdm_1_1epdf.html#aa4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>(); |
| 810 | <a name="l01157"></a>01157 } <span class="keywordflow">else</span> { |
| 811 | <a name="l01158"></a>01158 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() ); |
| 812 | <a name="l01159"></a>01159 }; |
| 813 | <a name="l01160"></a>01160 |
| 814 | <a name="l01161"></a>01161 <span class="comment">// Add mean value</span> |
| 815 | <a name="l01162"></a>01162 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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#a109c1a626a69031658e3a44e9e500cca" 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#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( r, name + <span class="stringliteral">"mean_"</span> ); |
| 816 | <a name="l01163"></a>01163 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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#a109c1a626a69031658e3a44e9e500cca" 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#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( r, name + <span class="stringliteral">"lb_"</span> ); |
| 817 | <a name="l01164"></a>01164 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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#a109c1a626a69031658e3a44e9e500cca" 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#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( r, name + <span class="stringliteral">"ub_"</span> ); |
| 818 | <a name="l01165"></a>01165 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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#a109c1a626a69031658e3a44e9e500cca" 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#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">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> |
| 819 | <a name="l01166"></a>01166 } |
| 820 | <a name="l01167"></a>01167 <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 ) { |
| 821 | <a name="l01168"></a>01168 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 0 ), posterior().mean() ); |
| 822 | <a name="l01169"></a>01169 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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#a398b7e7a162cf37d0022d6126495f207" 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> |
| 823 | <a name="l01170"></a>01170 vec ub, lb; |
| 824 | <a name="l01171"></a>01171 posterior().<a class="code" href="classbdm_1_1epdf.html#a0a7705e80601957f7226d333a0a6d539" title="Lower and upper bounds of percentage % quantile, returns mean-2*sigma as default...">qbounds</a> ( lb, ub ); |
| 825 | <a name="l01172"></a>01172 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 1 ), lb ); |
| 826 | <a name="l01173"></a>01173 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 2 ), ub ); |
| 827 | <a name="l01174"></a>01174 } |
| 828 | <a name="l01175"></a>01175 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" 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#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" 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#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ); |
| 829 | <a name="l01176"></a>01176 } |
| 830 | <a name="l01178"></a><a class="code" href="classbdm_1_1BM.html#a23c6a8f71f922023ab08dcb0487a86de">01178</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a23c6a8f71f922023ab08dcb0487a86de" title="This method arrange instance properties according the data stored in the Setting...">from_setting</a> ( <span class="keyword">const</span> Setting &<span class="keyword">set</span> ) { |
| 831 | <a name="l01179"></a>01179 <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr<RV></a> r = UI::build<RV> ( <span class="keyword">set</span>, <span class="stringliteral">"drv"</span>, UI::optional ); |
| 832 | <a name="l01180"></a>01180 <span class="keywordflow">if</span> ( r ) { |
| 833 | <a name="l01181"></a>01181 set_drv ( *r ); |
| 834 | <a name="l01182"></a>01182 } |
| 835 | <a name="l01183"></a>01183 <span class="keywordtype">string</span> opt; |
| 836 | <a name="l01184"></a>01184 <span class="keywordflow">if</span> ( !<a class="code" href="classbdm_1_1UI.html#acd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a> ( opt, <span class="keyword">set</span>, <span class="stringliteral">"options"</span>, UI::optional ) ) { |
| 837 | <a name="l01185"></a>01185 <a class="code" href="classbdm_1_1BM.html#aadb539fa2585c8a2a91c54e5aebf330e" title="Set boolean options from a string, recognized are: &quot;logbounds,logll&quot;.">set_options</a> ( opt ); |
| 838 | <a name="l01186"></a>01186 } |
| 839 | <a name="l01187"></a>01187 } |
| 840 | <a name="l01188"></a>01188 |
| 841 | <a name="l01189"></a>01189 }; |
| 842 | <a name="l01190"></a>01190 |
| 843 | <a name="l01191"></a>01191 <span class="keyword">typedef</span> Array<shared_ptr<epdf> > epdf_array; |
| 844 | <a name="l01192"></a>01192 |
| 845 | <a name="l01193"></a>01193 <span class="keyword">typedef</span> Array<shared_ptr<mpdf> > mpdf_array; |
| 846 | <a name="l01194"></a>01194 |
| 847 | <a name="l01195"></a>01195 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 848 | <a name="l01196"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ad8e547695d1cc19219b91164d825c930">01196</a> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ad8e547695d1cc19219b91164d825c930" title="Reimplements samplecond using condition().">mpdf_internal<EPDF>::samplecond</a> ( <span class="keyword">const</span> vec &cond ) { |
| 849 | <a name="l01197"></a>01197 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
| 850 | <a name="l01198"></a>01198 vec temp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.sample(); |
| 851 | <a name="l01199"></a>01199 <span class="keywordflow">return</span> temp; |
| 852 | <a name="l01200"></a>01200 } |
| 853 | <a name="l01201"></a>01201 |
| 854 | <a name="l01202"></a>01202 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 855 | <a name="l01203"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a9554c554054da2d22cb8e908ae9c8823">01203</a> mat <a class="code" href="classbdm_1_1mpdf__internal.html#a9554c554054da2d22cb8e908ae9c8823" title="Efficient version of samplecond.">mpdf_internal<EPDF>::samplecond_m</a> ( <span class="keyword">const</span> vec &cond, <span class="keywordtype">int</span> N ) { |
| 856 | <a name="l01204"></a>01204 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
| 857 | <a name="l01205"></a>01205 mat temp ( dimension(), N ); |
| 858 | <a name="l01206"></a>01206 vec smp ( dimension() ); |
| 859 | <a name="l01207"></a>01207 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < N; i++ ) { |
| 860 | <a name="l01208"></a>01208 smp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.sample(); |
| 861 | <a name="l01209"></a>01209 temp.set_col ( i, smp ); |
| 862 | <a name="l01210"></a>01210 } |
| 863 | <a name="l01211"></a>01211 |
| 864 | <a name="l01212"></a>01212 <span class="keywordflow">return</span> temp; |
| 865 | <a name="l01213"></a>01213 } |
| 866 | <a name="l01214"></a>01214 |
| 867 | <a name="l01215"></a>01215 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 868 | <a name="l01216"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a89076e62b8d7df7616bad68c94591948">01216</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a89076e62b8d7df7616bad68c94591948" title="Reimplements evallogcond using condition().">mpdf_internal<EPDF>::evallogcond</a> ( <span class="keyword">const</span> vec &dt, <span class="keyword">const</span> vec &cond ) { |
| 869 | <a name="l01217"></a>01217 <span class="keywordtype">double</span> tmp; |
| 870 | <a name="l01218"></a>01218 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
| 871 | <a name="l01219"></a>01219 tmp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog ( dt ); |
| 872 | <a name="l01220"></a>01220 <span class="keywordflow">return</span> tmp; |
| 873 | <a name="l01221"></a>01221 } |
| 874 | <a name="l01222"></a>01222 |
| 875 | <a name="l01223"></a>01223 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 876 | <a name="l01224"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c">01224</a> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c" title="Efficient version of evallogcond for matrices.">mpdf_internal<EPDF>::evallogcond_m</a> ( <span class="keyword">const</span> mat &Dt, <span class="keyword">const</span> vec &cond ) { |
| 877 | <a name="l01225"></a>01225 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
| 878 | <a name="l01226"></a>01226 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog_m ( Dt ); |
| 879 | <a name="l01227"></a>01227 } |
| 880 | <a name="l01228"></a>01228 |
| 881 | <a name="l01229"></a>01229 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 882 | <a name="l01230"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae82db07ce8af02f29cfd81e014edb3db">01230</a> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c" title="Efficient version of evallogcond for matrices.">mpdf_internal<EPDF>::evallogcond_m</a> ( <span class="keyword">const</span> Array<vec> &Dt, <span class="keyword">const</span> vec &cond ) { |
| 883 | <a name="l01231"></a>01231 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
| 884 | <a name="l01232"></a>01232 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog_m ( Dt ); |
| 885 | <a name="l01233"></a>01233 } |
| 886 | <a name="l01234"></a>01234 |
| 887 | <a name="l01235"></a>01235 }; <span class="comment">//namespace</span> |
| 888 | <a name="l01236"></a>01236 <span class="preprocessor">#endif // BDMBASE_H</span> |