| 8 | <script type="text/javascript"> |
| 9 | <!-- |
| 10 | function changeDisplayState (e){ |
| 11 | var num=this.id.replace(/[^[0-9]/g,''); |
| 12 | var button=this.firstChild; |
| 13 | var sectionDiv=document.getElementById('dynsection'+num); |
| 14 | if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){ |
| 15 | sectionDiv.style.display='block'; |
| 16 | button.src='open.gif'; |
| 17 | }else{ |
| 18 | sectionDiv.style.display='none'; |
| 19 | button.src='closed.gif'; |
| 20 | } |
| 21 | } |
| 22 | function initDynSections(){ |
| 23 | var divs=document.getElementsByTagName('div'); |
| 24 | var sectionCounter=1; |
| 25 | for(var i=0;i<divs.length-1;i++){ |
| 26 | if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){ |
| 27 | var header=divs[i]; |
| 28 | var section=divs[i+1]; |
| 29 | var button=header.firstChild; |
| 30 | if (button!='IMG'){ |
| 31 | divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild); |
| 32 | button=document.createElement('img'); |
| 33 | divs[i].insertBefore(button,divs[i].firstChild); |
| 34 | } |
| 35 | header.style.cursor='pointer'; |
| 36 | header.onclick=changeDisplayState; |
| 37 | header.id='dynheader'+sectionCounter; |
| 38 | button.src='closed.gif'; |
| 39 | section.id='dynsection'+sectionCounter; |
| 40 | section.style.display='none'; |
| 41 | section.style.marginLeft='14px'; |
| 42 | sectionCounter++; |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | window.onload = initDynSections; |
| 47 | --> |
| 48 | </script> |
20 | | <a name="l00013"></a>00013 <span class="preprocessor">#ifndef ARX_UI_H</span> |
21 | | <a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define ARX_UI_H</span> |
22 | | <a name="l00015"></a>00015 <span class="preprocessor"></span> |
23 | | <a name="l00016"></a>00016 |
24 | | <a name="l00017"></a>00017 <span class="preprocessor">#include "<a class="code" href="arx_8h.html" title="Bayesian Filtering for generalized autoregressive (ARX) model.">arx.h</a>"</span> |
25 | | <a name="l00018"></a>00018 <span class="preprocessor">#include "<a class="code" href="loggers__ui_8h.html" title="UI builders for Loggers.">stat/loggers_ui.h</a>"</span> |
26 | | <a name="l00019"></a>00019 |
27 | | <a name="l00038"></a><a class="code" href="classUIARX.html">00038</a> <span class="keyword">class </span><a class="code" href="classUIARX.html">UIARX</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1UIbuilder.html" title="Builds computational object from a UserInfo structure.">UIbuilder</a> { |
28 | | <a name="l00039"></a>00039 <span class="keyword">public</span>: |
29 | | <a name="l00040"></a>00040 <a class="code" href="classUIARX.html">UIARX</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">"ARXest"</span> ) {}; |
30 | | <a name="l00041"></a><a class="code" href="classUIARX.html#e9ef8d41d8f10a31343d76a73b9f0f77">00041</a> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a>* <a class="code" href="classUIARX.html#e9ef8d41d8f10a31343d76a73b9f0f77" title="Function building the computational object.">build</a> ( Setting &S )<span class="keyword"> const </span>{ |
31 | | <a name="l00042"></a>00042 <span class="keywordtype">int</span> ylen = S[<span class="stringliteral">"ychns"</span>].getLength(); |
32 | | <a name="l00043"></a>00043 <span class="keywordtype">int</span> rgrlen = S[<span class="stringliteral">"rgrid"</span>].getLength(); |
33 | | <a name="l00044"></a>00044 <span class="comment">// create rvs</span> |
34 | | <a name="l00045"></a>00045 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> yrv; |
35 | | <a name="l00046"></a>00046 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rrv; |
36 | | <a name="l00047"></a>00047 <span class="keywordtype">int</span> i; |
37 | | <a name="l00048"></a>00048 <span class="keywordflow">for</span> ( i=0;i<ylen; 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="l00049"></a>00049 <span class="comment">//build regressor</span> |
39 | | <a name="l00050"></a>00050 Setting& ids=S[<span class="stringliteral">"rgrid"</span>]; |
40 | | <a name="l00051"></a>00051 Setting& del=S[<span class="stringliteral">"delays"</span>]; |
41 | | <a name="l00052"></a>00052 |
42 | | <a name="l00053"></a>00053 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<ids.getLength(); i++ ) { |
43 | | <a name="l00054"></a>00054 rrv.<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">"rgr"</span>,ids[i],1,del[i])); |
44 | | <a name="l00055"></a>00055 } |
45 | | <a name="l00056"></a>00056 |
46 | | <a name="l00057"></a>00057 <span class="comment">//init</span> |
47 | | <a name="l00058"></a>00058 mat V0; |
48 | | <a name="l00059"></a>00059 <span class="keywordflow">if</span> ( S.exists ( <span class="stringliteral">"dV0"</span> ) ) { |
49 | | <a name="l00060"></a>00060 V0=diag ( getvec(S[<span class="stringliteral">"dV0"</span>]) ); |
| 60 | <a name="l00014"></a>00014 <span class="preprocessor">#ifndef ARX_UI_H</span> |
| 61 | <a name="l00015"></a>00015 <span class="preprocessor"></span><span class="preprocessor">#define ARX_UI_H</span> |
| 62 | <a name="l00016"></a>00016 <span class="preprocessor"></span> |
| 63 | <a name="l00017"></a>00017 |
| 64 | <a name="l00018"></a>00018 <span class="preprocessor">#include "<a class="code" href="arx_8h.html" title="Bayesian Filtering for generalized autoregressive (ARX) model.">arx.h</a>"</span> |
| 65 | <a name="l00019"></a>00019 <span class="preprocessor">#include "<a class="code" href="loggers__ui_8h.html" title="UI builders for Loggers.">stat/loggers_ui.h</a>"</span> |
| 66 | <a name="l00020"></a>00020 |
| 67 | <a name="l00041"></a><a class="code" href="classUIARX.html">00041</a> <span class="keyword">class </span><a class="code" href="classUIARX.html">UIARX</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1UIbuilder.html" title="Builds computational object from a UserInfo structure.">UIbuilder</a> { |
| 68 | <a name="l00042"></a>00042 <span class="keyword">public</span>: |
| 69 | <a name="l00043"></a>00043 <a class="code" href="classUIARX.html">UIARX</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">"ARXest"</span> ) {}; |
| 70 | <a name="l00044"></a><a class="code" href="classUIARX.html#e9ef8d41d8f10a31343d76a73b9f0f77">00044</a> <a class="code" href="classbdm_1_1bdmroot.html" title="Root class of BDM objects.">bdmroot</a>* <a class="code" href="classUIARX.html#e9ef8d41d8f10a31343d76a73b9f0f77" title="Function building the computational object.">build</a> ( Setting &S )<span class="keyword"> const </span>{ |
| 71 | <a name="l00045"></a>00045 <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="l00046"></a>00046 <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); |
| 73 | <a name="l00047"></a>00047 <span class="keywordtype">int</span> ylen = yrv-><a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(); |
| 74 | <a name="l00048"></a>00048 <span class="keywordtype">int</span> rgrlen = rrv-><a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>(); |
| 75 | <a name="l00049"></a>00049 |
| 76 | <a name="l00050"></a>00050 <span class="comment">//init</span> |
| 77 | <a name="l00051"></a>00051 mat V0; |
| 78 | <a name="l00052"></a>00052 <span class="keywordflow">if</span> ( S.exists ( <span class="stringliteral">"dV0"</span> ) ) { |
| 79 | <a name="l00053"></a>00053 V0=diag ( getvec(S[<span class="stringliteral">"dV0"</span>]) ); |
| 80 | <a name="l00054"></a>00054 } |
| 81 | <a name="l00055"></a>00055 <span class="keywordflow">else</span> { |
| 82 | <a name="l00056"></a>00056 V0=concat ( 1e-3*ones ( ylen ), 1e-5*ones ( rgrlen ) ); |
| 83 | <a name="l00057"></a>00057 } |
| 84 | <a name="l00058"></a>00058 <span class="keywordtype">double</span> nu0; |
| 85 | <a name="l00059"></a>00059 <span class="keywordflow">if</span> ( S.exists ( <span class="stringliteral">"nu0"</span> ) ) { |
| 86 | <a name="l00060"></a>00060 nu0=double(S[<span class="stringliteral">"nu0"</span>]); |
61 | | <a name="l00072"></a>00072 <span class="keywordtype">double</span> frg; |
62 | | <a name="l00073"></a>00073 <span class="keywordflow">if</span> ( S.exists ( <span class="stringliteral">"frg"</span> ) ) { |
63 | | <a name="l00074"></a>00074 frg = S[<span class="stringliteral">"frg"</span>]; |
64 | | <a name="l00075"></a>00075 } |
65 | | <a name="l00076"></a>00076 <span class="keywordflow">else</span> { |
66 | | <a name="l00077"></a>00077 frg = 1.0; |
67 | | <a name="l00078"></a>00078 } |
68 | | <a name="l00079"></a>00079 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> thr(<span class="stringliteral">"{theta r }"</span>, vec_2(rgrlen*ylen, ylen*ylen)); |
69 | | <a name="l00080"></a>00080 <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a>* A=<span class="keyword">new</span> <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a> (thr, V0, nu0, frg); |
70 | | <a name="l00081"></a>00081 A-><a class="code" href="classbdm_1_1BM.html#f135ae6dce7e9f30c9f88229c7930b96">set_drv</a>(<a class="code" href="namespacebdm.html#b9016687c0e874ca5cdcf75ae28811aa" title="Concat two random variables.">concat</a>(yrv,rrv)); |
71 | | <a name="l00082"></a>00082 |
72 | | <a name="l00083"></a>00083 <span class="keywordflow">return</span> A; |
73 | | <a name="l00084"></a>00084 }; |
74 | | <a name="l00085"></a>00085 }; |
75 | | <a name="l00086"></a>00086 |
76 | | <a name="l00087"></a>00087 UIREGISTER ( <a class="code" href="classUIARX.html">UIARX</a> ); |
77 | | <a name="l00088"></a>00088 |
78 | | <a name="l00089"></a>00089 <span class="preprocessor">#endif // DS_UI_H</span> |
| 98 | <a name="l00072"></a>00072 <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a>* A=<span class="keyword">new</span> <a class="code" href="classbdm_1_1ARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a>; |
| 99 | <a name="l00073"></a>00073 A-><a class="code" href="classbdm_1_1ARX.html#7aef6fe827f15427d534e6fb2c220e04">set_parameters</a>(frg); |
| 100 | <a name="l00074"></a>00074 A-><a class="code" href="classbdm_1_1ARX.html#f859f53eab269845a9064bbd92f841af">set_statistics</a>(ylen,V0, nu0); |
| 101 | <a name="l00075"></a>00075 A-><a class="code" href="classbdm_1_1ARX.html#df3dc1b90efc0cc54a3a6e5e858542d1">set_drv</a>(concat(*yrv,*rrv)); |
| 102 | <a name="l00076"></a>00076 |
| 103 | <a name="l00077"></a>00077 <span class="comment">//name results (for logging)</span> |
| 104 | <a name="l00078"></a>00078 A-><a class="code" href="classbdm_1_1BM.html#b38d92f17620813ad872d86e01a26e5e">set_rv</a>(<a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>(<span class="stringliteral">"{theta r }"</span>, vec_2(ylen*rgrlen, ylen*ylen))); |
| 105 | <a name="l00079"></a>00079 <span class="keyword">delete</span> yrv; <span class="keyword">delete</span> rrv; |
| 106 | <a name="l00080"></a>00080 <span class="keywordflow">return</span> A; |
| 107 | <a name="l00081"></a>00081 }; |
| 108 | <a name="l00082"></a>00082 }; |
| 109 | <a name="l00083"></a>00083 |
| 110 | <a name="l00084"></a>00084 UIREGISTER ( <a class="code" href="classUIARX.html">UIARX</a> ); |
| 111 | <a name="l00085"></a>00085 |
| 112 | <a name="l00086"></a>00086 <span class="preprocessor">#endif // DS_UI_H</span> |