root/doc/html/model_8h-source.html @ 324

Revision 323, 11.6 kB (checked in by smidl, 16 years ago)

doc

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mixpp: model.h Source File</title>
4<link href="tabs.css" rel="stylesheet" type="text/css">
5<link href="doxygen.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.8 -->
8<script type="text/javascript">
9<!--
10function 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}
22function 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}
46window.onload = initDynSections;
47-->
48</script>
49<div class="navigation" id="top">
50  <div class="tabs">
51    <ul>
52      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
53      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
54      <li><a href="modules.html"><span>Modules</span></a></li>
55      <li><a href="annotated.html"><span>Classes</span></a></li>
56      <li class="current"><a href="files.html"><span>Files</span></a></li>
57    </ul>
58  </div>
59  <div class="tabs">
60    <ul>
61      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
62      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
63    </ul>
64  </div>
65<h1>model.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef MODEL_H</span>
66<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define MODEL_H</span>
67<a name="l00003"></a>00003 <span class="preprocessor"></span>
68<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;stat/libFN.h&gt;</span>
69<a name="l00005"></a>00005
70<a name="l00006"></a>00006 <span class="keyword">using namespace </span>bdm;
71<a name="l00007"></a>00007
72<a name="l00009"></a><a class="code" href="classIMk1.html">00009</a> <span class="keyword">class </span><a class="code" href="classIMk1.html" title="Model stredni hodnoty vyvoje stavu pro k1.">IMk1</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> {
73<a name="l00010"></a>00010 <span class="keyword">protected</span>:
74<a name="l00011"></a>00011         <span class="keywordtype">double</span> alp1, alp2; <span class="comment">// pomery odboceni...</span>
75<a name="l00012"></a>00012
76<a name="l00013"></a>00013 <span class="keyword">public</span>:
77<a name="l00015"></a><a class="code" href="classIMk1.html#c440a205745a09c2c903c4bdf7f5f9fc">00015</a>         <a class="code" href="classIMk1.html#c440a205745a09c2c903c4bdf7f5f9fc" title="Constructor.">IMk1</a>() :<a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> () {<a class="code" href="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>=4; <a class="code" href="classbdm_1_1diffbifn.html#a193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>=3; <a class="code" href="classbdm_1_1diffbifn.html#30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a>=1;};
78<a name="l00017"></a><a class="code" href="classIMk1.html#75f9d12716a3648a838477186b49aff1">00017</a>         <span class="keywordtype">void</span> <a class="code" href="classIMk1.html#75f9d12716a3648a838477186b49aff1" title="set CONSTANT parameters">set_parameters</a> ( <span class="keywordtype">double</span> alp10,  <span class="keywordtype">double</span> alp20) {alp1=alp10; alp2=alp20;}
79<a name="l00018"></a>00018
80<a name="l00019"></a><a class="code" href="classIMk1.html#8957f00622352dcacd64518136c7da33">00019</a>         vec <a class="code" href="classIMk1.html#8957f00622352dcacd64518136c7da33" title="Evaluates .">eval</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) {
81<a name="l00020"></a>00020                 <span class="comment">// napln stav nulami</span>
82<a name="l00021"></a>00021                 vec xk=zeros ( <a class="code" href="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a> );
83<a name="l00022"></a>00022
84<a name="l00023"></a>00023                 xk ( 0 ) = 0.2* x0(1) - 0.1* x0(2)+ u0(0);  <span class="comment">// vycucane z prstu</span>
85<a name="l00024"></a>00024                 xk ( 1 ) = x0(0);
86<a name="l00025"></a>00025                 xk ( 2 ) = x0(1);
87<a name="l00026"></a>00026                 xk ( 3 ) = x0(2);
88<a name="l00027"></a>00027
89<a name="l00028"></a>00028                 <span class="keywordflow">return</span> xk;
90<a name="l00029"></a>00029         }
91<a name="l00030"></a>00030
92<a name="l00031"></a><a class="code" href="classIMk1.html#463177c0fdffdf4951761959160cc682">00031</a>         <span class="keywordtype">void</span> <a class="code" href="classIMk1.html#463177c0fdffdf4951761959160cc682" title="Evaluates  and writes result into A .">dfdx_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {
93<a name="l00032"></a>00032                 <span class="comment">// Vysledek se uklada do matice A</span>
94<a name="l00033"></a>00033
95<a name="l00034"></a>00034                 <span class="keywordflow">if</span> (full) { <span class="comment">// priznak full se nastavi na zacatku =&gt; je treba naplnit celou matici</span>
96<a name="l00035"></a>00035                         A = eye(<a class="code" href="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>);
97<a name="l00036"></a>00036                         A(0,1) = 0.2;
98<a name="l00037"></a>00037                         A(0,2) = -0.1;
99<a name="l00038"></a>00038                 } <span class="keywordflow">else</span> {
100<a name="l00039"></a>00039                 }; <span class="comment">// pokud neni priznak full, staci naplnit jen to co se zmenilo. V tomhle pripade se nemeni nic</span>
101<a name="l00040"></a>00040         }
102<a name="l00041"></a>00041
103<a name="l00042"></a><a class="code" href="classIMk1.html#2b85f0984da3fe55849bb7b28f66e50c">00042</a>         <span class="keywordtype">void</span> <a class="code" href="classIMk1.html#2b85f0984da3fe55849bb7b28f66e50c" title="Evaluates  and writes result into A .">dfdu_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {it_error ( <span class="stringliteral">"not needed"</span> );};
104<a name="l00043"></a>00043
105<a name="l00044"></a>00044 };
106<a name="l00045"></a>00045
107<a name="l00047"></a><a class="code" href="classOMk1.html">00047</a> <span class="keyword">class </span><a class="code" href="classOMk1.html" title="model stredni hodnoty pozorovani pro k1">OMk1</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> {
108<a name="l00048"></a>00048 <span class="keyword">public</span>:
109<a name="l00050"></a><a class="code" href="classOMk1.html#8e88ee95e5df98357069e7c3215cbdcd">00050</a>         <a class="code" href="classOMk1.html#8e88ee95e5df98357069e7c3215cbdcd" title="Constructor.">OMk1</a>() :<a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a> ( ) {<a class="code" href="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>=2;<a class="code" href="classbdm_1_1diffbifn.html#a193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>=3;<a class="code" href="classbdm_1_1diffbifn.html#30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a>=2;}; <span class="comment">//&lt;======= TODO </span>
110<a name="l00051"></a>00051         <span class="comment">// Model pozorovani  je trivialni jen se zkopiruji stavy</span>
111<a name="l00052"></a><a class="code" href="classOMk1.html#7c12aa1b56f298cc21b22e0dde84ef8f">00052</a>         vec <a class="code" href="classOMk1.html#7c12aa1b56f298cc21b22e0dde84ef8f" title="Evaluates .">eval</a>(<span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ){
112<a name="l00053"></a>00053                 vec dt(<a class="code" href="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>);
113<a name="l00054"></a>00054                 <span class="comment">// Pozoruji pouze prvni dva stavy</span>
114<a name="l00055"></a>00055                 dt(0) = x0(0);
115<a name="l00056"></a>00056                 dt(1) = x0(1);
116<a name="l00057"></a>00057                 <span class="keywordflow">return</span> dt;
117<a name="l00058"></a>00058         }
118<a name="l00059"></a>00059         <span class="comment">//</span>
119<a name="l00060"></a><a class="code" href="classOMk1.html#3a6ff61c818d25f95912351aac201cc7">00060</a>         <span class="keywordtype">void</span> <a class="code" href="classOMk1.html#3a6ff61c818d25f95912351aac201cc7" title="Evaluates  and writes result into A .">dfdx_cond</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0, mat &amp;A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {
120<a name="l00061"></a>00061                 <span class="comment">// Vysledek se uklada do matice A</span>
121<a name="l00062"></a>00062
122<a name="l00063"></a>00063                 <span class="keywordflow">if</span> (full) { <span class="comment">// priznak full se nastavi na zacatku =&gt; je treba naplnit celou matici</span>
123<a name="l00064"></a>00064                         A = zeros(<a class="code" href="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>,<a class="code" href="classbdm_1_1diffbifn.html#a193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>);
124<a name="l00065"></a>00065                         A(0,0)=1.0;
125<a name="l00066"></a>00066                         A(1,1)=1.0;
126<a name="l00067"></a>00067                 } <span class="keywordflow">else</span> {}; <span class="comment">// pokud neni priznak full, staci naplnit jen to co se zmenilo. V tomhle pripade se nemeni nic</span>
127<a name="l00068"></a>00068         }
128<a name="l00069"></a>00069 };
129<a name="l00070"></a>00070
130<a name="l00071"></a>00071 <span class="preprocessor">#endif //MODEL_H</span>
131</pre></div></div>
132<hr size="1"><address style="text-align: right;"><small>Generated on Thu Apr 23 21:06:42 2009 for mixpp by&nbsp;
133<a href="http://www.doxygen.org/index.html">
134<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
135</body>
136</html>
Note: See TracBrowser for help on using the browser.