31 | | <a name="l00055"></a>00055 <span class="keywordtype">int</span> ych = S[<span class="stringliteral">"ychns"</span>]; |
32 | | <a name="l00056"></a>00056 <span class="keywordtype">int</span> uch = S[<span class="stringliteral">"uchns"</span>]; |
33 | | <a name="l00057"></a>00057 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> yrv; |
34 | | <a name="l00058"></a>00058 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> urv; |
35 | | <a name="l00059"></a>00059 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rrv; |
36 | | <a name="l00060"></a>00060 <span class="keywordtype">int</span> i,j; |
37 | | <a name="l00061"></a>00061 <span class="keywordflow">for</span> ( i=0;i<ych; i++ ) {yrv.<a class="code" href="classbdm_1_1RV.html#87841b5ee43997b79789c0c22047e224" title="Add (concat) another variable to the current one,.">add</a> ( <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ( <span class="stringliteral">"y"</span>+num2str(i),i+1 ));} |
38 | | <a name="l00062"></a>00062 <span class="keywordflow">for</span> ( j=0;j<uch; j++ ) {urv.<a class="code" href="classbdm_1_1RV.html#87841b5ee43997b79789c0c22047e224" title="Add (concat) another variable to the current one,.">add</a> ( <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ( <span class="stringliteral">"u"</span>+num2str(i),j+i+1 ));} |
39 | | <a name="l00063"></a>00063 |
40 | | <a name="l00064"></a>00064 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> drv=<a class="code" href="namespacebdm.html#b9016687c0e874ca5cdcf75ae28811aa" title="Concat two random variables.">concat</a> ( yrv,urv ); |
41 | | <a name="l00065"></a>00065 <span class="comment">//build regressor</span> |
42 | | <a name="l00066"></a>00066 Setting& ids=S[<span class="stringliteral">"ids"</span>]; |
43 | | <a name="l00067"></a>00067 Setting& del=S[<span class="stringliteral">"delays"</span>]; |
44 | | <a name="l00068"></a>00068 |
45 | | <a name="l00069"></a>00069 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<ids.getLength(); i++ ) { |
46 | | <a name="l00070"></a>00070 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> tmp=drv.<a class="code" href="classbdm_1_1RV.html#c0c04ab99ded62e1e05bcefb151ebeb9" title="Select only variables at indeces ind.">subselect</a> ( vec_1 ( <span class="keywordtype">int</span> ( ids[i] )-1 ) ); |
47 | | <a name="l00071"></a>00071 tmp.<a class="code" href="classbdm_1_1RV.html#bd77cb0899f7fba1d0e34396137b7f1f" title="Shift time shifted by delta.">t</a> ( <span class="keywordtype">int</span> ( del[i] ) ); |
48 | | <a name="l00072"></a>00072 rrv.<a class="code" href="classbdm_1_1RV.html#87841b5ee43997b79789c0c22047e224" title="Add (concat) another variable to the current one,.">add</a> ( tmp ); |
49 | | <a name="l00073"></a>00073 } |
50 | | <a name="l00074"></a>00074 |
51 | | <a name="l00075"></a>00075 ARXDS* tmp = <span class="keyword">new</span> ARXDS ( yrv, urv, rrv ); |
52 | | <a name="l00076"></a>00076 mat Th=getmat ( S[<span class="stringliteral">"theta"</span>],rrv.count() ); |
53 | | <a name="l00077"></a>00077 vec mu0; |
54 | | <a name="l00078"></a>00078 <span class="keywordflow">if</span> ( S.exists ( <span class="stringliteral">"offset"</span> ) ) { |
55 | | <a name="l00079"></a>00079 mu0=getvec ( S[<span class="stringliteral">"offset"</span>] ); |
56 | | <a name="l00080"></a>00080 } |
57 | | <a name="l00081"></a>00081 <span class="keywordflow">else</span> { |
58 | | <a name="l00082"></a>00082 mu0=zeros ( yrv.count() ); |
59 | | <a name="l00083"></a>00083 } |
60 | | <a name="l00084"></a>00084 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> sqR ( getmat ( S[<span class="stringliteral">"r"</span>],yrv.count() ) ); |
61 | | <a name="l00085"></a>00085 tmp->set_parameters ( Th,mu0,sqR ); |
62 | | <a name="l00086"></a>00086 <span class="keywordflow">if</span> (S.exists(<span class="stringliteral">"opt"</span>)){tmp->set_options(S[<span class="stringliteral">"opt"</span>]);} |
63 | | <a name="l00087"></a>00087 <span class="keywordflow">return</span> tmp; |
64 | | <a name="l00088"></a>00088 }; |
65 | | <a name="l00089"></a>00089 }; |
66 | | <a name="l00090"></a>00090 |
67 | | <a name="l00091"></a>00091 UIREGISTER ( <a class="code" href="classUIArxDS.html">UIArxDS</a> ); |
68 | | <a name="l00092"></a>00092 |
69 | | <a name="l00123"></a>00123 <span class="keyword">class </span>UIstateDS : <span class="keyword">public</span> <a class="code" href="classbdm_1_1UIbuilder.html" title="Builds computational object from a UserInfo structure.">UIbuilder</a> { |
70 | | <a name="l00124"></a>00124 <span class="keyword">public</span>: |
71 | | <a name="l00125"></a>00125 UIstateDS() :<a class="code" href="classbdm_1_1UIbuilder.html" title="Builds computational object from a UserInfo structure.">UIbuilder</a> ( <span class="stringliteral">"stateDS"</span> ) {}; |
72 | | <a name="l00126"></a>00126 <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a>* <a class="code" href="classbdm_1_1UIbuilder.html#193cede6302669ff48dfd8ab3b7e31f8" title="Function building the computational object.">build</a> ( Setting &S )<span class="keyword"> const </span>{ |
73 | | <a name="l00127"></a>00127 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>* rvtmp; |
74 | | <a name="l00128"></a>00128 <a class="code" href="namespacebdm.html#b547b14af614cba1ab6c8942dde34462" title="Prototype of a UI builder. Return value is by the second argument since it type checking...">UIbuild</a>(S[<span class="stringliteral">"IM"</span>][<span class="stringliteral">"rvu"</span>], rvtmp); |
75 | | <a name="l00129"></a>00129 <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>* IM; |
76 | | <a name="l00130"></a>00130 <a class="code" href="namespacebdm.html#b547b14af614cba1ab6c8942dde34462" title="Prototype of a UI builder. Return value is by the second argument since it type checking...">UIbuild</a>(S[<span class="stringliteral">"IM"</span>],IM); |
77 | | <a name="l00131"></a>00131 <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>* OM; |
78 | | <a name="l00132"></a>00132 <a class="code" href="namespacebdm.html#b547b14af614cba1ab6c8942dde34462" title="Prototype of a UI builder. Return value is by the second argument since it type checking...">UIbuild</a>(S[<span class="stringliteral">"OM"</span>],OM); |
79 | | <a name="l00133"></a>00133 <span class="keywordflow">return</span> <span class="keyword">new</span> stateDS(IM,OM,*rvtmp); |
80 | | <a name="l00134"></a>00134 } |
81 | | <a name="l00135"></a>00135 }; |
82 | | <a name="l00136"></a>00136 UIREGISTER ( UIstateDS ); |
83 | | <a name="l00137"></a>00137 <span class="preprocessor">#endif // DS_UI_H</span> |
| 71 | <a name="l00055"></a>00055 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> *yrv; UIbuild(S[<span class="stringliteral">"y"</span>],yrv); |
| 72 | <a name="l00056"></a>00056 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> *urv; UIbuild(S[<span class="stringliteral">"u"</span>],urv); |
| 73 | <a name="l00057"></a>00057 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> *rrv; UIbuild(S[<span class="stringliteral">"rgr"</span>],rrv); |
| 74 | <a name="l00058"></a>00058 |
| 75 | <a name="l00059"></a>00059 <a class="code" href="classbdm_1_1ArxDS.html" title="Generator of ARX data.">ArxDS</a>* tmp = <span class="keyword">new</span> <a class="code" href="classbdm_1_1ArxDS.html" title="Generator of ARX data.">ArxDS</a>; |
| 76 | <a name="l00060"></a>00060 mat Th=getmat ( S[<span class="stringliteral">"theta"</span>], rrv-><a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ); |
| 77 | <a name="l00061"></a>00061 vec mu0; |
| 78 | <a name="l00062"></a>00062 <span class="keywordflow">if</span> ( S.exists ( <span class="stringliteral">"offset"</span> ) ) { |
| 79 | <a name="l00063"></a>00063 mu0=getvec ( S[<span class="stringliteral">"offset"</span>] ); |
| 80 | <a name="l00064"></a>00064 } |
| 81 | <a name="l00065"></a>00065 <span class="keywordflow">else</span> { |
| 82 | <a name="l00066"></a>00066 mu0=zeros ( yrv-><a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ); |
| 83 | <a name="l00067"></a>00067 } |
| 84 | <a name="l00068"></a>00068 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> sqR ( getmat ( S[<span class="stringliteral">"r"</span>],yrv-><a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>() ) ); |
| 85 | <a name="l00069"></a>00069 tmp-><a class="code" href="classbdm_1_1ArxDS.html#2d9abc62f1fee862f0e1c60c5c4a3c8a" title="Set parameters of the internal model, H is maximum time delay.">set_parameters</a> ( Th,mu0,sqR ); |
| 86 | <a name="l00070"></a>00070 tmp-><a class="code" href="classbdm_1_1ArxDS.html#bf9cd9d4043d7e0dc61de56db37ec703" title="Set.">set_drv</a>(*yrv,*urv,*rrv); |
| 87 | <a name="l00071"></a>00071 <span class="keywordflow">if</span> (S.exists(<span class="stringliteral">"opt"</span>)){tmp-><a class="code" href="classbdm_1_1ArxDS.html#e7438127de87c5a8128edfa12255b436" title="set options from a string">set_options</a>(S[<span class="stringliteral">"opt"</span>]);} |
| 88 | <a name="l00072"></a>00072 <span class="keywordflow">return</span> tmp; |
| 89 | <a name="l00073"></a>00073 }; |
| 90 | <a name="l00074"></a>00074 }; |
| 91 | <a name="l00075"></a>00075 |
| 92 | <a name="l00076"></a>00076 UIREGISTER ( <a class="code" href="classUIArxDS.html">UIArxDS</a> ); |
| 93 | <a name="l00077"></a>00077 |
| 94 | <a name="l00108"></a><a class="code" href="classUIstateDS.html">00108</a> <span class="keyword">class </span><a class="code" href="classUIstateDS.html">UIstateDS</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1UIbuilder.html" title="Builds computational object from a UserInfo structure.">UIbuilder</a> { |
| 95 | <a name="l00109"></a>00109 <span class="keyword">public</span>: |
| 96 | <a name="l00110"></a>00110 <a class="code" href="classUIstateDS.html">UIstateDS</a>() :<a class="code" href="classbdm_1_1UIbuilder.html#c75103dd58395644e80f1eea886c656b" title="Constructor needs to be run only once macro UIREGISTER.">UIbuilder</a> ( <span class="stringliteral">"stateDS"</span> ) {}; |
| 97 | <a name="l00111"></a><a class="code" href="classUIstateDS.html#972d0b59ec756a4e4247e7febd2383fa">00111</a> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a>* <a class="code" href="classUIstateDS.html#972d0b59ec756a4e4247e7febd2383fa" title="Function building the computational object.">build</a> ( Setting &S )<span class="keyword"> const </span>{ |
| 98 | <a name="l00112"></a>00112 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>* rvtmp; |
| 99 | <a name="l00113"></a>00113 UIbuild(S[<span class="stringliteral">"IM"</span>][<span class="stringliteral">"rvu"</span>], rvtmp); |
| 100 | <a name="l00114"></a>00114 <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>* IM; |
| 101 | <a name="l00115"></a>00115 UIbuild(S[<span class="stringliteral">"IM"</span>],IM); |
| 102 | <a name="l00116"></a>00116 <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>* OM; |
| 103 | <a name="l00117"></a>00117 UIbuild(S[<span class="stringliteral">"OM"</span>],OM); |
| 104 | <a name="l00118"></a>00118 stateDS *<a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a>=<span class="keyword">new</span> stateDS(IM,OM,0); |
| 105 | <a name="l00119"></a>00119 <span class="comment">//DS->set_drv(rvtmp);</span> |
| 106 | <a name="l00120"></a>00120 <span class="keywordflow">return</span> DS; |
| 107 | <a name="l00121"></a>00121 } |
| 108 | <a name="l00122"></a>00122 }; |
| 109 | <a name="l00123"></a>00123 UIREGISTER ( <a class="code" href="classUIstateDS.html">UIstateDS</a> ); |
| 110 | <a name="l00124"></a>00124 <span class="preprocessor">#endif // DS_UI_H</span> |