18 | | <a name="l00013"></a>00013 <span class="preprocessor">#ifndef BM_H</span> |
19 | | <a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define BM_H</span> |
20 | | <a name="l00015"></a>00015 <span class="preprocessor"></span> |
21 | | <a name="l00016"></a>00016 <span class="preprocessor">#include <itpp/itbase.h></span> |
22 | | <a name="l00017"></a>00017 <span class="preprocessor">#include "../itpp_ext.h"</span> |
23 | | <a name="l00018"></a>00018 <span class="comment">//#include <std></span> |
24 | | <a name="l00019"></a>00019 |
25 | | <a name="l00020"></a>00020 <span class="keyword">using namespace </span>itpp; |
26 | | <a name="l00021"></a>00021 |
27 | | <a name="l00023"></a><a class="code" href="classstr.html">00023</a> <span class="keyword">class </span><a class="code" href="classstr.html" title="Structure of RV (used internally), i.e. expanded RVs.">str</a> { |
28 | | <a name="l00024"></a>00024 <span class="keyword">public</span>: |
29 | | <a name="l00026"></a><a class="code" href="classstr.html#8c4e7241505999c272eb15e586ba7923">00026</a> ivec <a class="code" href="classstr.html#8c4e7241505999c272eb15e586ba7923" title="vector id ids (non-unique!)">ids</a>; |
30 | | <a name="l00028"></a><a class="code" href="classstr.html#a55be419d33638dd0b2de3ecd64a4f27">00028</a> ivec <a class="code" href="classstr.html#a55be419d33638dd0b2de3ecd64a4f27" title="vector of times">times</a>; |
31 | | <a name="l00030"></a><a class="code" href="classstr.html#11ba7967bca045fe27fab8e70b6c0598">00030</a> <a class="code" href="classstr.html#11ba7967bca045fe27fab8e70b6c0598" title="Default constructor.">str</a> ( ivec ids0, ivec times0 ) :<a class="code" href="classstr.html#8c4e7241505999c272eb15e586ba7923" title="vector id ids (non-unique!)">ids</a> ( ids0 ),<a class="code" href="classstr.html#a55be419d33638dd0b2de3ecd64a4f27" title="vector of times">times</a> ( times0 ) { |
32 | | <a name="l00031"></a>00031 it_assert_debug ( times0.length() ==ids0.length(),<span class="stringliteral">"Incompatible input"</span> ); |
33 | | <a name="l00032"></a>00032 }; |
34 | | <a name="l00033"></a>00033 }; |
35 | | <a name="l00034"></a>00034 |
36 | | <a name="l00041"></a><a class="code" href="classRV.html">00041</a> <span class="keyword">class </span><a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> { |
37 | | <a name="l00042"></a>00042 <span class="keyword">protected</span>: |
38 | | <a name="l00044"></a><a class="code" href="classRV.html#f2396efe2e6d656ebe9e6f06018cbe25">00044</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#f2396efe2e6d656ebe9e6f06018cbe25" title="size = sum of sizes">tsize</a>; |
39 | | <a name="l00046"></a><a class="code" href="classRV.html#0d7b36e2bbccf880c8fcf1e8cc43c1a9">00046</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#0d7b36e2bbccf880c8fcf1e8cc43c1a9" title="len = number of individual rvs">len</a>; |
40 | | <a name="l00048"></a><a class="code" href="classRV.html#1bd7165140f4b880a7f344bbb1c433f9">00048</a> ivec <a class="code" href="classRV.html#1bd7165140f4b880a7f344bbb1c433f9" title="Vector of unique IDs.">ids</a>; |
41 | | <a name="l00050"></a><a class="code" href="classRV.html#c878aab13f34b420e1eb5b485563682b">00050</a> ivec <a class="code" href="classRV.html#c878aab13f34b420e1eb5b485563682b" title="Vector of sizes.">sizes</a>; |
42 | | <a name="l00052"></a><a class="code" href="classRV.html#646e530c47a2dd38254b778d9f11ac89">00052</a> ivec <a class="code" href="classRV.html#646e530c47a2dd38254b778d9f11ac89" title="Vector of shifts from current time.">times</a>; |
43 | | <a name="l00054"></a><a class="code" href="classRV.html#df5d0030b277a1db2f1fd5fb79152acb">00054</a> Array<std::string> <a class="code" href="classRV.html#df5d0030b277a1db2f1fd5fb79152acb" title="Array of names.">names</a>; |
44 | | <a name="l00055"></a>00055 |
45 | | <a name="l00056"></a>00056 <span class="keyword">private</span>: |
46 | | <a name="l00058"></a>00058 <span class="keywordtype">void</span> init ( ivec in_ids, Array<std::string> in_names, ivec in_sizes, ivec in_times ); |
47 | | <a name="l00059"></a>00059 <span class="keyword">public</span>: |
48 | | <a name="l00061"></a>00061 <a class="code" href="classRV.html#6a22f5c06d6403870d4e414b1993bf9e" title="Constructor of empty RV.">RV</a> ( Array<std::string> in_names, ivec in_sizes, ivec in_times ); |
49 | | <a name="l00063"></a>00063 <a class="code" href="classRV.html#6a22f5c06d6403870d4e414b1993bf9e" title="Constructor of empty RV.">RV</a> ( Array<std::string> in_names, ivec in_sizes ); |
50 | | <a name="l00065"></a>00065 <a class="code" href="classRV.html#6a22f5c06d6403870d4e414b1993bf9e" title="Constructor of empty RV.">RV</a> ( Array<std::string> in_names ); |
51 | | <a name="l00067"></a>00067 <a class="code" href="classRV.html#6a22f5c06d6403870d4e414b1993bf9e" title="Constructor of empty RV.">RV</a> (); |
52 | | <a name="l00068"></a>00068 |
53 | | <a name="l00070"></a>00070 <span class="keyword">friend</span> std::ostream &<a class="code" href="classRV.html#cad6f15535d10437f6690cb4492176a8" title="Printing output e.g. for debugging.">operator<< </a>( std::ostream &os, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv ); |
54 | | <a name="l00071"></a>00071 |
55 | | <a name="l00073"></a><a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0">00073</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classRV.html#f2396efe2e6d656ebe9e6f06018cbe25" title="size = sum of sizes">tsize</a>;} ; |
56 | | <a name="l00075"></a><a class="code" href="classRV.html#c114a6f3ff06796cc2f4dacba74291eb">00075</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#c114a6f3ff06796cc2f4dacba74291eb" title="Return length (number of entries) of the RV.">length</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classRV.html#0d7b36e2bbccf880c8fcf1e8cc43c1a9" title="len = number of individual rvs">len</a>;} ; |
57 | | <a name="l00076"></a>00076 |
58 | | <a name="l00077"></a>00077 <span class="comment">//TODO why not inline and later??</span> |
59 | | <a name="l00078"></a>00078 |
60 | | <a name="l00080"></a>00080 ivec <a class="code" href="classRV.html#0c493a7a897f4d75682f4264e40779a1" title="Find indexes of self in another rv,.">findself</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ) <span class="keyword">const</span>; |
61 | | <a name="l00082"></a>00082 <span class="keywordtype">bool</span> <a class="code" href="classRV.html#82cc7fa22ce91cf461a522ad62014c65" title="Compare if rv2 is identical to this RV.">equal</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ) <span class="keyword">const</span>; |
62 | | <a name="l00084"></a>00084 <span class="keywordtype">bool</span> <span class="keyword">add</span> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ); |
63 | | <a name="l00086"></a>00086 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#b9d175c327c21488b1e2fb756a84e149" title="Subtract another variable from the current one.">subt</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ) <span class="keyword">const</span>; |
64 | | <a name="l00088"></a>00088 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#b26d25a122be3303806af7726a625a0f" title="Select only variables at indeces ind.">subselect</a> ( <span class="keyword">const</span> ivec &ind ) <span class="keyword">const</span>; |
65 | | <a name="l00090"></a>00090 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#248dfb2387976db2658489347669278c" title="Select only variables at indeces ind.">operator() </a>( <span class="keyword">const</span> ivec &ind ) <span class="keyword">const</span>; |
66 | | <a name="l00092"></a>00092 <span class="keywordtype">void</span> <a class="code" href="classRV.html#e0a158d53ab9430627241f844f4c9a60" title="Shift time shifted by delta.">t</a> ( <span class="keywordtype">int</span> delta ); |
67 | | <a name="l00094"></a>00094 <a class="code" href="classstr.html" title="Structure of RV (used internally), i.e. expanded RVs.">str</a> <a class="code" href="classRV.html#52f3ade796814da627ff5a44d00986be" title="generate str from rv, by expanding sizes">tostr</a>() <span class="keyword">const</span>; |
68 | | <a name="l00097"></a>00097 ivec <a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &crv ) <span class="keyword">const</span>; |
69 | | <a name="l00100"></a>00100 <span class="keywordtype">void</span> <a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv2, ivec &selfi, ivec &rv2i ) <span class="keyword">const</span>; |
70 | | <a name="l00101"></a>00101 |
71 | | <a name="l00103"></a><a class="code" href="classRV.html#b88ef5124713c9e30fd9446846b3f044">00103</a> Array<std::string>& <a class="code" href="classRV.html#b88ef5124713c9e30fd9446846b3f044" title="access function">_names</a>() {<span class="keywordflow">return</span> <a class="code" href="classRV.html#df5d0030b277a1db2f1fd5fb79152acb" title="Array of names.">names</a>;}; |
72 | | <a name="l00104"></a>00104 |
73 | | <a name="l00106"></a><a class="code" href="classRV.html#4a0069bc69f5a98d7ce9ed59077f2e6c">00106</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#4a0069bc69f5a98d7ce9ed59077f2e6c" title="access function">id</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classRV.html#1bd7165140f4b880a7f344bbb1c433f9" title="Vector of unique IDs.">ids</a> ( at );}; |
74 | | <a name="l00108"></a><a class="code" href="classRV.html#20db23a5585d64a6e24404cc8379bc28">00108</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#20db23a5585d64a6e24404cc8379bc28" title="access function">size</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classRV.html#c878aab13f34b420e1eb5b485563682b" title="Vector of sizes.">sizes</a> ( at );}; |
75 | | <a name="l00110"></a><a class="code" href="classRV.html#af068cf478864fe1a4fbfc6b4693b088">00110</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#af068cf478864fe1a4fbfc6b4693b088" title="access function">time</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classRV.html#646e530c47a2dd38254b778d9f11ac89" title="Vector of shifts from current time.">times</a> ( at );}; |
76 | | <a name="l00112"></a><a class="code" href="classRV.html#3ae4dd6e368f814a02710636ac8e1721">00112</a> std::string <a class="code" href="classRV.html#3ae4dd6e368f814a02710636ac8e1721" title="access function">name</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classRV.html#df5d0030b277a1db2f1fd5fb79152acb" title="Array of names.">names</a> ( at );}; |
77 | | <a name="l00113"></a>00113 |
78 | | <a name="l00115"></a><a class="code" href="classRV.html#f58db96c9f5b8a538e26f154b1047c62">00115</a> <span class="keywordtype">void</span> <a class="code" href="classRV.html#f58db96c9f5b8a538e26f154b1047c62" title="access function">set_id</a> ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> id0 ) {<a class="code" href="classRV.html#1bd7165140f4b880a7f344bbb1c433f9" title="Vector of unique IDs.">ids</a> ( at ) =id0;}; |
79 | | <a name="l00117"></a><a class="code" href="classRV.html#70b24c39c5130b1e4753fa2eef495433">00117</a> <span class="keywordtype">void</span> <a class="code" href="classRV.html#70b24c39c5130b1e4753fa2eef495433" title="access function">set_size</a> ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> size0 ) {<a class="code" href="classRV.html#c878aab13f34b420e1eb5b485563682b" title="Vector of sizes.">sizes</a> ( at ) =size0; <a class="code" href="classRV.html#f2396efe2e6d656ebe9e6f06018cbe25" title="size = sum of sizes">tsize</a>=sum ( <a class="code" href="classRV.html#c878aab13f34b420e1eb5b485563682b" title="Vector of sizes.">sizes</a> );}; |
80 | | <a name="l00119"></a><a class="code" href="classRV.html#af668289c016d12ac2a9ddb85416006b">00119</a> <span class="keywordtype">void</span> <a class="code" href="classRV.html#af668289c016d12ac2a9ddb85416006b" title="access function">set_time</a> ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> time0 ) {<a class="code" href="classRV.html#646e530c47a2dd38254b778d9f11ac89" title="Vector of shifts from current time.">times</a> ( at ) =time0;}; |
81 | | <a name="l00120"></a>00120 |
82 | | <a name="l00122"></a>00122 <span class="keywordtype">void</span> <a class="code" href="classRV.html#fc4a3175ff678cba7ae4109654f66ce5" title="Assign unused ids to this rv.">newids</a>(); |
83 | | <a name="l00123"></a>00123 }; |
| 19 | <a name="l00017"></a>00017 <span class="preprocessor">#ifndef BM_H</span> |
| 20 | <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define BM_H</span> |
| 21 | <a name="l00019"></a>00019 <span class="preprocessor"></span> |
| 22 | <a name="l00020"></a>00020 <span class="preprocessor">#include <itpp/itbase.h></span> |
| 23 | <a name="l00021"></a>00021 <span class="preprocessor">#include "../itpp_ext.h"</span> |
| 24 | <a name="l00022"></a>00022 <span class="comment">//#include <std></span> |
| 25 | <a name="l00023"></a>00023 |
| 26 | <a name="l00024"></a>00024 <span class="keyword">using namespace </span>itpp; |
| 27 | <a name="l00025"></a>00025 |
| 28 | <a name="l00027"></a><a class="code" href="classstr.html">00027</a> <span class="keyword">class </span><a class="code" href="classstr.html" title="Structure of RV (used internally), i.e. expanded RVs.">str</a> { |
| 29 | <a name="l00028"></a>00028 <span class="keyword">public</span>: |
| 30 | <a name="l00030"></a><a class="code" href="classstr.html#8c4e7241505999c272eb15e586ba7923">00030</a> ivec <a class="code" href="classstr.html#8c4e7241505999c272eb15e586ba7923" title="vector id ids (non-unique!)">ids</a>; |
| 31 | <a name="l00032"></a><a class="code" href="classstr.html#a55be419d33638dd0b2de3ecd64a4f27">00032</a> ivec <a class="code" href="classstr.html#a55be419d33638dd0b2de3ecd64a4f27" title="vector of times">times</a>; |
| 32 | <a name="l00034"></a><a class="code" href="classstr.html#11ba7967bca045fe27fab8e70b6c0598">00034</a> <a class="code" href="classstr.html#11ba7967bca045fe27fab8e70b6c0598" title="Default constructor.">str</a> ( ivec ids0, ivec times0 ) :<a class="code" href="classstr.html#8c4e7241505999c272eb15e586ba7923" title="vector id ids (non-unique!)">ids</a> ( ids0 ),<a class="code" href="classstr.html#a55be419d33638dd0b2de3ecd64a4f27" title="vector of times">times</a> ( times0 ) { |
| 33 | <a name="l00035"></a>00035 it_assert_debug ( times0.length() ==ids0.length(),<span class="stringliteral">"Incompatible input"</span> ); |
| 34 | <a name="l00036"></a>00036 }; |
| 35 | <a name="l00037"></a>00037 }; |
| 36 | <a name="l00038"></a>00038 |
| 37 | <a name="l00045"></a><a class="code" href="classRV.html">00045</a> <span class="keyword">class </span><a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> { |
| 38 | <a name="l00046"></a>00046 <span class="keyword">protected</span>: |
| 39 | <a name="l00048"></a><a class="code" href="classRV.html#f2396efe2e6d656ebe9e6f06018cbe25">00048</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#f2396efe2e6d656ebe9e6f06018cbe25" title="size = sum of sizes">tsize</a>; |
| 40 | <a name="l00050"></a><a class="code" href="classRV.html#0d7b36e2bbccf880c8fcf1e8cc43c1a9">00050</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#0d7b36e2bbccf880c8fcf1e8cc43c1a9" title="len = number of individual rvs">len</a>; |
| 41 | <a name="l00052"></a><a class="code" href="classRV.html#1bd7165140f4b880a7f344bbb1c433f9">00052</a> ivec <a class="code" href="classRV.html#1bd7165140f4b880a7f344bbb1c433f9" title="Vector of unique IDs.">ids</a>; |
| 42 | <a name="l00054"></a><a class="code" href="classRV.html#c878aab13f34b420e1eb5b485563682b">00054</a> ivec <a class="code" href="classRV.html#c878aab13f34b420e1eb5b485563682b" title="Vector of sizes.">sizes</a>; |
| 43 | <a name="l00056"></a><a class="code" href="classRV.html#646e530c47a2dd38254b778d9f11ac89">00056</a> ivec <a class="code" href="classRV.html#646e530c47a2dd38254b778d9f11ac89" title="Vector of shifts from current time.">times</a>; |
| 44 | <a name="l00058"></a><a class="code" href="classRV.html#df5d0030b277a1db2f1fd5fb79152acb">00058</a> Array<std::string> <a class="code" href="classRV.html#df5d0030b277a1db2f1fd5fb79152acb" title="Array of names.">names</a>; |
| 45 | <a name="l00059"></a>00059 |
| 46 | <a name="l00060"></a>00060 <span class="keyword">private</span>: |
| 47 | <a name="l00062"></a>00062 <span class="keywordtype">void</span> init ( ivec in_ids, Array<std::string> in_names, ivec in_sizes, ivec in_times ); |
| 48 | <a name="l00063"></a>00063 <span class="keyword">public</span>: |
| 49 | <a name="l00065"></a>00065 <a class="code" href="classRV.html#6a22f5c06d6403870d4e414b1993bf9e" title="Constructor of empty RV.">RV</a> ( Array<std::string> in_names, ivec in_sizes, ivec in_times ); |
| 50 | <a name="l00067"></a>00067 <a class="code" href="classRV.html#6a22f5c06d6403870d4e414b1993bf9e" title="Constructor of empty RV.">RV</a> ( Array<std::string> in_names, ivec in_sizes ); |
| 51 | <a name="l00069"></a>00069 <a class="code" href="classRV.html#6a22f5c06d6403870d4e414b1993bf9e" title="Constructor of empty RV.">RV</a> ( Array<std::string> in_names ); |
| 52 | <a name="l00071"></a>00071 <a class="code" href="classRV.html#6a22f5c06d6403870d4e414b1993bf9e" title="Constructor of empty RV.">RV</a> (); |
| 53 | <a name="l00072"></a>00072 |
| 54 | <a name="l00074"></a>00074 <span class="keyword">friend</span> std::ostream &<a class="code" href="classRV.html#cad6f15535d10437f6690cb4492176a8" title="Printing output e.g. for debugging.">operator<< </a>( std::ostream &os, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv ); |
| 55 | <a name="l00075"></a>00075 |
| 56 | <a name="l00077"></a><a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0">00077</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classRV.html#f2396efe2e6d656ebe9e6f06018cbe25" title="size = sum of sizes">tsize</a>;} ; |
| 57 | <a name="l00079"></a><a class="code" href="classRV.html#c114a6f3ff06796cc2f4dacba74291eb">00079</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#c114a6f3ff06796cc2f4dacba74291eb" title="Return length (number of entries) of the RV.">length</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classRV.html#0d7b36e2bbccf880c8fcf1e8cc43c1a9" title="len = number of individual rvs">len</a>;} ; |
| 58 | <a name="l00080"></a>00080 |
| 59 | <a name="l00081"></a>00081 <span class="comment">//TODO why not inline and later??</span> |
| 60 | <a name="l00082"></a>00082 |
| 61 | <a name="l00084"></a>00084 ivec <a class="code" href="classRV.html#0c493a7a897f4d75682f4264e40779a1" title="Find indexes of self in another rv,.">findself</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 62 | <a name="l00086"></a>00086 <span class="keywordtype">bool</span> <a class="code" href="classRV.html#82cc7fa22ce91cf461a522ad62014c65" title="Compare if rv2 is identical to this RV.">equal</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 63 | <a name="l00088"></a>00088 <span class="keywordtype">bool</span> <span class="keyword">add</span> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ); |
| 64 | <a name="l00090"></a>00090 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#b9d175c327c21488b1e2fb756a84e149" title="Subtract another variable from the current one.">subt</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv2 ) <span class="keyword">const</span>; |
| 65 | <a name="l00092"></a>00092 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#b26d25a122be3303806af7726a625a0f" title="Select only variables at indeces ind.">subselect</a> ( <span class="keyword">const</span> ivec &ind ) <span class="keyword">const</span>; |
| 66 | <a name="l00094"></a>00094 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#248dfb2387976db2658489347669278c" title="Select only variables at indeces ind.">operator() </a>( <span class="keyword">const</span> ivec &ind ) <span class="keyword">const</span>; |
| 67 | <a name="l00096"></a>00096 <span class="keywordtype">void</span> <a class="code" href="classRV.html#e0a158d53ab9430627241f844f4c9a60" title="Shift time shifted by delta.">t</a> ( <span class="keywordtype">int</span> delta ); |
| 68 | <a name="l00098"></a>00098 <a class="code" href="classstr.html" title="Structure of RV (used internally), i.e. expanded RVs.">str</a> <a class="code" href="classRV.html#52f3ade796814da627ff5a44d00986be" title="generate str from rv, by expanding sizes">tostr</a>() <span class="keyword">const</span>; |
| 69 | <a name="l00101"></a>00101 ivec <a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &crv ) <span class="keyword">const</span>; |
| 70 | <a name="l00104"></a>00104 <span class="keywordtype">void</span> <a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv2, ivec &selfi, ivec &rv2i ) <span class="keyword">const</span>; |
| 71 | <a name="l00105"></a>00105 |
| 72 | <a name="l00107"></a><a class="code" href="classRV.html#b88ef5124713c9e30fd9446846b3f044">00107</a> Array<std::string>& <a class="code" href="classRV.html#b88ef5124713c9e30fd9446846b3f044" title="access function">_names</a>() {<span class="keywordflow">return</span> <a class="code" href="classRV.html#df5d0030b277a1db2f1fd5fb79152acb" title="Array of names.">names</a>;}; |
| 73 | <a name="l00108"></a>00108 |
| 74 | <a name="l00110"></a><a class="code" href="classRV.html#4a0069bc69f5a98d7ce9ed59077f2e6c">00110</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#4a0069bc69f5a98d7ce9ed59077f2e6c" title="access function">id</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classRV.html#1bd7165140f4b880a7f344bbb1c433f9" title="Vector of unique IDs.">ids</a> ( at );}; |
| 75 | <a name="l00112"></a><a class="code" href="classRV.html#20db23a5585d64a6e24404cc8379bc28">00112</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#20db23a5585d64a6e24404cc8379bc28" title="access function">size</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classRV.html#c878aab13f34b420e1eb5b485563682b" title="Vector of sizes.">sizes</a> ( at );}; |
| 76 | <a name="l00114"></a><a class="code" href="classRV.html#af068cf478864fe1a4fbfc6b4693b088">00114</a> <span class="keywordtype">int</span> <a class="code" href="classRV.html#af068cf478864fe1a4fbfc6b4693b088" title="access function">time</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classRV.html#646e530c47a2dd38254b778d9f11ac89" title="Vector of shifts from current time.">times</a> ( at );}; |
| 77 | <a name="l00116"></a><a class="code" href="classRV.html#3ae4dd6e368f814a02710636ac8e1721">00116</a> std::string <a class="code" href="classRV.html#3ae4dd6e368f814a02710636ac8e1721" title="access function">name</a> ( <span class="keywordtype">int</span> at ) {<span class="keywordflow">return</span> <a class="code" href="classRV.html#df5d0030b277a1db2f1fd5fb79152acb" title="Array of names.">names</a> ( at );}; |
| 78 | <a name="l00117"></a>00117 |
| 79 | <a name="l00119"></a><a class="code" href="classRV.html#f58db96c9f5b8a538e26f154b1047c62">00119</a> <span class="keywordtype">void</span> <a class="code" href="classRV.html#f58db96c9f5b8a538e26f154b1047c62" title="access function">set_id</a> ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> id0 ) {<a class="code" href="classRV.html#1bd7165140f4b880a7f344bbb1c433f9" title="Vector of unique IDs.">ids</a> ( at ) =id0;}; |
| 80 | <a name="l00121"></a><a class="code" href="classRV.html#70b24c39c5130b1e4753fa2eef495433">00121</a> <span class="keywordtype">void</span> <a class="code" href="classRV.html#70b24c39c5130b1e4753fa2eef495433" title="access function">set_size</a> ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> size0 ) {<a class="code" href="classRV.html#c878aab13f34b420e1eb5b485563682b" title="Vector of sizes.">sizes</a> ( at ) =size0; <a class="code" href="classRV.html#f2396efe2e6d656ebe9e6f06018cbe25" title="size = sum of sizes">tsize</a>=sum ( <a class="code" href="classRV.html#c878aab13f34b420e1eb5b485563682b" title="Vector of sizes.">sizes</a> );}; |
| 81 | <a name="l00123"></a><a class="code" href="classRV.html#af668289c016d12ac2a9ddb85416006b">00123</a> <span class="keywordtype">void</span> <a class="code" href="classRV.html#af668289c016d12ac2a9ddb85416006b" title="access function">set_time</a> ( <span class="keywordtype">int</span> at, <span class="keywordtype">int</span> time0 ) {<a class="code" href="classRV.html#646e530c47a2dd38254b778d9f11ac89" title="Vector of shifts from current time.">times</a> ( at ) =time0;}; |
117 | | <a name="l00169"></a>00169 <span class="keyword">virtual</span> vec <a class="code" href="classepdf.html#8019654e494bf5e458f6fb947e11b262" title="Returns a sample, from density .">sample</a> () <span class="keyword">const</span> =0; |
118 | | <a name="l00171"></a>00171 <span class="keyword">virtual</span> mat <a class="code" href="classepdf.html#76608914c3b19e150292d5c56e93e508" title="Returns N samples from density .">sample_m</a> ( <span class="keywordtype">int</span> N ) <span class="keyword">const</span>; |
119 | | <a name="l00172"></a>00172 |
120 | | <a name="l00174"></a>00174 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classepdf.html#6aef3eca74899692503769c18add1a4c" title="Compute log-probability of argument val.">evalpdflog</a> ( <span class="keyword">const</span> vec &val ) <span class="keyword">const</span> =0; |
121 | | <a name="l00175"></a>00175 |
122 | | <a name="l00177"></a><a class="code" href="classepdf.html#cebbdd7a85e6328f7358fc0ba8eee06c">00177</a> <span class="keyword">virtual</span> vec <a class="code" href="classepdf.html#cebbdd7a85e6328f7358fc0ba8eee06c" title="Compute log-probability of multiple values argument val.">evalpdflog_m</a> ( <span class="keyword">const</span> mat &Val )<span class="keyword"> const </span>{ |
123 | | <a name="l00178"></a>00178 vec x ( Val.cols() ); |
124 | | <a name="l00179"></a>00179 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<Val.cols();i++ ) {x ( i ) =<a class="code" href="classepdf.html#6aef3eca74899692503769c18add1a4c" title="Compute log-probability of argument val.">evalpdflog</a> ( Val.get_col ( i ) ) ;} |
125 | | <a name="l00180"></a>00180 <span class="keywordflow">return</span> x; |
126 | | <a name="l00181"></a>00181 } |
127 | | <a name="l00183"></a><a class="code" href="classepdf.html#e87dc8260a5c37bc1b03eb66174741a0">00183</a> <span class="keyword">virtual</span> <a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>* <a class="code" href="classepdf.html#e87dc8260a5c37bc1b03eb66174741a0" 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="classRV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> )<span class="keyword"> const </span>{it_warning ( <span class="stringliteral">"Not implemented"</span> ); <span class="keywordflow">return</span> NULL;} |
128 | | <a name="l00185"></a><a class="code" href="classepdf.html#38de9f59b65ee06028554f3f74b66025">00185</a> <span class="keyword">virtual</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classepdf.html#38de9f59b65ee06028554f3f74b66025" 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="classRV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> )<span class="keyword"> const </span>{it_warning ( <span class="stringliteral">"Not implemented"</span> ); <span class="keywordflow">return</span> NULL;} |
129 | | <a name="l00186"></a>00186 |
130 | | <a name="l00188"></a>00188 <span class="keyword">virtual</span> vec <a class="code" href="classepdf.html#bf0a070a8f3e67a93604ca724638b870" title="return expected value">mean</a>() <span class="keyword">const</span> =0; |
131 | | <a name="l00189"></a>00189 |
132 | | <a name="l00191"></a><a class="code" href="classepdf.html#0a322dd106f04c0a2915e3d4f4227396">00191</a> <span class="keyword">virtual</span> <a class="code" href="classepdf.html#0a322dd106f04c0a2915e3d4f4227396" title="Destructor for future use;.">~epdf</a>() {}; |
133 | | <a name="l00193"></a><a class="code" href="classepdf.html#ca0d32aabb4cbba347e0c37fe8607562">00193</a> <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classepdf.html#ca0d32aabb4cbba347e0c37fe8607562" title="access function, possibly dangerous!">_rv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>;} |
134 | | <a name="l00195"></a><a class="code" href="classepdf.html#7fb94ce90d1ac7077d29f7d6a6c3e0a5">00195</a> <span class="keywordtype">void</span> <a class="code" href="classepdf.html#7fb94ce90d1ac7077d29f7d6a6c3e0a5" title="modifier function - useful when copying epdfs">_renewrv</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &in_rv ) {<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>=in_rv;} |
135 | | <a name="l00197"></a>00197 }; |
136 | | <a name="l00198"></a>00198 |
137 | | <a name="l00199"></a>00199 |
138 | | <a name="l00201"></a>00201 <span class="comment">//TODO Samplecond can be generalized</span> |
139 | | <a name="l00202"></a>00202 |
140 | | <a name="l00203"></a><a class="code" href="classmpdf.html">00203</a> <span class="keyword">class </span><a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> { |
141 | | <a name="l00204"></a>00204 <span class="keyword">protected</span>: |
142 | | <a name="l00206"></a><a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb">00206</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>; |
143 | | <a name="l00208"></a><a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab">00208</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab" title="random variable in condition">rvc</a>; |
144 | | <a name="l00210"></a><a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c">00210</a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>; |
145 | | <a name="l00211"></a>00211 <span class="keyword">public</span>: |
146 | | <a name="l00212"></a>00212 |
147 | | <a name="l00214"></a>00214 <span class="comment">// virtual fnc moment ( const int order = 1 );</span> |
148 | | <a name="l00216"></a><a class="code" href="classmpdf.html#3f172b79ec4a5ebc87898a5381141f1b">00216</a> <span class="comment"></span> <span class="keyword">virtual</span> vec <a class="code" href="classmpdf.html#3f172b79ec4a5ebc87898a5381141f1b" title="Returns the required moment of the epdf.">samplecond</a> ( <span class="keyword">const</span> vec &cond, <span class="keywordtype">double</span> &ll ) { |
149 | | <a name="l00217"></a>00217 this-><a class="code" href="classmpdf.html#0f95a0cc6ab40611f46804682446ed83" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond ); |
150 | | <a name="l00218"></a>00218 vec temp= <a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>-><a class="code" href="classepdf.html#8019654e494bf5e458f6fb947e11b262" title="Returns a sample, from density .">sample</a>(); |
151 | | <a name="l00219"></a>00219 ll=<a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>-><a class="code" href="classepdf.html#6aef3eca74899692503769c18add1a4c" title="Compute log-probability of argument val.">evalpdflog</a> ( temp );<span class="keywordflow">return</span> temp; |
152 | | <a name="l00220"></a>00220 }; |
153 | | <a name="l00222"></a><a class="code" href="classmpdf.html#0e37163660f93df2a4d723cedb1da89c">00222</a> <span class="keyword">virtual</span> mat <a class="code" href="classmpdf.html#3f172b79ec4a5ebc87898a5381141f1b" title="Returns the required moment of the epdf.">samplecond</a> ( <span class="keyword">const</span> vec &cond, vec &ll, <span class="keywordtype">int</span> N ) { |
| 114 | <a name="l00169"></a><a class="code" href="classepdf.html#c95b1a27a8dd9507bb9a5a3cb2809c7a">00169</a> <a class="code" href="classepdf.html#d8eb760037b3bad5a0d64081606697cd" title="default constructor">epdf</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv0 ) :<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ( rv0 ) {}; |
| 115 | <a name="l00170"></a>00170 |
| 116 | <a name="l00171"></a>00171 <span class="comment">// //! Returns the required moment of the epdf</span> |
| 117 | <a name="l00172"></a>00172 <span class="comment">// virtual vec moment ( const int order = 1 );</span> |
| 118 | <a name="l00173"></a>00173 |
| 119 | <a name="l00175"></a>00175 <span class="keyword">virtual</span> vec <a class="code" href="classepdf.html#8019654e494bf5e458f6fb947e11b262" title="Returns a sample, from density .">sample</a> () <span class="keyword">const</span> =0; |
| 120 | <a name="l00177"></a>00177 <span class="keyword">virtual</span> mat <a class="code" href="classepdf.html#76608914c3b19e150292d5c56e93e508" title="Returns N samples from density .">sample_m</a> ( <span class="keywordtype">int</span> N ) <span class="keyword">const</span>; |
| 121 | <a name="l00178"></a>00178 |
| 122 | <a name="l00180"></a>00180 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classepdf.html#e1996af1da1fa1214270066a96ca113e" title="Compute log-probability of argument val.">evallog</a> ( <span class="keyword">const</span> vec &val ) <span class="keyword">const</span> =0; |
| 123 | <a name="l00181"></a>00181 |
| 124 | <a name="l00183"></a><a class="code" href="classepdf.html#2495a04bbacb9b55fe5a3a59b78affca">00183</a> <span class="keyword">virtual</span> vec <a class="code" href="classepdf.html#2495a04bbacb9b55fe5a3a59b78affca" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( <span class="keyword">const</span> mat &Val )<span class="keyword"> const </span>{ |
| 125 | <a name="l00184"></a>00184 vec x ( Val.cols() ); |
| 126 | <a name="l00185"></a>00185 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<Val.cols();i++ ) {x ( i ) =<a class="code" href="classepdf.html#e1996af1da1fa1214270066a96ca113e" title="Compute log-probability of argument val.">evallog</a> ( Val.get_col ( i ) ) ;} |
| 127 | <a name="l00186"></a>00186 <span class="keywordflow">return</span> x; |
| 128 | <a name="l00187"></a>00187 } |
| 129 | <a name="l00189"></a><a class="code" href="classepdf.html#e87dc8260a5c37bc1b03eb66174741a0">00189</a> <span class="keyword">virtual</span> <a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>* <a class="code" href="classepdf.html#e87dc8260a5c37bc1b03eb66174741a0" 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="classRV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> )<span class="keyword"> const </span>{it_warning ( <span class="stringliteral">"Not implemented"</span> ); <span class="keywordflow">return</span> NULL;} |
| 130 | <a name="l00191"></a><a class="code" href="classepdf.html#38de9f59b65ee06028554f3f74b66025">00191</a> <span class="keyword">virtual</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classepdf.html#38de9f59b65ee06028554f3f74b66025" 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="classRV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> )<span class="keyword"> const </span>{it_warning ( <span class="stringliteral">"Not implemented"</span> ); <span class="keywordflow">return</span> NULL;} |
| 131 | <a name="l00192"></a>00192 |
| 132 | <a name="l00194"></a>00194 <span class="keyword">virtual</span> vec <a class="code" href="classepdf.html#bf0a070a8f3e67a93604ca724638b870" title="return expected value">mean</a>() <span class="keyword">const</span> =0; |
| 133 | <a name="l00195"></a>00195 |
| 134 | <a name="l00197"></a><a class="code" href="classepdf.html#0a322dd106f04c0a2915e3d4f4227396">00197</a> <span class="keyword">virtual</span> <a class="code" href="classepdf.html#0a322dd106f04c0a2915e3d4f4227396" title="Destructor for future use;.">~epdf</a>() {}; |
| 135 | <a name="l00199"></a><a class="code" href="classepdf.html#ca0d32aabb4cbba347e0c37fe8607562">00199</a> <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classepdf.html#ca0d32aabb4cbba347e0c37fe8607562" title="access function, possibly dangerous!">_rv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>;} |
| 136 | <a name="l00201"></a><a class="code" href="classepdf.html#7fb94ce90d1ac7077d29f7d6a6c3e0a5">00201</a> <span class="keywordtype">void</span> <a class="code" href="classepdf.html#7fb94ce90d1ac7077d29f7d6a6c3e0a5" title="modifier function - useful when copying epdfs">_renewrv</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &in_rv ) {<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>=in_rv;} |
| 137 | <a name="l00203"></a>00203 }; |
| 138 | <a name="l00204"></a>00204 |
| 139 | <a name="l00205"></a>00205 |
| 140 | <a name="l00207"></a>00207 <span class="comment">//TODO Samplecond can be generalized</span> |
| 141 | <a name="l00208"></a>00208 |
| 142 | <a name="l00209"></a><a class="code" href="classmpdf.html">00209</a> <span class="keyword">class </span><a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> { |
| 143 | <a name="l00210"></a>00210 <span class="keyword">protected</span>: |
| 144 | <a name="l00212"></a><a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb">00212</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>; |
| 145 | <a name="l00214"></a><a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab">00214</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab" title="random variable in condition">rvc</a>; |
| 146 | <a name="l00216"></a><a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c">00216</a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>; |
| 147 | <a name="l00217"></a>00217 <span class="keyword">public</span>: |
| 148 | <a name="l00218"></a>00218 |
| 149 | <a name="l00220"></a>00220 <span class="comment">// virtual fnc moment ( const int order = 1 );</span> |
| 150 | <a name="l00222"></a><a class="code" href="classmpdf.html#3f172b79ec4a5ebc87898a5381141f1b">00222</a> <span class="comment"></span> <span class="keyword">virtual</span> vec <a class="code" href="classmpdf.html#3f172b79ec4a5ebc87898a5381141f1b" title="Returns the required moment of the epdf.">samplecond</a> ( <span class="keyword">const</span> vec &cond, <span class="keywordtype">double</span> &ll ) { |
155 | | <a name="l00224"></a>00224 mat temp ( <a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>(),N ); vec smp ( <a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ); |
156 | | <a name="l00225"></a>00225 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<N;i++ ) {smp=<a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>-><a class="code" href="classepdf.html#8019654e494bf5e458f6fb947e11b262" title="Returns a sample, from density .">sample</a>() ;temp.set_col ( i, smp );ll ( i ) =<a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>-><a class="code" href="classepdf.html#6aef3eca74899692503769c18add1a4c" title="Compute log-probability of argument val.">evalpdflog</a> ( smp );} |
157 | | <a name="l00226"></a>00226 <span class="keywordflow">return</span> temp; |
158 | | <a name="l00227"></a>00227 }; |
159 | | <a name="l00229"></a><a class="code" href="classmpdf.html#0f95a0cc6ab40611f46804682446ed83">00229</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmpdf.html#0f95a0cc6ab40611f46804682446ed83" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &cond ) {it_error ( <span class="stringliteral">"Not implemented"</span> );}; |
160 | | <a name="l00230"></a>00230 |
161 | | <a name="l00232"></a><a class="code" href="classmpdf.html#80b738ece5bd4f8c4edaee4b38906f91">00232</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classmpdf.html#80b738ece5bd4f8c4edaee4b38906f91" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evalcond</a> ( <span class="keyword">const</span> vec &dt, <span class="keyword">const</span> vec &cond ) {this-><a class="code" href="classmpdf.html#0f95a0cc6ab40611f46804682446ed83" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond );<span class="keywordflow">return</span> exp(<a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>-><a class="code" href="classepdf.html#6aef3eca74899692503769c18add1a4c" title="Compute log-probability of argument val.">evalpdflog</a> ( dt ));}; |
162 | | <a name="l00233"></a>00233 |
163 | | <a name="l00234"></a>00234 <span class="keyword">virtual</span> vec evalcond_m ( <span class="keyword">const</span> mat &Dt, <span class="keyword">const</span> vec &cond ) {this-><a class="code" href="classmpdf.html#0f95a0cc6ab40611f46804682446ed83" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond );<span class="keywordflow">return</span> exp(<a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>-><a class="code" href="classepdf.html#cebbdd7a85e6328f7358fc0ba8eee06c" title="Compute log-probability of multiple values argument val.">evalpdflog_m</a> ( Dt ));}; |
164 | | <a name="l00235"></a>00235 |
165 | | <a name="l00237"></a><a class="code" href="classmpdf.html#6788be9f3a888796499c5293a318fcfb">00237</a> <span class="keyword">virtual</span> <a class="code" href="classmpdf.html#6788be9f3a888796499c5293a318fcfb" title="Destructor for future use;.">~mpdf</a>() {}; |
166 | | <a name="l00238"></a>00238 |
167 | | <a name="l00240"></a><a class="code" href="classmpdf.html#581ecf362185d37c08bb31cb9d046d6f">00240</a> <a class="code" href="classmpdf.html#581ecf362185d37c08bb31cb9d046d6f" title="Default constructor.">mpdf</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc0 ) :<a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a> ( rv0 ),<a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab" title="random variable in condition">rvc</a> ( rvc0 ) {}; |
168 | | <a name="l00242"></a><a class="code" href="classmpdf.html#15ef062183b1ccdf794732d5fa0b77cd">00242</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classmpdf.html#15ef062183b1ccdf794732d5fa0b77cd" title="access function">_rvc</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab" title="random variable in condition">rvc</a>;} |
169 | | <a name="l00244"></a><a class="code" href="classmpdf.html#71256ffb5fbd08f41d650e606a5bd585">00244</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classmpdf.html#71256ffb5fbd08f41d650e606a5bd585" title="access function">_rv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>;} |
170 | | <a name="l00246"></a><a class="code" href="classmpdf.html#e17780ee5b2cfe05922a6c56af1462f8">00246</a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>& <a class="code" href="classmpdf.html#e17780ee5b2cfe05922a6c56af1462f8" title="access function">_epdf</a>() {<span class="keywordflow">return</span> *<a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>;} |
171 | | <a name="l00247"></a>00247 }; |
172 | | <a name="l00248"></a>00248 |
173 | | <a name="l00251"></a><a class="code" href="classdatalink__e2e.html">00251</a> <span class="keyword">class </span><a class="code" href="classdatalink__e2e.html">datalink_e2e</a> { |
174 | | <a name="l00252"></a>00252 <span class="keyword">protected</span>: |
175 | | <a name="l00254"></a><a class="code" href="classdatalink__e2e.html#3ce1d13efa0b133a4d202c11bd57d216">00254</a> <span class="keywordtype">int</span> <a class="code" href="classdatalink__e2e.html#3ce1d13efa0b133a4d202c11bd57d216" title="Remember how long val should be.">valsize</a>; |
176 | | <a name="l00256"></a><a class="code" href="classdatalink__e2e.html#db962bc6201d1ec12dce00d7c1a8b4f8">00256</a> <span class="keywordtype">int</span> <a class="code" href="classdatalink__e2e.html#db962bc6201d1ec12dce00d7c1a8b4f8" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a>; |
177 | | <a name="l00258"></a><a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae">00258</a> ivec <a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae" title="val-to-val link, indeces of the upper val">v2v_up</a>; |
178 | | <a name="l00259"></a>00259 <span class="keyword">public</span>: |
179 | | <a name="l00261"></a><a class="code" href="classdatalink__e2e.html#366d0aca52e56d4108f85390f87c1b9f">00261</a> <a class="code" href="classdatalink__e2e.html#366d0aca52e56d4108f85390f87c1b9f" title="Constructor.">datalink_e2e</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up ) : |
180 | | <a name="l00262"></a>00262 <a class="code" href="classdatalink__e2e.html#3ce1d13efa0b133a4d202c11bd57d216" title="Remember how long val should be.">valsize</a> ( rv.count() ), <a class="code" href="classdatalink__e2e.html#db962bc6201d1ec12dce00d7c1a8b4f8" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a> ( rv_up.count() ), <a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae" title="val-to-val link, indeces of the upper val">v2v_up</a> ( rv.dataind ( rv_up ) ) { |
181 | | <a name="l00263"></a>00263 it_assert_debug ( <a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae" title="val-to-val link, indeces of the upper val">v2v_up</a>.length() ==<a class="code" href="classdatalink__e2e.html#3ce1d13efa0b133a4d202c11bd57d216" title="Remember how long val should be.">valsize</a>,<span class="stringliteral">"rv is not fully in rv_up"</span> ); |
182 | | <a name="l00264"></a>00264 } |
183 | | <a name="l00266"></a><a class="code" href="classdatalink__e2e.html#1b114a76be7aa45bf33697e521fd041d">00266</a> vec <a class="code" href="classdatalink__e2e.html#1b114a76be7aa45bf33697e521fd041d" title="Get val for myself from val of &quot;Up&quot;.">get_val</a> ( <span class="keyword">const</span> vec &val_up ) {it_assert_debug ( <a class="code" href="classdatalink__e2e.html#db962bc6201d1ec12dce00d7c1a8b4f8" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); <span class="keywordflow">return</span> get_vec ( val_up,<a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae" title="val-to-val link, indeces of the upper val">v2v_up</a> );} |
184 | | <a name="l00268"></a><a class="code" href="classdatalink__e2e.html#1ee38edb1778e8900a8d7535c3b3f053">00268</a> <span class="keywordtype">void</span> <a class="code" href="classdatalink__e2e.html#1ee38edb1778e8900a8d7535c3b3f053" title="Fill val of &quot;Up&quot; by my pieces.">fill_val</a> ( vec &val_up, <span class="keyword">const</span> vec &val ) { |
185 | | <a name="l00269"></a>00269 it_assert_debug ( <a class="code" href="classdatalink__e2e.html#3ce1d13efa0b133a4d202c11bd57d216" title="Remember how long val should be.">valsize</a>==val.length(),<span class="stringliteral">"Wrong val"</span> ); |
186 | | <a name="l00270"></a>00270 it_assert_debug ( <a class="code" href="classdatalink__e2e.html#db962bc6201d1ec12dce00d7c1a8b4f8" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
187 | | <a name="l00271"></a>00271 set_subvector ( val_up, <a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae" title="val-to-val link, indeces of the upper val">v2v_up</a>, val ); |
| 152 | <a name="l00224"></a>00224 vec temp= <a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>-><a class="code" href="classepdf.html#8019654e494bf5e458f6fb947e11b262" title="Returns a sample, from density .">sample</a>(); |
| 153 | <a name="l00225"></a>00225 ll=<a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>-><a class="code" href="classepdf.html#e1996af1da1fa1214270066a96ca113e" title="Compute log-probability of argument val.">evallog</a> ( temp );<span class="keywordflow">return</span> temp; |
| 154 | <a name="l00226"></a>00226 }; |
| 155 | <a name="l00228"></a><a class="code" href="classmpdf.html#b1dae6171ee39a6a05976c7b1007a3c5">00228</a> <span class="keyword">virtual</span> mat <a class="code" href="classmpdf.html#b1dae6171ee39a6a05976c7b1007a3c5" title="Returns.">samplecond_m</a> ( <span class="keyword">const</span> vec &cond, vec &ll, <span class="keywordtype">int</span> N ) { |
| 156 | <a name="l00229"></a>00229 this-><a class="code" href="classmpdf.html#0f95a0cc6ab40611f46804682446ed83" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond ); |
| 157 | <a name="l00230"></a>00230 mat temp ( <a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>(),N ); vec smp ( <a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ); |
| 158 | <a name="l00231"></a>00231 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<N;i++ ) {smp=<a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>-><a class="code" href="classepdf.html#8019654e494bf5e458f6fb947e11b262" title="Returns a sample, from density .">sample</a>() ;temp.set_col ( i, smp );ll ( i ) =<a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>-><a class="code" href="classepdf.html#e1996af1da1fa1214270066a96ca113e" title="Compute log-probability of argument val.">evallog</a> ( smp );} |
| 159 | <a name="l00232"></a>00232 <span class="keywordflow">return</span> temp; |
| 160 | <a name="l00233"></a>00233 }; |
| 161 | <a name="l00235"></a><a class="code" href="classmpdf.html#0f95a0cc6ab40611f46804682446ed83">00235</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classmpdf.html#0f95a0cc6ab40611f46804682446ed83" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &cond ) {it_error ( <span class="stringliteral">"Not implemented"</span> );}; |
| 162 | <a name="l00236"></a>00236 |
| 163 | <a name="l00238"></a><a class="code" href="classmpdf.html#2ef8a6374029d990a678782f6decebbe">00238</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classmpdf.html#2ef8a6374029d990a678782f6decebbe" 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 ) {<span class="keywordtype">double</span> tmp; this-><a class="code" href="classmpdf.html#0f95a0cc6ab40611f46804682446ed83" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond );tmp = <a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>-><a class="code" href="classepdf.html#e1996af1da1fa1214270066a96ca113e" title="Compute log-probability of argument val.">evallog</a> ( dt ); it_assert_debug(std::isfinite(tmp),<span class="stringliteral">"Infinite value"</span>); <span class="keywordflow">return</span> tmp; |
| 164 | <a name="l00239"></a>00239 }; |
| 165 | <a name="l00240"></a>00240 |
| 166 | <a name="l00242"></a><a class="code" href="classmpdf.html#95fcff214848f66f1b489459370573fa">00242</a> <span class="keyword">virtual</span> vec <a class="code" href="classmpdf.html#95fcff214848f66f1b489459370573fa" title="Matrix version of evallogcond.">evallogcond_m</a> ( <span class="keyword">const</span> mat &Dt, <span class="keyword">const</span> vec &cond ) {this-><a class="code" href="classmpdf.html#0f95a0cc6ab40611f46804682446ed83" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( cond );<span class="keywordflow">return</span> <a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>-><a class="code" href="classepdf.html#2495a04bbacb9b55fe5a3a59b78affca" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( Dt );}; |
| 167 | <a name="l00243"></a>00243 |
| 168 | <a name="l00245"></a><a class="code" href="classmpdf.html#6788be9f3a888796499c5293a318fcfb">00245</a> <span class="keyword">virtual</span> <a class="code" href="classmpdf.html#6788be9f3a888796499c5293a318fcfb" title="Destructor for future use;.">~mpdf</a>() {}; |
| 169 | <a name="l00246"></a>00246 |
| 170 | <a name="l00248"></a><a class="code" href="classmpdf.html#581ecf362185d37c08bb31cb9d046d6f">00248</a> <a class="code" href="classmpdf.html#581ecf362185d37c08bb31cb9d046d6f" title="Default constructor.">mpdf</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc0 ) :<a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a> ( rv0 ),<a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab" title="random variable in condition">rvc</a> ( rvc0 ) {}; |
| 171 | <a name="l00250"></a><a class="code" href="classmpdf.html#15ef062183b1ccdf794732d5fa0b77cd">00250</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classmpdf.html#15ef062183b1ccdf794732d5fa0b77cd" title="access function">_rvc</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab" title="random variable in condition">rvc</a>;} |
| 172 | <a name="l00252"></a><a class="code" href="classmpdf.html#71256ffb5fbd08f41d650e606a5bd585">00252</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classmpdf.html#71256ffb5fbd08f41d650e606a5bd585" title="access function">_rv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>;} |
| 173 | <a name="l00254"></a><a class="code" href="classmpdf.html#e17780ee5b2cfe05922a6c56af1462f8">00254</a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>& <a class="code" href="classmpdf.html#e17780ee5b2cfe05922a6c56af1462f8" title="access function">_epdf</a>() {<span class="keywordflow">return</span> *<a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>;} |
| 174 | <a name="l00255"></a>00255 }; |
| 175 | <a name="l00256"></a>00256 |
| 176 | <a name="l00259"></a><a class="code" href="classdatalink__e2e.html">00259</a> <span class="keyword">class </span><a class="code" href="classdatalink__e2e.html">datalink_e2e</a> { |
| 177 | <a name="l00260"></a>00260 <span class="keyword">protected</span>: |
| 178 | <a name="l00262"></a><a class="code" href="classdatalink__e2e.html#3ce1d13efa0b133a4d202c11bd57d216">00262</a> <span class="keywordtype">int</span> <a class="code" href="classdatalink__e2e.html#3ce1d13efa0b133a4d202c11bd57d216" title="Remember how long val should be.">valsize</a>; |
| 179 | <a name="l00264"></a><a class="code" href="classdatalink__e2e.html#db962bc6201d1ec12dce00d7c1a8b4f8">00264</a> <span class="keywordtype">int</span> <a class="code" href="classdatalink__e2e.html#db962bc6201d1ec12dce00d7c1a8b4f8" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a>; |
| 180 | <a name="l00266"></a><a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae">00266</a> ivec <a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae" title="val-to-val link, indeces of the upper val">v2v_up</a>; |
| 181 | <a name="l00267"></a>00267 <span class="keyword">public</span>: |
| 182 | <a name="l00269"></a><a class="code" href="classdatalink__e2e.html#366d0aca52e56d4108f85390f87c1b9f">00269</a> <a class="code" href="classdatalink__e2e.html#366d0aca52e56d4108f85390f87c1b9f" title="Constructor.">datalink_e2e</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up ) : |
| 183 | <a name="l00270"></a>00270 <a class="code" href="classdatalink__e2e.html#3ce1d13efa0b133a4d202c11bd57d216" title="Remember how long val should be.">valsize</a> ( rv.count() ), <a class="code" href="classdatalink__e2e.html#db962bc6201d1ec12dce00d7c1a8b4f8" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a> ( rv_up.count() ), <a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae" title="val-to-val link, indeces of the upper val">v2v_up</a> ( rv.dataind ( rv_up ) ) { |
| 184 | <a name="l00271"></a>00271 it_assert_debug ( <a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae" title="val-to-val link, indeces of the upper val">v2v_up</a>.length() ==<a class="code" href="classdatalink__e2e.html#3ce1d13efa0b133a4d202c11bd57d216" title="Remember how long val should be.">valsize</a>,<span class="stringliteral">"rv is not fully in rv_up"</span> ); |
189 | | <a name="l00273"></a>00273 }; |
190 | | <a name="l00274"></a>00274 |
191 | | <a name="l00276"></a><a class="code" href="classdatalink__m2e.html">00276</a> <span class="keyword">class </span><a class="code" href="classdatalink__m2e.html" title="data link between">datalink_m2e</a>: <span class="keyword">public</span> <a class="code" href="classdatalink__e2e.html">datalink_e2e</a> { |
192 | | <a name="l00277"></a>00277 <span class="keyword">protected</span>: |
193 | | <a name="l00279"></a><a class="code" href="classdatalink__m2e.html#b3927998b71fce3ab030eba1c3c3cec3">00279</a> <span class="keywordtype">int</span> <a class="code" href="classdatalink__m2e.html#b3927998b71fce3ab030eba1c3c3cec3" title="Remember how long cond should be.">condsize</a>; |
194 | | <a name="l00281"></a><a class="code" href="classdatalink__m2e.html#6b46f983c46621b6bfe2b5da3d467d2a">00281</a> ivec <a class="code" href="classdatalink__m2e.html#6b46f983c46621b6bfe2b5da3d467d2a" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a>; |
195 | | <a name="l00283"></a><a class="code" href="classdatalink__m2e.html#29604fb622b6a319d2d5d2709fe01f28">00283</a> ivec <a class="code" href="classdatalink__m2e.html#29604fb622b6a319d2d5d2709fe01f28" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>; |
196 | | <a name="l00284"></a>00284 |
197 | | <a name="l00285"></a>00285 <span class="keyword">public</span>: |
198 | | <a name="l00287"></a><a class="code" href="classdatalink__m2e.html#ff8f6e8a974e22ced461b232fadbdce0">00287</a> <a class="code" href="classdatalink__m2e.html#ff8f6e8a974e22ced461b232fadbdce0" title="Constructor.">datalink_m2e</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up ) : |
199 | | <a name="l00288"></a>00288 <a class="code" href="classdatalink__e2e.html">datalink_e2e</a> ( rv,rv_up ), <a class="code" href="classdatalink__m2e.html#b3927998b71fce3ab030eba1c3c3cec3" title="Remember how long cond should be.">condsize</a> ( rvc.count() ) { |
200 | | <a name="l00289"></a>00289 <span class="comment">//establish v2c connection</span> |
201 | | <a name="l00290"></a>00290 rvc.<a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( rv_up, <a class="code" href="classdatalink__m2e.html#29604fb622b6a319d2d5d2709fe01f28" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>, <a class="code" href="classdatalink__m2e.html#6b46f983c46621b6bfe2b5da3d467d2a" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a> ); |
202 | | <a name="l00291"></a>00291 } |
203 | | <a name="l00293"></a><a class="code" href="classdatalink__m2e.html#6db351e5e2158791e97144d212844084">00293</a> vec <a class="code" href="classdatalink__m2e.html#6db351e5e2158791e97144d212844084" title="Construct condition.">get_cond</a> ( <span class="keyword">const</span> vec &val_up ) { |
204 | | <a name="l00294"></a>00294 vec tmp ( <a class="code" href="classdatalink__m2e.html#b3927998b71fce3ab030eba1c3c3cec3" title="Remember how long cond should be.">condsize</a> ); |
205 | | <a name="l00295"></a>00295 set_subvector ( tmp,<a class="code" href="classdatalink__m2e.html#29604fb622b6a319d2d5d2709fe01f28" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>,val_up ( <a class="code" href="classdatalink__m2e.html#6b46f983c46621b6bfe2b5da3d467d2a" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a> ) ); |
206 | | <a name="l00296"></a>00296 <span class="keywordflow">return</span> tmp; |
207 | | <a name="l00297"></a>00297 } |
208 | | <a name="l00298"></a>00298 <span class="keywordtype">void</span> fill_val_cond ( vec &val_up, <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ) { |
209 | | <a name="l00299"></a>00299 it_assert_debug ( <a class="code" href="classdatalink__e2e.html#3ce1d13efa0b133a4d202c11bd57d216" title="Remember how long val should be.">valsize</a>==val.length(),<span class="stringliteral">"Wrong val"</span> ); |
210 | | <a name="l00300"></a>00300 it_assert_debug ( <a class="code" href="classdatalink__e2e.html#db962bc6201d1ec12dce00d7c1a8b4f8" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
211 | | <a name="l00301"></a>00301 set_subvector ( val_up, <a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae" title="val-to-val link, indeces of the upper val">v2v_up</a>, val ); |
212 | | <a name="l00302"></a>00302 set_subvector ( val_up, <a class="code" href="classdatalink__m2e.html#6b46f983c46621b6bfe2b5da3d467d2a" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a>, cond ); |
213 | | <a name="l00303"></a>00303 } |
214 | | <a name="l00304"></a>00304 }; |
215 | | <a name="l00307"></a><a class="code" href="classdatalink__m2m.html">00307</a> <span class="keyword">class </span><a class="code" href="classdatalink__m2m.html">datalink_m2m</a>: <span class="keyword">public</span> <a class="code" href="classdatalink__m2e.html" title="data link between">datalink_m2e</a> { |
216 | | <a name="l00308"></a>00308 <span class="keyword">protected</span>: |
217 | | <a name="l00310"></a><a class="code" href="classdatalink__m2m.html#d1044bf4846f878290100429600273b2">00310</a> ivec <a class="code" href="classdatalink__m2m.html#d1044bf4846f878290100429600273b2" title="cond-to-cond link, indeces of the upper cond">c2c_up</a>; |
218 | | <a name="l00312"></a><a class="code" href="classdatalink__m2m.html#056193d459cd5e5fd323b5cbc6a55bad">00312</a> ivec <a class="code" href="classdatalink__m2m.html#056193d459cd5e5fd323b5cbc6a55bad" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>; |
219 | | <a name="l00313"></a>00313 <span class="keyword">public</span>: |
220 | | <a name="l00315"></a><a class="code" href="classdatalink__m2m.html#bd64962e779b6dd89529046245a8a98d">00315</a> <a class="code" href="classdatalink__m2m.html#bd64962e779b6dd89529046245a8a98d" title="Constructor.">datalink_m2m</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc_up ) : |
221 | | <a name="l00316"></a>00316 <a class="code" href="classdatalink__m2e.html" title="data link between">datalink_m2e</a> ( rv, rvc, rv_up) { |
222 | | <a name="l00317"></a>00317 <span class="comment">//establish c2c connection</span> |
223 | | <a name="l00318"></a>00318 rvc.<a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( rvc_up, <a class="code" href="classdatalink__m2m.html#056193d459cd5e5fd323b5cbc6a55bad" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>, <a class="code" href="classdatalink__m2m.html#d1044bf4846f878290100429600273b2" title="cond-to-cond link, indeces of the upper cond">c2c_up</a> ); |
224 | | <a name="l00319"></a>00319 it_assert_debug(<a class="code" href="classdatalink__m2m.html#056193d459cd5e5fd323b5cbc6a55bad" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>.length()+<a class="code" href="classdatalink__m2e.html#29604fb622b6a319d2d5d2709fe01f28" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>.length()==<a class="code" href="classdatalink__m2e.html#b3927998b71fce3ab030eba1c3c3cec3" title="Remember how long cond should be.">condsize</a>, <span class="stringliteral">"cond is not fully given"</span>); |
225 | | <a name="l00320"></a>00320 } |
226 | | <a name="l00322"></a><a class="code" href="classdatalink__m2m.html#51dd05760f99282a1da5f51eb88e7e42">00322</a> vec <a class="code" href="classdatalink__m2m.html#51dd05760f99282a1da5f51eb88e7e42" 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 ) { |
227 | | <a name="l00323"></a>00323 vec tmp ( <a class="code" href="classdatalink__m2e.html#b3927998b71fce3ab030eba1c3c3cec3" title="Remember how long cond should be.">condsize</a> ); |
228 | | <a name="l00324"></a>00324 set_subvector ( tmp,<a class="code" href="classdatalink__m2e.html#29604fb622b6a319d2d5d2709fe01f28" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>,val_up ( <a class="code" href="classdatalink__m2e.html#6b46f983c46621b6bfe2b5da3d467d2a" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a> ) ); |
229 | | <a name="l00325"></a>00325 set_subvector ( tmp,<a class="code" href="classdatalink__m2m.html#056193d459cd5e5fd323b5cbc6a55bad" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>,cond_up ( <a class="code" href="classdatalink__m2m.html#d1044bf4846f878290100429600273b2" title="cond-to-cond link, indeces of the upper cond">c2c_up</a> ) ); |
230 | | <a name="l00326"></a>00326 <span class="keywordflow">return</span> tmp; |
231 | | <a name="l00327"></a>00327 } |
232 | | <a name="l00329"></a>00329 |
233 | | <a name="l00330"></a>00330 }; |
234 | | <a name="l00331"></a>00331 |
235 | | <a name="l00335"></a><a class="code" href="classmepdf.html">00335</a> <span class="keyword">class </span><a class="code" href="classmepdf.html" title="Unconditional mpdf, allows using epdf in the role of mpdf.">mepdf</a> : <span class="keyword">public</span> <a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> { |
236 | | <a name="l00336"></a>00336 <span class="keyword">public</span>: |
237 | | <a name="l00338"></a><a class="code" href="classmepdf.html#0f39973ffd94c1e20e2d8aacc4adc6fa">00338</a> <a class="code" href="classmepdf.html#0f39973ffd94c1e20e2d8aacc4adc6fa" title="Default constructor.">mepdf</a> (<span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* em ) :<a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> ( em-><a class="code" href="classmpdf.html#71256ffb5fbd08f41d650e606a5bd585" title="access function">_rv</a>(),<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a>() ) {<a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>=<span class="keyword">const_cast<</span><a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>*<span class="keyword">></span>(em);}; |
238 | | <a name="l00339"></a><a class="code" href="classmepdf.html#bc87d89dbc3cf5eb6a0ad7d6d572488f">00339</a> <span class="keywordtype">void</span> <a class="code" href="classmepdf.html#bc87d89dbc3cf5eb6a0ad7d6d572488f" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &cond ) {} |
239 | | <a name="l00340"></a>00340 }; |
240 | | <a name="l00341"></a>00341 |
241 | | <a name="l00344"></a><a class="code" href="classcompositepdf.html">00344</a> <span class="keyword">class </span><a class="code" href="classcompositepdf.html" title="Abstract composition of pdfs, a base for specific classes this abstract class is...">compositepdf</a> { |
242 | | <a name="l00345"></a>00345 <span class="keyword">protected</span>: |
243 | | <a name="l00347"></a><a class="code" href="classcompositepdf.html#c1646fe41ff5934d010e54ccaa46133f">00347</a> <span class="keywordtype">int</span> <a class="code" href="classcompositepdf.html#c1646fe41ff5934d010e54ccaa46133f" title="Number of mpdfs in the composite.">n</a>; |
244 | | <a name="l00349"></a><a class="code" href="classcompositepdf.html#637877061b917a16a0421bb5c4cd480d">00349</a> Array<mpdf*> <a class="code" href="classcompositepdf.html#637877061b917a16a0421bb5c4cd480d" title="Elements of composition.">mpdfs</a>; |
245 | | <a name="l00350"></a>00350 <span class="keyword">public</span>: |
246 | | <a name="l00351"></a>00351 <a class="code" href="classcompositepdf.html" title="Abstract composition of pdfs, a base for specific classes this abstract class is...">compositepdf</a> ( Array<mpdf*> A0 ) : <a class="code" href="classcompositepdf.html#c1646fe41ff5934d010e54ccaa46133f" title="Number of mpdfs in the composite.">n</a> ( A0.length() ), <a class="code" href="classcompositepdf.html#637877061b917a16a0421bb5c4cd480d" title="Elements of composition.">mpdfs</a> ( A0 ) {}; |
247 | | <a name="l00353"></a>00353 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classcompositepdf.html#635d219fb3e32852400d6f98aa4bdc93" title="find common rv, flag">getrv</a> ( <span class="keywordtype">bool</span> checkoverlap=<span class="keyword">false</span> ); |
248 | | <a name="l00355"></a>00355 <span class="keywordtype">void</span> <a class="code" href="classcompositepdf.html#5a4479785c1fdb2cc351fbea07b899ac" title="common rvc of all mpdfs is written to rvc">setrvc</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc ); |
249 | | <a name="l00356"></a>00356 }; |
250 | | <a name="l00357"></a>00357 |
251 | | <a name="l00365"></a><a class="code" href="classDS.html">00365</a> <span class="keyword">class </span><a class="code" href="classDS.html" title="Abstract class for discrete-time sources of data.">DS</a> { |
252 | | <a name="l00366"></a>00366 <span class="keyword">protected</span>: |
253 | | <a name="l00368"></a><a class="code" href="classDS.html#1012025a1a3a1fdd24aa48698a3d3454">00368</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classDS.html#1012025a1a3a1fdd24aa48698a3d3454" title="Observed variables, returned by getdata().">Drv</a>; |
254 | | <a name="l00370"></a><a class="code" href="classDS.html#0a88ffaeb3c7c2cf30c69bc41a000629">00370</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classDS.html#0a88ffaeb3c7c2cf30c69bc41a000629" title="Action variables, accepted by write().">Urv</a>; <span class="comment">//</span> |
255 | | <a name="l00371"></a>00371 <span class="keyword">public</span>: |
256 | | <a name="l00373"></a>00373 <span class="keywordtype">void</span> <a class="code" href="classDS.html#db2dacc9e71a36eeb9c5c2ee402eeeb1" title="Returns full vector of observed data.">getdata</a> ( vec &dt ); |
257 | | <a name="l00375"></a>00375 <span class="keywordtype">void</span> <a class="code" href="classDS.html#db2dacc9e71a36eeb9c5c2ee402eeeb1" title="Returns full vector of observed data.">getdata</a> ( vec &dt, ivec &indeces ); |
258 | | <a name="l00377"></a>00377 <span class="keywordtype">void</span> <a class="code" href="classDS.html#0dfb6788b70c0d48a1f5276ed6c93039" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut ); |
259 | | <a name="l00379"></a>00379 <span class="keywordtype">void</span> <a class="code" href="classDS.html#0dfb6788b70c0d48a1f5276ed6c93039" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut, ivec &indeces ); |
260 | | <a name="l00385"></a>00385 <span class="keywordtype">void</span> <a class="code" href="classDS.html#9a35ca9c9321dce2bf63bf668f785b75" title="Method that assigns random variables to the datasource. Typically, the datasource...">linkrvs</a> ( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &drv, <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &urv ); |
261 | | <a name="l00386"></a>00386 |
262 | | <a name="l00388"></a>00388 <span class="keywordtype">void</span> <a class="code" href="classDS.html#470ba89e8e7c3c4d830803221b4e9be6" title="Moves from to , i.e. perfroms the actions and reads response of the system.">step</a>(); |
263 | | <a name="l00389"></a>00389 |
264 | | <a name="l00390"></a>00390 }; |
265 | | <a name="l00391"></a>00391 |
266 | | <a name="l00396"></a><a class="code" href="classBM.html">00396</a> <span class="keyword">class </span><a class="code" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a> { |
267 | | <a name="l00397"></a>00397 <span class="keyword">protected</span>: |
268 | | <a name="l00399"></a><a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88">00399</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a>; |
269 | | <a name="l00401"></a><a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979">00401</a> <span class="keywordtype">double</span> <a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a>; |
270 | | <a name="l00403"></a><a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129">00403</a> <span class="keywordtype">bool</span> <a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>; |
271 | | <a name="l00404"></a>00404 <span class="keyword">public</span>: |
272 | | <a name="l00405"></a>00405 |
273 | | <a name="l00407"></a><a class="code" href="classBM.html#43d2ad6a6c9f1bcd22fe8906c477e50e">00407</a> <a class="code" href="classBM.html#43d2ad6a6c9f1bcd22fe8906c477e50e" title="Default constructor.">BM</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv0, <span class="keywordtype">double</span> ll0=0,<span class="keywordtype">bool</span> evalll0=<span class="keyword">true</span> ) :<a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a> ( rv0 ), <a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a> ( ll0 ),<a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( evalll0 ) {<span class="comment">//Fixme: test rv</span> |
274 | | <a name="l00408"></a>00408 }; |
275 | | <a name="l00410"></a><a class="code" href="classBM.html#e8fc5fae042f2b46d4d3827f9587d47d">00410</a> <a class="code" href="classBM.html#43d2ad6a6c9f1bcd22fe8906c477e50e" title="Default constructor.">BM</a> ( <span class="keyword">const</span> <a class="code" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a> &B ) : <a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a> ( B.<a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a> ), <a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a> ( B.<a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a> ), <a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( B.<a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {} |
276 | | <a name="l00411"></a>00411 |
277 | | <a name="l00415"></a>00415 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBM.html#a892eff438aab2dd1a9e2efcb7fb5bdf" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &dt ) = 0; |
278 | | <a name="l00417"></a>00417 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBM.html#0186270f75189677f390fe088a9947e9" title="Batch Bayes rule (columns of Dt are observations).">bayesB</a> ( <span class="keyword">const</span> mat &Dt ); |
279 | | <a name="l00419"></a>00419 <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>& <a class="code" href="classBM.html#8554809fec160bee279bcd5fa14ead5c" title="Returns a reference to the epdf representing posterior density on parameters.">_epdf</a>() <span class="keyword">const</span> =0; |
280 | | <a name="l00420"></a>00420 |
281 | | <a name="l00422"></a>00422 <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classBM.html#db500c4836f883c175a3cf3ab5a3ce24" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_e</a>() <span class="keyword">const</span> =0; |
282 | | <a name="l00423"></a>00423 |
283 | | <a name="l00426"></a><a class="code" href="classBM.html#8a8ce6df431689964c41cc6c849cfd06">00426</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classBM.html#8a8ce6df431689964c41cc6c849cfd06">logpred</a> ( <span class="keyword">const</span> vec &dt )<span class="keyword"> const</span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0.0;} |
284 | | <a name="l00428"></a><a class="code" href="classBM.html#cd0660f2a1a344b56ac39802708ff165">00428</a> vec <a class="code" href="classBM.html#cd0660f2a1a344b56ac39802708ff165" title="Matrix version of logpred.">logpred_m</a> ( <span class="keyword">const</span> mat &dt )<span class="keyword"> const</span>{vec tmp ( dt.cols() );<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<dt.cols();i++ ) {tmp ( i ) =<a class="code" href="classBM.html#8a8ce6df431689964c41cc6c849cfd06">logpred</a> ( dt.get_col ( i ) );}<span class="keywordflow">return</span> tmp;} |
285 | | <a name="l00429"></a>00429 |
286 | | <a name="l00431"></a><a class="code" href="classBM.html#5594d68ee9aa6fc8c1e79019da5c9d56">00431</a> <span class="keyword">virtual</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classBM.html#5594d68ee9aa6fc8c1e79019da5c9d56" title="Constructs a predictive density (marginal density on data).">predictor</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a> )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> NULL;}; |
287 | | <a name="l00432"></a>00432 |
288 | | <a name="l00434"></a><a class="code" href="classBM.html#ca0f02b3b4144e0895cc14f7e0374bdd">00434</a> <span class="keyword">virtual</span> <a class="code" href="classBM.html#ca0f02b3b4144e0895cc14f7e0374bdd" title="Destructor for future use;.">~BM</a>() {}; |
289 | | <a name="l00436"></a><a class="code" href="classBM.html#126bd2595c48e311fc2a7ab72876092a">00436</a> <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classBM.html#126bd2595c48e311fc2a7ab72876092a" title="access function">_rv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a>;} |
290 | | <a name="l00438"></a><a class="code" href="classBM.html#87f4a547d2c29180be88175e5eab9c88">00438</a> <span class="keywordtype">double</span> <a class="code" href="classBM.html#87f4a547d2c29180be88175e5eab9c88" title="access function">_ll</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a>;} |
291 | | <a name="l00440"></a><a class="code" href="classBM.html#1ffa9f23669aabecc3760c06c6987522">00440</a> <span class="keywordtype">void</span> <a class="code" href="classBM.html#1ffa9f23669aabecc3760c06c6987522" title="access function">set_evalll</a> ( <span class="keywordtype">bool</span> evl0 ) {<a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>=evl0;} |
292 | | <a name="l00441"></a>00441 |
293 | | <a name="l00444"></a><a class="code" href="classBM.html#eb58c81d6a7b75b05fc6f276eed78887">00444</a> <span class="keyword">virtual</span> <a class="code" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a>* <a class="code" href="classBM.html#eb58c81d6a7b75b05fc6f276eed78887">_copy_</a> ( <span class="keywordtype">bool</span> changerv=<span class="keyword">false</span> ) {it_error ( <span class="stringliteral">"function _copy_ not implemented for this BM"</span> ); <span class="keywordflow">return</span> NULL;}; |
294 | | <a name="l00445"></a>00445 }; |
295 | | <a name="l00446"></a>00446 |
296 | | <a name="l00456"></a><a class="code" href="classBMcond.html">00456</a> <span class="keyword">class </span><a class="code" href="classBMcond.html" title="Conditional Bayesian Filter.">BMcond</a> { |
297 | | <a name="l00457"></a>00457 <span class="keyword">protected</span>: |
298 | | <a name="l00459"></a><a class="code" href="classBMcond.html#9ba793c8ec453f04d372d17195ed8dec">00459</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classBMcond.html#9ba793c8ec453f04d372d17195ed8dec" title="Identificator of the conditioning variable.">rvc</a>; |
299 | | <a name="l00460"></a>00460 <span class="keyword">public</span>: |
300 | | <a name="l00462"></a>00462 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBMcond.html#3543cfe274c35f9033c24d8036a96c4d" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &val ) =0; |
301 | | <a name="l00464"></a><a class="code" href="classBMcond.html#9a38dcdabef902fd91da3c9fb6ac27f7">00464</a> <a class="code" href="classBMcond.html#9a38dcdabef902fd91da3c9fb6ac27f7" title="Default constructor.">BMcond</a> ( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv0 ) :<a class="code" href="classBMcond.html#9ba793c8ec453f04d372d17195ed8dec" title="Identificator of the conditioning variable.">rvc</a> ( rv0 ) {}; |
302 | | <a name="l00466"></a><a class="code" href="classBMcond.html#d40c72250cf93640f982d06de20815b2">00466</a> <span class="keyword">virtual</span> <a class="code" href="classBMcond.html#d40c72250cf93640f982d06de20815b2" title="Destructor for future use.">~BMcond</a>() {}; |
303 | | <a name="l00468"></a><a class="code" href="classBMcond.html#3fa60348b2da6b4208bb95b8d146900a">00468</a> <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classBMcond.html#3fa60348b2da6b4208bb95b8d146900a" title="access function">_rvc</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classBMcond.html#9ba793c8ec453f04d372d17195ed8dec" title="Identificator of the conditioning variable.">rvc</a>;} |
304 | | <a name="l00469"></a>00469 }; |
305 | | <a name="l00470"></a>00470 |
306 | | <a name="l00471"></a>00471 <span class="preprocessor">#endif // BM_H</span> |
| 186 | <a name="l00274"></a><a class="code" href="classdatalink__e2e.html#1b114a76be7aa45bf33697e521fd041d">00274</a> vec <a class="code" href="classdatalink__e2e.html#1b114a76be7aa45bf33697e521fd041d" title="Get val for myself from val of &quot;Up&quot;.">get_val</a> ( <span class="keyword">const</span> vec &val_up ) {it_assert_debug ( <a class="code" href="classdatalink__e2e.html#db962bc6201d1ec12dce00d7c1a8b4f8" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); <span class="keywordflow">return</span> get_vec ( val_up,<a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae" title="val-to-val link, indeces of the upper val">v2v_up</a> );} |
| 187 | <a name="l00276"></a><a class="code" href="classdatalink__e2e.html#1ee38edb1778e8900a8d7535c3b3f053">00276</a> <span class="keywordtype">void</span> <a class="code" href="classdatalink__e2e.html#1ee38edb1778e8900a8d7535c3b3f053" title="Fill val of &quot;Up&quot; by my pieces.">fill_val</a> ( vec &val_up, <span class="keyword">const</span> vec &val ) { |
| 188 | <a name="l00277"></a>00277 it_assert_debug ( <a class="code" href="classdatalink__e2e.html#3ce1d13efa0b133a4d202c11bd57d216" title="Remember how long val should be.">valsize</a>==val.length(),<span class="stringliteral">"Wrong val"</span> ); |
| 189 | <a name="l00278"></a>00278 it_assert_debug ( <a class="code" href="classdatalink__e2e.html#db962bc6201d1ec12dce00d7c1a8b4f8" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
| 190 | <a name="l00279"></a>00279 set_subvector ( val_up, <a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae" title="val-to-val link, indeces of the upper val">v2v_up</a>, val ); |
| 191 | <a name="l00280"></a>00280 } |
| 192 | <a name="l00281"></a>00281 }; |
| 193 | <a name="l00282"></a>00282 |
| 194 | <a name="l00284"></a><a class="code" href="classdatalink__m2e.html">00284</a> <span class="keyword">class </span><a class="code" href="classdatalink__m2e.html" title="data link between">datalink_m2e</a>: <span class="keyword">public</span> <a class="code" href="classdatalink__e2e.html">datalink_e2e</a> { |
| 195 | <a name="l00285"></a>00285 <span class="keyword">protected</span>: |
| 196 | <a name="l00287"></a><a class="code" href="classdatalink__m2e.html#b3927998b71fce3ab030eba1c3c3cec3">00287</a> <span class="keywordtype">int</span> <a class="code" href="classdatalink__m2e.html#b3927998b71fce3ab030eba1c3c3cec3" title="Remember how long cond should be.">condsize</a>; |
| 197 | <a name="l00289"></a><a class="code" href="classdatalink__m2e.html#6b46f983c46621b6bfe2b5da3d467d2a">00289</a> ivec <a class="code" href="classdatalink__m2e.html#6b46f983c46621b6bfe2b5da3d467d2a" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a>; |
| 198 | <a name="l00291"></a><a class="code" href="classdatalink__m2e.html#29604fb622b6a319d2d5d2709fe01f28">00291</a> ivec <a class="code" href="classdatalink__m2e.html#29604fb622b6a319d2d5d2709fe01f28" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>; |
| 199 | <a name="l00292"></a>00292 |
| 200 | <a name="l00293"></a>00293 <span class="keyword">public</span>: |
| 201 | <a name="l00295"></a><a class="code" href="classdatalink__m2e.html#ff8f6e8a974e22ced461b232fadbdce0">00295</a> <a class="code" href="classdatalink__m2e.html#ff8f6e8a974e22ced461b232fadbdce0" title="Constructor.">datalink_m2e</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up ) : |
| 202 | <a name="l00296"></a>00296 <a class="code" href="classdatalink__e2e.html">datalink_e2e</a> ( rv,rv_up ), <a class="code" href="classdatalink__m2e.html#b3927998b71fce3ab030eba1c3c3cec3" title="Remember how long cond should be.">condsize</a> ( rvc.count() ) { |
| 203 | <a name="l00297"></a>00297 <span class="comment">//establish v2c connection</span> |
| 204 | <a name="l00298"></a>00298 rvc.<a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( rv_up, <a class="code" href="classdatalink__m2e.html#29604fb622b6a319d2d5d2709fe01f28" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>, <a class="code" href="classdatalink__m2e.html#6b46f983c46621b6bfe2b5da3d467d2a" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a> ); |
| 205 | <a name="l00299"></a>00299 } |
| 206 | <a name="l00301"></a><a class="code" href="classdatalink__m2e.html#6db351e5e2158791e97144d212844084">00301</a> vec <a class="code" href="classdatalink__m2e.html#6db351e5e2158791e97144d212844084" title="Construct condition.">get_cond</a> ( <span class="keyword">const</span> vec &val_up ) { |
| 207 | <a name="l00302"></a>00302 vec tmp ( <a class="code" href="classdatalink__m2e.html#b3927998b71fce3ab030eba1c3c3cec3" title="Remember how long cond should be.">condsize</a> ); |
| 208 | <a name="l00303"></a>00303 set_subvector ( tmp,<a class="code" href="classdatalink__m2e.html#29604fb622b6a319d2d5d2709fe01f28" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>,val_up ( <a class="code" href="classdatalink__m2e.html#6b46f983c46621b6bfe2b5da3d467d2a" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a> ) ); |
| 209 | <a name="l00304"></a>00304 <span class="keywordflow">return</span> tmp; |
| 210 | <a name="l00305"></a>00305 } |
| 211 | <a name="l00306"></a>00306 <span class="keywordtype">void</span> fill_val_cond ( vec &val_up, <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ) { |
| 212 | <a name="l00307"></a>00307 it_assert_debug ( <a class="code" href="classdatalink__e2e.html#3ce1d13efa0b133a4d202c11bd57d216" title="Remember how long val should be.">valsize</a>==val.length(),<span class="stringliteral">"Wrong val"</span> ); |
| 213 | <a name="l00308"></a>00308 it_assert_debug ( <a class="code" href="classdatalink__e2e.html#db962bc6201d1ec12dce00d7c1a8b4f8" title="Remember how long val of &quot;Up&quot; should be.">valupsize</a>==val_up.length(),<span class="stringliteral">"Wrong val_up"</span> ); |
| 214 | <a name="l00309"></a>00309 set_subvector ( val_up, <a class="code" href="classdatalink__e2e.html#d4c3a76395b46d9d901eb232aacdafae" title="val-to-val link, indeces of the upper val">v2v_up</a>, val ); |
| 215 | <a name="l00310"></a>00310 set_subvector ( val_up, <a class="code" href="classdatalink__m2e.html#6b46f983c46621b6bfe2b5da3d467d2a" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a>, cond ); |
| 216 | <a name="l00311"></a>00311 } |
| 217 | <a name="l00312"></a>00312 }; |
| 218 | <a name="l00315"></a><a class="code" href="classdatalink__m2m.html">00315</a> <span class="keyword">class </span><a class="code" href="classdatalink__m2m.html">datalink_m2m</a>: <span class="keyword">public</span> <a class="code" href="classdatalink__m2e.html" title="data link between">datalink_m2e</a> { |
| 219 | <a name="l00316"></a>00316 <span class="keyword">protected</span>: |
| 220 | <a name="l00318"></a><a class="code" href="classdatalink__m2m.html#d1044bf4846f878290100429600273b2">00318</a> ivec <a class="code" href="classdatalink__m2m.html#d1044bf4846f878290100429600273b2" title="cond-to-cond link, indeces of the upper cond">c2c_up</a>; |
| 221 | <a name="l00320"></a><a class="code" href="classdatalink__m2m.html#056193d459cd5e5fd323b5cbc6a55bad">00320</a> ivec <a class="code" href="classdatalink__m2m.html#056193d459cd5e5fd323b5cbc6a55bad" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>; |
| 222 | <a name="l00321"></a>00321 <span class="keyword">public</span>: |
| 223 | <a name="l00323"></a><a class="code" href="classdatalink__m2m.html#bd64962e779b6dd89529046245a8a98d">00323</a> <a class="code" href="classdatalink__m2m.html#bd64962e779b6dd89529046245a8a98d" title="Constructor.">datalink_m2m</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc_up ) : |
| 224 | <a name="l00324"></a>00324 <a class="code" href="classdatalink__m2e.html" title="data link between">datalink_m2e</a> ( rv, rvc, rv_up) { |
| 225 | <a name="l00325"></a>00325 <span class="comment">//establish c2c connection</span> |
| 226 | <a name="l00326"></a>00326 rvc.<a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( rvc_up, <a class="code" href="classdatalink__m2m.html#056193d459cd5e5fd323b5cbc6a55bad" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>, <a class="code" href="classdatalink__m2m.html#d1044bf4846f878290100429600273b2" title="cond-to-cond link, indeces of the upper cond">c2c_up</a> ); |
| 227 | <a name="l00327"></a>00327 it_assert_debug(<a class="code" href="classdatalink__m2m.html#056193d459cd5e5fd323b5cbc6a55bad" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>.length()+<a class="code" href="classdatalink__m2e.html#29604fb622b6a319d2d5d2709fe01f28" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>.length()==<a class="code" href="classdatalink__m2e.html#b3927998b71fce3ab030eba1c3c3cec3" title="Remember how long cond should be.">condsize</a>, <span class="stringliteral">"cond is not fully given"</span>); |
| 228 | <a name="l00328"></a>00328 } |
| 229 | <a name="l00330"></a><a class="code" href="classdatalink__m2m.html#51dd05760f99282a1da5f51eb88e7e42">00330</a> vec <a class="code" href="classdatalink__m2m.html#51dd05760f99282a1da5f51eb88e7e42" 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 ) { |
| 230 | <a name="l00331"></a>00331 vec tmp ( <a class="code" href="classdatalink__m2e.html#b3927998b71fce3ab030eba1c3c3cec3" title="Remember how long cond should be.">condsize</a> ); |
| 231 | <a name="l00332"></a>00332 set_subvector ( tmp,<a class="code" href="classdatalink__m2e.html#29604fb622b6a319d2d5d2709fe01f28" title="upper_val-to-local_cond link, ideces of the local cond">v2c_lo</a>,val_up ( <a class="code" href="classdatalink__m2e.html#6b46f983c46621b6bfe2b5da3d467d2a" title="upper_val-to-local_cond link, indeces of the upper val">v2c_up</a> ) ); |
| 232 | <a name="l00333"></a>00333 set_subvector ( tmp,<a class="code" href="classdatalink__m2m.html#056193d459cd5e5fd323b5cbc6a55bad" title="cond-to-cond link, indeces of the local cond">c2c_lo</a>,cond_up ( <a class="code" href="classdatalink__m2m.html#d1044bf4846f878290100429600273b2" title="cond-to-cond link, indeces of the upper cond">c2c_up</a> ) ); |
| 233 | <a name="l00334"></a>00334 <span class="keywordflow">return</span> tmp; |
| 234 | <a name="l00335"></a>00335 } |
| 235 | <a name="l00337"></a>00337 |
| 236 | <a name="l00338"></a>00338 }; |
| 237 | <a name="l00339"></a>00339 |
| 238 | <a name="l00343"></a><a class="code" href="classmepdf.html">00343</a> <span class="keyword">class </span><a class="code" href="classmepdf.html" title="Unconditional mpdf, allows using epdf in the role of mpdf.">mepdf</a> : <span class="keyword">public</span> <a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> { |
| 239 | <a name="l00344"></a>00344 <span class="keyword">public</span>: |
| 240 | <a name="l00346"></a><a class="code" href="classmepdf.html#0f39973ffd94c1e20e2d8aacc4adc6fa">00346</a> <a class="code" href="classmepdf.html#0f39973ffd94c1e20e2d8aacc4adc6fa" title="Default constructor.">mepdf</a> (<span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* em ) :<a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> ( em-><a class="code" href="classmpdf.html#71256ffb5fbd08f41d650e606a5bd585" title="access function">_rv</a>(),<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a>() ) {<a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a>=<span class="keyword">const_cast<</span><a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>*<span class="keyword">></span>(em);}; |
| 241 | <a name="l00347"></a><a class="code" href="classmepdf.html#bc87d89dbc3cf5eb6a0ad7d6d572488f">00347</a> <span class="keywordtype">void</span> <a class="code" href="classmepdf.html#bc87d89dbc3cf5eb6a0ad7d6d572488f" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &cond ) {} |
| 242 | <a name="l00348"></a>00348 }; |
| 243 | <a name="l00349"></a>00349 |
| 244 | <a name="l00352"></a><a class="code" href="classcompositepdf.html">00352</a> <span class="keyword">class </span><a class="code" href="classcompositepdf.html" title="Abstract composition of pdfs, a base for specific classes this abstract class is...">compositepdf</a> { |
| 245 | <a name="l00353"></a>00353 <span class="keyword">protected</span>: |
| 246 | <a name="l00355"></a><a class="code" href="classcompositepdf.html#c1646fe41ff5934d010e54ccaa46133f">00355</a> <span class="keywordtype">int</span> <a class="code" href="classcompositepdf.html#c1646fe41ff5934d010e54ccaa46133f" title="Number of mpdfs in the composite.">n</a>; |
| 247 | <a name="l00357"></a><a class="code" href="classcompositepdf.html#637877061b917a16a0421bb5c4cd480d">00357</a> Array<mpdf*> <a class="code" href="classcompositepdf.html#637877061b917a16a0421bb5c4cd480d" title="Elements of composition.">mpdfs</a>; |
| 248 | <a name="l00358"></a>00358 <span class="keyword">public</span>: |
| 249 | <a name="l00359"></a>00359 <a class="code" href="classcompositepdf.html" title="Abstract composition of pdfs, a base for specific classes this abstract class is...">compositepdf</a> ( Array<mpdf*> A0 ) : <a class="code" href="classcompositepdf.html#c1646fe41ff5934d010e54ccaa46133f" title="Number of mpdfs in the composite.">n</a> ( A0.length() ), <a class="code" href="classcompositepdf.html#637877061b917a16a0421bb5c4cd480d" title="Elements of composition.">mpdfs</a> ( A0 ) {}; |
| 250 | <a name="l00361"></a>00361 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classcompositepdf.html#635d219fb3e32852400d6f98aa4bdc93" title="find common rv, flag">getrv</a> ( <span class="keywordtype">bool</span> checkoverlap=<span class="keyword">false</span> ); |
| 251 | <a name="l00363"></a>00363 <span class="keywordtype">void</span> <a class="code" href="classcompositepdf.html#5a4479785c1fdb2cc351fbea07b899ac" title="common rvc of all mpdfs is written to rvc">setrvc</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc ); |
| 252 | <a name="l00364"></a>00364 }; |
| 253 | <a name="l00365"></a>00365 |
| 254 | <a name="l00373"></a><a class="code" href="classDS.html">00373</a> <span class="keyword">class </span><a class="code" href="classDS.html" title="Abstract class for discrete-time sources of data.">DS</a> { |
| 255 | <a name="l00374"></a>00374 <span class="keyword">protected</span>: |
| 256 | <a name="l00376"></a><a class="code" href="classDS.html#1012025a1a3a1fdd24aa48698a3d3454">00376</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classDS.html#1012025a1a3a1fdd24aa48698a3d3454" title="Observed variables, returned by getdata().">Drv</a>; |
| 257 | <a name="l00378"></a><a class="code" href="classDS.html#0a88ffaeb3c7c2cf30c69bc41a000629">00378</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classDS.html#0a88ffaeb3c7c2cf30c69bc41a000629" title="Action variables, accepted by write().">Urv</a>; <span class="comment">//</span> |
| 258 | <a name="l00379"></a>00379 <span class="keyword">public</span>: |
| 259 | <a name="l00381"></a>00381 <span class="keywordtype">void</span> <a class="code" href="classDS.html#db2dacc9e71a36eeb9c5c2ee402eeeb1" title="Returns full vector of observed data.">getdata</a> ( vec &dt ); |
| 260 | <a name="l00383"></a>00383 <span class="keywordtype">void</span> <a class="code" href="classDS.html#db2dacc9e71a36eeb9c5c2ee402eeeb1" title="Returns full vector of observed data.">getdata</a> ( vec &dt, ivec &indeces ); |
| 261 | <a name="l00385"></a>00385 <span class="keywordtype">void</span> <a class="code" href="classDS.html#0dfb6788b70c0d48a1f5276ed6c93039" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut ); |
| 262 | <a name="l00387"></a>00387 <span class="keywordtype">void</span> <a class="code" href="classDS.html#0dfb6788b70c0d48a1f5276ed6c93039" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut, ivec &indeces ); |
| 263 | <a name="l00393"></a>00393 <span class="keywordtype">void</span> <a class="code" href="classDS.html#9a35ca9c9321dce2bf63bf668f785b75" title="Method that assigns random variables to the datasource. Typically, the datasource...">linkrvs</a> ( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &drv, <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &urv ); |
| 264 | <a name="l00394"></a>00394 |
| 265 | <a name="l00396"></a>00396 <span class="keywordtype">void</span> <a class="code" href="classDS.html#470ba89e8e7c3c4d830803221b4e9be6" title="Moves from to , i.e. perfroms the actions and reads response of the system.">step</a>(); |
| 266 | <a name="l00397"></a>00397 |
| 267 | <a name="l00398"></a>00398 }; |
| 268 | <a name="l00399"></a>00399 |
| 269 | <a name="l00404"></a><a class="code" href="classBM.html">00404</a> <span class="keyword">class </span><a class="code" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a> { |
| 270 | <a name="l00405"></a>00405 <span class="keyword">protected</span>: |
| 271 | <a name="l00407"></a><a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88">00407</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a>; |
| 272 | <a name="l00409"></a><a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979">00409</a> <span class="keywordtype">double</span> <a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a>; |
| 273 | <a name="l00411"></a><a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129">00411</a> <span class="keywordtype">bool</span> <a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>; |
| 274 | <a name="l00412"></a>00412 <span class="keyword">public</span>: |
| 275 | <a name="l00413"></a>00413 |
| 276 | <a name="l00415"></a><a class="code" href="classBM.html#43d2ad6a6c9f1bcd22fe8906c477e50e">00415</a> <a class="code" href="classBM.html#43d2ad6a6c9f1bcd22fe8906c477e50e" title="Default constructor.">BM</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv0, <span class="keywordtype">double</span> ll0=0,<span class="keywordtype">bool</span> evalll0=<span class="keyword">true</span> ) :<a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a> ( rv0 ), <a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a> ( ll0 ),<a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( evalll0 ) {<span class="comment">//Fixme: test rv</span> |
| 277 | <a name="l00416"></a>00416 }; |
| 278 | <a name="l00418"></a><a class="code" href="classBM.html#e8fc5fae042f2b46d4d3827f9587d47d">00418</a> <a class="code" href="classBM.html#43d2ad6a6c9f1bcd22fe8906c477e50e" title="Default constructor.">BM</a> ( <span class="keyword">const</span> <a class="code" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a> &B ) : <a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a> ( B.<a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a> ), <a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a> ( B.<a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a> ), <a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( B.<a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {} |
| 279 | <a name="l00419"></a>00419 |
| 280 | <a name="l00423"></a>00423 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBM.html#a892eff438aab2dd1a9e2efcb7fb5bdf" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &dt ) = 0; |
| 281 | <a name="l00425"></a>00425 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBM.html#0186270f75189677f390fe088a9947e9" title="Batch Bayes rule (columns of Dt are observations).">bayesB</a> ( <span class="keyword">const</span> mat &Dt ); |
| 282 | <a name="l00427"></a>00427 <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>& <a class="code" href="classBM.html#8554809fec160bee279bcd5fa14ead5c" title="Returns a reference to the epdf representing posterior density on parameters.">_epdf</a>() <span class="keyword">const</span> =0; |
| 283 | <a name="l00428"></a>00428 |
| 284 | <a name="l00430"></a>00430 <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classBM.html#db500c4836f883c175a3cf3ab5a3ce24" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_e</a>() <span class="keyword">const</span> =0; |
| 285 | <a name="l00431"></a>00431 |
| 286 | <a name="l00434"></a><a class="code" href="classBM.html#8a8ce6df431689964c41cc6c849cfd06">00434</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classBM.html#8a8ce6df431689964c41cc6c849cfd06">logpred</a> ( <span class="keyword">const</span> vec &dt )<span class="keyword"> const</span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0.0;} |
| 287 | <a name="l00436"></a><a class="code" href="classBM.html#cd0660f2a1a344b56ac39802708ff165">00436</a> vec <a class="code" href="classBM.html#cd0660f2a1a344b56ac39802708ff165" title="Matrix version of logpred.">logpred_m</a> ( <span class="keyword">const</span> mat &dt )<span class="keyword"> const</span>{vec tmp ( dt.cols() );<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<dt.cols();i++ ) {tmp ( i ) =<a class="code" href="classBM.html#8a8ce6df431689964c41cc6c849cfd06">logpred</a> ( dt.get_col ( i ) );}<span class="keywordflow">return</span> tmp;} |
| 288 | <a name="l00437"></a>00437 |
| 289 | <a name="l00439"></a><a class="code" href="classBM.html#5594d68ee9aa6fc8c1e79019da5c9d56">00439</a> <span class="keyword">virtual</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classBM.html#5594d68ee9aa6fc8c1e79019da5c9d56" title="Constructs a predictive density (marginal density on data).">predictor</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a> )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> NULL;}; |
| 290 | <a name="l00440"></a>00440 |
| 291 | <a name="l00442"></a><a class="code" href="classBM.html#ca0f02b3b4144e0895cc14f7e0374bdd">00442</a> <span class="keyword">virtual</span> <a class="code" href="classBM.html#ca0f02b3b4144e0895cc14f7e0374bdd" title="Destructor for future use;.">~BM</a>() {}; |
| 292 | <a name="l00444"></a><a class="code" href="classBM.html#126bd2595c48e311fc2a7ab72876092a">00444</a> <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classBM.html#126bd2595c48e311fc2a7ab72876092a" title="access function">_rv</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a>;} |
| 293 | <a name="l00446"></a><a class="code" href="classBM.html#87f4a547d2c29180be88175e5eab9c88">00446</a> <span class="keywordtype">double</span> <a class="code" href="classBM.html#87f4a547d2c29180be88175e5eab9c88" title="access function">_ll</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a>;} |
| 294 | <a name="l00448"></a><a class="code" href="classBM.html#1ffa9f23669aabecc3760c06c6987522">00448</a> <span class="keywordtype">void</span> <a class="code" href="classBM.html#1ffa9f23669aabecc3760c06c6987522" title="access function">set_evalll</a> ( <span class="keywordtype">bool</span> evl0 ) {<a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>=evl0;} |
| 295 | <a name="l00449"></a>00449 |
| 296 | <a name="l00452"></a><a class="code" href="classBM.html#eb58c81d6a7b75b05fc6f276eed78887">00452</a> <span class="keyword">virtual</span> <a class="code" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a>* <a class="code" href="classBM.html#eb58c81d6a7b75b05fc6f276eed78887">_copy_</a> ( <span class="keywordtype">bool</span> changerv=<span class="keyword">false</span> ) {it_error ( <span class="stringliteral">"function _copy_ not implemented for this BM"</span> ); <span class="keywordflow">return</span> NULL;}; |
| 297 | <a name="l00453"></a>00453 }; |
| 298 | <a name="l00454"></a>00454 |
| 299 | <a name="l00464"></a><a class="code" href="classBMcond.html">00464</a> <span class="keyword">class </span><a class="code" href="classBMcond.html" title="Conditional Bayesian Filter.">BMcond</a> { |
| 300 | <a name="l00465"></a>00465 <span class="keyword">protected</span>: |
| 301 | <a name="l00467"></a><a class="code" href="classBMcond.html#9ba793c8ec453f04d372d17195ed8dec">00467</a> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classBMcond.html#9ba793c8ec453f04d372d17195ed8dec" title="Identificator of the conditioning variable.">rvc</a>; |
| 302 | <a name="l00468"></a>00468 <span class="keyword">public</span>: |
| 303 | <a name="l00470"></a>00470 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBMcond.html#3543cfe274c35f9033c24d8036a96c4d" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &val ) =0; |
| 304 | <a name="l00472"></a><a class="code" href="classBMcond.html#9a38dcdabef902fd91da3c9fb6ac27f7">00472</a> <a class="code" href="classBMcond.html#9a38dcdabef902fd91da3c9fb6ac27f7" title="Default constructor.">BMcond</a> ( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv0 ) :<a class="code" href="classBMcond.html#9ba793c8ec453f04d372d17195ed8dec" title="Identificator of the conditioning variable.">rvc</a> ( rv0 ) {}; |
| 305 | <a name="l00474"></a><a class="code" href="classBMcond.html#d40c72250cf93640f982d06de20815b2">00474</a> <span class="keyword">virtual</span> <a class="code" href="classBMcond.html#d40c72250cf93640f982d06de20815b2" title="Destructor for future use.">~BMcond</a>() {}; |
| 306 | <a name="l00476"></a><a class="code" href="classBMcond.html#3fa60348b2da6b4208bb95b8d146900a">00476</a> <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classBMcond.html#3fa60348b2da6b4208bb95b8d146900a" title="access function">_rvc</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classBMcond.html#9ba793c8ec453f04d372d17195ed8dec" title="Identificator of the conditioning variable.">rvc</a>;} |
| 307 | <a name="l00477"></a>00477 }; |
| 308 | <a name="l00478"></a>00478 |
| 309 | <a name="l00480"></a>00480 <span class="preprocessor">#endif // BM_H</span> |