Show
Ignore:
Timestamp:
03/05/08 16:01:56 (16 years ago)
Author:
smidl
Message:

Oprava PF a MPF + jejich implementace pro pmsm system

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • doc/html/libFN_8h-source.html

    r32 r33  
    2525<a name="l00010"></a>00010 <span class="comment">//</span> 
    2626<a name="l00011"></a>00011 <span class="comment">//</span> 
    27 <a name="l00012"></a>00012 <span class="preprocessor">#include &lt;itpp/itbase.h&gt;</span> 
    28 <a name="l00013"></a>00013 <span class="preprocessor">#include "<a class="code" href="libBM_8h.html" title="Bayesian Models (bm) that use Bayes rule to learn from observations.">libBM.h</a>"</span> 
    29 <a name="l00014"></a>00014  
    30 <a name="l00015"></a>00015 <span class="keyword">using namespace </span>itpp; 
    31 <a name="l00016"></a>00016  
    32 <a name="l00018"></a><a class="code" href="classconstfn.html">00018</a> <span class="keyword">class </span><a class="code" href="classconstfn.html" title="class representing function $f(x) = a$, here rv is empty">constfn</a> : <span class="keyword">public</span> <a class="code" href="classfnc.html" title="Class representing function $f(x)$ of variable $x$ represented by rv.">fnc</a> 
    33 <a name="l00019"></a>00019 { 
    34 <a name="l00020"></a>00020                 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv; 
    35 <a name="l00021"></a>00021                 vec val; 
    36 <a name="l00022"></a>00022  
    37 <a name="l00023"></a>00023  
    38 <a name="l00024"></a>00024         <span class="keyword">public</span>: 
    39 <a name="l00025"></a>00025                 vec eval() {<span class="keywordflow">return</span> val;}; 
    40 <a name="l00026"></a>00026                 vec eval ( vec &amp;cond ) {<span class="keywordflow">return</span> val;}; 
    41 <a name="l00028"></a><a class="code" href="classconstfn.html#d08acd7fac0ef3edfa59bbe48403f2bc">00028</a>                 <a class="code" href="classconstfn.html#d08acd7fac0ef3edfa59bbe48403f2bc" title="Default constructor.">constfn</a> ( <span class="keyword">const</span> vec &amp;val0 ) :rv(),val ( val0 ) {}; 
    42 <a name="l00029"></a>00029 }; 
    43 <a name="l00030"></a>00030  
    44 <a name="l00032"></a><a class="code" href="classlinfn.html">00032</a> <span class="keyword">class </span><a class="code" href="classlinfn.html" title="Class representing function $f(x) = Ax+B$.">linfn</a>: <span class="keyword">public</span> <a class="code" href="classfnc.html" title="Class representing function $f(x)$ of variable $x$ represented by rv.">fnc</a> 
    45 <a name="l00033"></a>00033 { 
    46 <a name="l00034"></a>00034                 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv; 
    47 <a name="l00035"></a>00035                 ivec indexlist; <span class="comment">// needed by evalsome</span> 
    48 <a name="l00036"></a>00036                 mat A; 
    49 <a name="l00037"></a>00037                 vec B; 
    50 <a name="l00038"></a>00038         <span class="keyword">public</span> : 
    51 <a name="l00039"></a>00039                 vec eval ( vec &amp;cond ) {it_assert_debug ( cond.length() ==rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>(), <span class="stringliteral">"linfn::eval Wrong cond."</span> );<span class="keywordflow">return</span> A*cond+B;}; 
    52 <a name="l00040"></a>00040  
    53 <a name="l00041"></a>00041                 <a class="code" href="classlinfn.html" title="Class representing function $f(x) = Ax+B$.">linfn</a> evalsome ( ivec &amp;rvind ); 
    54 <a name="l00042"></a>00042                 <a class="code" href="classlinfn.html" title="Class representing function $f(x) = Ax+B$.">linfn</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv0 ) :rv ( rv0 ),A ( eye ( rv0.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>() ) ),B ( zeros ( rv0.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>() ) ) { indexlist=rv.<a class="code" href="classRV.html#8470cf53be6e7bdba78ad0efbd203ee7" title="generate a list of indeces, i.e. which">indexlist</a>();}; 
    55 <a name="l00043"></a>00043                 <a class="code" href="classlinfn.html" title="Class representing function $f(x) = Ax+B$.">linfn</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv0, <span class="keyword">const</span> mat &amp;A0 ) : rv ( rv0 ), A ( A0 ), B ( zeros ( rv0.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>() ) ) { indexlist=rv.<a class="code" href="classRV.html#8470cf53be6e7bdba78ad0efbd203ee7" title="generate a list of indeces, i.e. which">indexlist</a>();}; 
    56 <a name="l00044"></a>00044                 <a class="code" href="classlinfn.html" title="Class representing function $f(x) = Ax+B$.">linfn</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv0, <span class="keyword">const</span> mat &amp;A0, <span class="keyword">const</span> vec &amp;B0 ) :rv ( rv0 ), A ( A0 ), B ( B0 ) { indexlist=rv.<a class="code" href="classRV.html#8470cf53be6e7bdba78ad0efbd203ee7" title="generate a list of indeces, i.e. which">indexlist</a>();}; 
    57 <a name="l00045"></a>00045 }; 
    58 <a name="l00046"></a>00046  
    59 <a name="l00047"></a>00047  
    60 <a name="l00057"></a><a class="code" href="classdiffbifn.html">00057</a> <span class="keyword">class </span><a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables $f(x,u)$.">diffbifn</a>: <span class="keyword">public</span> <a class="code" href="classfnc.html" title="Class representing function $f(x)$ of variable $x$ represented by rv.">fnc</a> 
    61 <a name="l00058"></a>00058 { 
    62 <a name="l00059"></a>00059         <span class="keyword">protected</span>: 
    63 <a name="l00060"></a>00060                 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rvx,rvu; 
    64 <a name="l00061"></a>00061                 <span class="keywordtype">int</span> dimx; 
    65 <a name="l00062"></a>00062                 <span class="keywordtype">int</span> dimu; 
    66 <a name="l00063"></a>00063         <span class="keyword">public</span>: 
    67 <a name="l00065"></a><a class="code" href="classdiffbifn.html#ad7673e16aa1a046b131b24c731c4632">00065</a>                 vec <a class="code" href="classdiffbifn.html#ad7673e16aa1a046b131b24c731c4632" title="Evaluates $f(x0,u0)$ (VS: Do we really need common eval? ).">eval</a> ( <span class="keyword">const</span> vec &amp;cond ) 
    68 <a name="l00066"></a>00066                 { 
    69 <a name="l00067"></a>00067                         it_assert_debug ( cond.length() == ( dimx+dimu ), <span class="stringliteral">"linfn::eval Wrong cond."</span> ); 
    70 <a name="l00068"></a>00068                         <span class="keywordflow">return</span> <a class="code" href="classdiffbifn.html#ad7673e16aa1a046b131b24c731c4632" title="Evaluates $f(x0,u0)$ (VS: Do we really need common eval? ).">eval</a> ( cond ( 0,dimx-1 ),cond ( dimx,dimx+dimu ) );<span class="comment">//-1 = end (in matlab)</span> 
    71 <a name="l00069"></a>00069                 }; 
    72 <a name="l00070"></a>00070  
    73 <a name="l00072"></a><a class="code" href="classdiffbifn.html#40d8a7eee45acc55cda33d43282faa03">00072</a>                 <span class="keyword">virtual</span> vec <a class="code" href="classdiffbifn.html#ad7673e16aa1a046b131b24c731c4632" title="Evaluates $f(x0,u0)$ (VS: Do we really need common eval? ).">eval</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) {<span class="keywordflow">return</span> zeros ( dimy );}; 
    74 <a name="l00074"></a><a class="code" href="classdiffbifn.html#6d217a02d4fa13931258d4bebdd0feb4">00074</a>                 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdiffbifn.html#6d217a02d4fa13931258d4bebdd0feb4" 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> ) {}; 
    75 <a name="l00076"></a><a class="code" href="classdiffbifn.html#1978bafd7909d15c139a08c495c24aa0">00076</a>                 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdiffbifn.html#1978bafd7909d15c139a08c495c24aa0" 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> ) {}; 
    76 <a name="l00078"></a><a class="code" href="classdiffbifn.html#0b33e1bfa23be5ed234d172eb4c0e4b5">00078</a>                 <a class="code" href="classdiffbifn.html#0b33e1bfa23be5ed234d172eb4c0e4b5" title="Default constructor (dimy is not set!).">diffbifn</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rvx0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rvu0 ) : rvx ( rvx0 ),rvu ( rvu0 ) {dimx=rvx.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>();dimu=rvu.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>();}; 
    77 <a name="l00080"></a><a class="code" href="classdiffbifn.html#436de7a7301ea9eac7d6081b893bbf57">00080</a>                 <span class="keywordtype">int</span> <a class="code" href="classdiffbifn.html#436de7a7301ea9eac7d6081b893bbf57" title="access function">_dimx</a>()<span class="keyword"> const</span>{<span class="keywordflow">return</span> dimx;} 
    78 <a name="l00082"></a><a class="code" href="classdiffbifn.html#fc8779acbff170611aff0ee70cee3879">00082</a>                 <span class="keywordtype">int</span> <a class="code" href="classdiffbifn.html#fc8779acbff170611aff0ee70cee3879" title="access function">_dimu</a>()<span class="keyword"> const</span>{<span class="keywordflow">return</span> dimu;} 
    79 <a name="l00083"></a>00083 }; 
    80 <a name="l00084"></a>00084  
    81 <a name="l00086"></a>00086 <span class="comment">//TODO can be generalized into multilinear form!</span> 
    82 <a name="l00087"></a><a class="code" href="classbilinfn.html">00087</a> <span class="keyword">class </span><a class="code" href="classbilinfn.html" title="Class representing function $f(x,u) = Ax+Bu$.">bilinfn</a>: <span class="keyword">public</span> <a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables $f(x,u)$.">diffbifn</a> 
    83 <a name="l00088"></a>00088 { 
    84 <a name="l00089"></a>00089                 mat A; 
    85 <a name="l00090"></a>00090                 mat B; 
    86 <a name="l00091"></a>00091         <span class="keyword">public</span> : 
    87 <a name="l00092"></a>00092                 vec <a class="code" href="classbilinfn.html#e36a16e72e7f9fedf3cb18d2d5505a24" title="Evaluates $f(x0,u0)$.">eval</a> ( <span class="keyword">const</span>  vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ); 
    88 <a name="l00093"></a>00093  
    89 <a name="l00095"></a><a class="code" href="classbilinfn.html#af9f36282730d910a41b95f4d1fb8221">00095</a>                 <a class="code" href="classbilinfn.html#af9f36282730d910a41b95f4d1fb8221" title="Default constructor.">bilinfn</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvx0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvu0 ) : <a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables $f(x,u)$.">diffbifn</a> ( rvx0,rvu0 ) ,A ( eye ( dimx ) ),B ( zeros ( dimx,dimu ) )       {}; 
    90 <a name="l00096"></a>00096                 <span class="comment">//</span> 
    91 <a name="l00097"></a>00097                 <a class="code" href="classbilinfn.html#af9f36282730d910a41b95f4d1fb8221" title="Default constructor.">bilinfn</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvx0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvu0, <span class="keyword">const</span> mat &amp;A0, <span class="keyword">const</span> mat &amp;B0 ); 
    92 <a name="l00098"></a>00098                 <span class="comment">//</span> 
    93 <a name="l00099"></a><a class="code" href="classbilinfn.html#79c022de8dbe2b054bb9cc49345f3ef5">00099</a>                 <span class="keywordtype">void</span> <a class="code" href="classbilinfn.html#79c022de8dbe2b054bb9cc49345f3ef5" 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;F, <span class="keywordtype">bool</span> full ) 
    94 <a name="l00100"></a>00100                 { 
    95 <a name="l00101"></a>00101                         it_assert_debug ( ( F.cols() ==A.cols() ) &amp; ( F.rows() ==A.rows() ),<span class="stringliteral">"Allocated F is not compatible."</span> ); 
    96 <a name="l00102"></a>00102                         <span class="keywordflow">if</span> ( full ) F=A;        <span class="comment">//else : nothing has changed no need to regenerate</span> 
    97 <a name="l00103"></a>00103                 } 
    98 <a name="l00104"></a>00104                 <span class="comment">//</span> 
    99 <a name="l00105"></a><a class="code" href="classbilinfn.html#90f2b15612b14883d6ed2b0e295cb82b">00105</a>                 <span class="keywordtype">void</span> <a class="code" href="classbilinfn.html#90f2b15612b14883d6ed2b0e295cb82b" 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;F,  <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) 
    100 <a name="l00106"></a>00106                 { 
    101 <a name="l00107"></a>00107                         it_assert_debug ( ( F.cols() ==B.cols() ) &amp; ( F.rows() ==B.rows() ),<span class="stringliteral">"Allocated F is not compatible."</span> ); 
    102 <a name="l00108"></a>00108                         <span class="keywordflow">if</span> ( full ) F=B;        <span class="comment">//else : nothing has changed no need to regenerate</span> 
    103 <a name="l00109"></a>00109                 } 
    104 <a name="l00110"></a>00110 }; 
    105 </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Thu Feb 28 16:54:40 2008 for mixpp by&nbsp; 
     27<a name="l00012"></a>00012 <span class="preprocessor">#ifndef FN_H</span> 
     28<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#define FN_H</span> 
     29<a name="l00014"></a>00014 <span class="preprocessor"></span> 
     30<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;itpp/itbase.h&gt;</span> 
     31<a name="l00016"></a>00016 <span class="preprocessor">#include "<a class="code" href="libBM_8h.html" title="Bayesian Models (bm) that use Bayes rule to learn from observations.">libBM.h</a>"</span> 
     32<a name="l00017"></a>00017  
     33<a name="l00018"></a>00018 <span class="keyword">using namespace </span>itpp; 
     34<a name="l00019"></a>00019  
     35<a name="l00021"></a><a class="code" href="classconstfn.html">00021</a> <span class="keyword">class </span><a class="code" href="classconstfn.html" title="class representing function $f(x) = a$, here rv is empty">constfn</a> : <span class="keyword">public</span> <a class="code" href="classfnc.html" title="Class representing function $f(x)$ of variable $x$ represented by rv.">fnc</a> 
     36<a name="l00022"></a>00022 { 
     37<a name="l00024"></a>00024                 vec val; 
     38<a name="l00025"></a>00025  
     39<a name="l00026"></a>00026         <span class="keyword">public</span>: 
     40<a name="l00027"></a>00027                 <span class="comment">//vec eval() {return val;};</span> 
     41<a name="l00029"></a><a class="code" href="classconstfn.html#0411f603cbf675f2bc04a8f85e4e3b52">00029</a> <span class="comment"></span>                vec <a class="code" href="classconstfn.html#0411f603cbf675f2bc04a8f85e4e3b52" title="inherited">eval</a> ( <span class="keyword">const</span> vec &amp;cond ) {<span class="keywordflow">return</span> val;}; 
     42<a name="l00031"></a><a class="code" href="classconstfn.html#d08acd7fac0ef3edfa59bbe48403f2bc">00031</a>                 <a class="code" href="classconstfn.html#d08acd7fac0ef3edfa59bbe48403f2bc" title="Default constructor.">constfn</a> ( <span class="keyword">const</span> vec &amp;val0 ) :val ( val0 ) {}; 
     43<a name="l00032"></a>00032 }; 
     44<a name="l00033"></a>00033  
     45<a name="l00035"></a><a class="code" href="classlinfn.html">00035</a> <span class="keyword">class </span><a class="code" href="classlinfn.html" title="Class representing function $f(x) = Ax+B$.">linfn</a>: <span class="keyword">public</span> <a class="code" href="classfnc.html" title="Class representing function $f(x)$ of variable $x$ represented by rv.">fnc</a> 
     46<a name="l00036"></a>00036 { 
     47<a name="l00038"></a>00038                 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv; 
     48<a name="l00040"></a>00040                 mat A; 
     49<a name="l00042"></a>00042                 vec B; 
     50<a name="l00043"></a>00043         <span class="keyword">public</span> : 
     51<a name="l00044"></a><a class="code" href="classlinfn.html#fac0e56701f4c7beaf1c91f9b2a55f0b">00044</a>                 vec <a class="code" href="classlinfn.html#fac0e56701f4c7beaf1c91f9b2a55f0b" title="function evaluates numerical value of $f(x)$ at $x=cond$">eval</a> (<span class="keyword">const</span> vec &amp;cond ) {it_assert_debug ( cond.length() ==rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>(), <span class="stringliteral">"linfn::eval Wrong cond."</span> );<span class="keywordflow">return</span> A*cond+B;}; 
     52<a name="l00045"></a>00045  
     53<a name="l00046"></a>00046 <span class="comment">//              linfn evalsome ( ivec &amp;rvind );</span> 
     54<a name="l00048"></a><a class="code" href="classlinfn.html#01c70122a7783ddb0d87e6a82685adcb">00048</a> <span class="comment"></span>                <a class="code" href="classlinfn.html#01c70122a7783ddb0d87e6a82685adcb" title="default constructor">linfn</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv0 ) :rv ( rv0 ),A ( eye ( rv0.count() ) ),B ( zeros ( rv0.count() ) ) { }; 
     55<a name="l00050"></a><a class="code" href="classlinfn.html#15eb81f2141984a61706b7ad5b411505">00050</a>                 <span class="keywordtype">void</span> <a class="code" href="classlinfn.html#15eb81f2141984a61706b7ad5b411505" title="Set values of A and B.">set_parameters</a> ( <span class="keyword">const</span> mat &amp;A0 , <span class="keyword">const</span> vec &amp;B0 ) {A=A0; B=B0;}; 
     56<a name="l00051"></a>00051 }; 
     57<a name="l00052"></a>00052  
     58<a name="l00053"></a>00053  
     59<a name="l00063"></a><a class="code" href="classdiffbifn.html">00063</a> <span class="keyword">class </span><a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables $f(x,u)$.">diffbifn</a>: <span class="keyword">public</span> <a class="code" href="classfnc.html" title="Class representing function $f(x)$ of variable $x$ represented by rv.">fnc</a> 
     60<a name="l00064"></a>00064 { 
     61<a name="l00065"></a>00065         <span class="keyword">protected</span>: 
     62<a name="l00067"></a><a class="code" href="classdiffbifn.html#bcf96b86250c3cbd465ba5ee62474b75">00067</a>                 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classdiffbifn.html#bcf96b86250c3cbd465ba5ee62474b75" title="Indentifier of the first rv.">rvx</a>; 
     63<a name="l00069"></a><a class="code" href="classdiffbifn.html#c41c74c7942dba51ef0b0bfed963447d">00069</a>                 <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classdiffbifn.html#c41c74c7942dba51ef0b0bfed963447d" title="Indentifier of the second rv.">rvu</a>; 
     64<a name="l00071"></a><a class="code" href="classdiffbifn.html#f6918bc0a9dad656b4cddc028137eb78">00071</a>                 <span class="keywordtype">int</span> <a class="code" href="classdiffbifn.html#f6918bc0a9dad656b4cddc028137eb78" title="cache for rvx.count()">dimx</a>; 
     65<a name="l00073"></a><a class="code" href="classdiffbifn.html#2e07ce491e973f03d763e37624d0fe79">00073</a>                 <span class="keywordtype">int</span> <a class="code" href="classdiffbifn.html#2e07ce491e973f03d763e37624d0fe79" title="cache for rvu.count()">dimu</a>; 
     66<a name="l00074"></a>00074         <span class="keyword">public</span>: 
     67<a name="l00076"></a><a class="code" href="classdiffbifn.html#ad7673e16aa1a046b131b24c731c4632">00076</a>                 vec <a class="code" href="classdiffbifn.html#ad7673e16aa1a046b131b24c731c4632" title="Evaluates $f(x0,u0)$ (VS: Do we really need common eval? ).">eval</a> ( <span class="keyword">const</span> vec &amp;cond ) 
     68<a name="l00077"></a>00077                 { 
     69<a name="l00078"></a>00078                         it_assert_debug ( cond.length() == ( <a class="code" href="classdiffbifn.html#f6918bc0a9dad656b4cddc028137eb78" title="cache for rvx.count()">dimx</a>+<a class="code" href="classdiffbifn.html#2e07ce491e973f03d763e37624d0fe79" title="cache for rvu.count()">dimu</a> ), <span class="stringliteral">"linfn::eval Wrong cond."</span> ); 
     70<a name="l00079"></a>00079                         <span class="keywordflow">return</span> <a class="code" href="classdiffbifn.html#ad7673e16aa1a046b131b24c731c4632" title="Evaluates $f(x0,u0)$ (VS: Do we really need common eval? ).">eval</a> ( cond ( 0,<a class="code" href="classdiffbifn.html#f6918bc0a9dad656b4cddc028137eb78" title="cache for rvx.count()">dimx</a>-1 ),cond ( <a class="code" href="classdiffbifn.html#f6918bc0a9dad656b4cddc028137eb78" title="cache for rvx.count()">dimx</a>,<a class="code" href="classdiffbifn.html#f6918bc0a9dad656b4cddc028137eb78" title="cache for rvx.count()">dimx</a>+<a class="code" href="classdiffbifn.html#2e07ce491e973f03d763e37624d0fe79" title="cache for rvu.count()">dimu</a> ) );<span class="comment">//-1 = end (in matlab)</span> 
     71<a name="l00080"></a>00080                 }; 
     72<a name="l00081"></a>00081  
     73<a name="l00083"></a><a class="code" href="classdiffbifn.html#40d8a7eee45acc55cda33d43282faa03">00083</a>                 <span class="keyword">virtual</span> vec <a class="code" href="classdiffbifn.html#ad7673e16aa1a046b131b24c731c4632" title="Evaluates $f(x0,u0)$ (VS: Do we really need common eval? ).">eval</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) {<span class="keywordflow">return</span> zeros ( <a class="code" href="classfnc.html#22d51d10a7901331167f64f80d1af8e9" title="Length of the output vector.">dimy</a> );}; 
     74<a name="l00085"></a><a class="code" href="classdiffbifn.html#6d217a02d4fa13931258d4bebdd0feb4">00085</a>                 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdiffbifn.html#6d217a02d4fa13931258d4bebdd0feb4" 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> ) {}; 
     75<a name="l00087"></a><a class="code" href="classdiffbifn.html#1978bafd7909d15c139a08c495c24aa0">00087</a>                 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classdiffbifn.html#1978bafd7909d15c139a08c495c24aa0" 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> ) {}; 
     76<a name="l00089"></a><a class="code" href="classdiffbifn.html#0b33e1bfa23be5ed234d172eb4c0e4b5">00089</a>                 <a class="code" href="classdiffbifn.html#0b33e1bfa23be5ed234d172eb4c0e4b5" title="Default constructor (dimy is not set!).">diffbifn</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rvx0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rvu0 ) : <a class="code" href="classdiffbifn.html#bcf96b86250c3cbd465ba5ee62474b75" title="Indentifier of the first rv.">rvx</a> ( rvx0 ),<a class="code" href="classdiffbifn.html#c41c74c7942dba51ef0b0bfed963447d" title="Indentifier of the second rv.">rvu</a> ( rvu0 ) {<a class="code" href="classdiffbifn.html#f6918bc0a9dad656b4cddc028137eb78" title="cache for rvx.count()">dimx</a>=<a class="code" href="classdiffbifn.html#bcf96b86250c3cbd465ba5ee62474b75" title="Indentifier of the first rv.">rvx</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>();<a class="code" href="classdiffbifn.html#2e07ce491e973f03d763e37624d0fe79" title="cache for rvu.count()">dimu</a>=<a class="code" href="classdiffbifn.html#c41c74c7942dba51ef0b0bfed963447d" title="Indentifier of the second rv.">rvu</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>();}; 
     77<a name="l00091"></a><a class="code" href="classdiffbifn.html#436de7a7301ea9eac7d6081b893bbf57">00091</a>                 <span class="keywordtype">int</span> <a class="code" href="classdiffbifn.html#436de7a7301ea9eac7d6081b893bbf57" title="access function">_dimx</a>()<span class="keyword"> const</span>{<span class="keywordflow">return</span> <a class="code" href="classdiffbifn.html#f6918bc0a9dad656b4cddc028137eb78" title="cache for rvx.count()">dimx</a>;} 
     78<a name="l00093"></a><a class="code" href="classdiffbifn.html#fc8779acbff170611aff0ee70cee3879">00093</a>                 <span class="keywordtype">int</span> <a class="code" href="classdiffbifn.html#fc8779acbff170611aff0ee70cee3879" title="access function">_dimu</a>()<span class="keyword"> const</span>{<span class="keywordflow">return</span> <a class="code" href="classdiffbifn.html#2e07ce491e973f03d763e37624d0fe79" title="cache for rvu.count()">dimu</a>;} 
     79<a name="l00094"></a>00094 }; 
     80<a name="l00095"></a>00095  
     81<a name="l00097"></a>00097 <span class="comment">//TODO can be generalized into multilinear form!</span> 
     82<a name="l00098"></a><a class="code" href="classbilinfn.html">00098</a> <span class="keyword">class </span><a class="code" href="classbilinfn.html" title="Class representing function $f(x,u) = Ax+Bu$.">bilinfn</a>: <span class="keyword">public</span> <a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables $f(x,u)$.">diffbifn</a> 
     83<a name="l00099"></a>00099 { 
     84<a name="l00100"></a>00100                 mat A; 
     85<a name="l00101"></a>00101                 mat B; 
     86<a name="l00102"></a>00102         <span class="keyword">public</span> : 
     87<a name="l00103"></a>00103                 vec <a class="code" href="classbilinfn.html#e36a16e72e7f9fedf3cb18d2d5505a24" title="Evaluates $f(x0,u0)$.">eval</a> ( <span class="keyword">const</span>  vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ); 
     88<a name="l00104"></a>00104  
     89<a name="l00106"></a><a class="code" href="classbilinfn.html#af9f36282730d910a41b95f4d1fb8221">00106</a>                 <a class="code" href="classbilinfn.html#af9f36282730d910a41b95f4d1fb8221" title="Default constructor.">bilinfn</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvx0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvu0 ) : <a class="code" href="classdiffbifn.html" title="Class representing a differentiable function of two variables $f(x,u)$.">diffbifn</a> ( rvx0,rvu0 ) ,A ( eye ( <a class="code" href="classdiffbifn.html#f6918bc0a9dad656b4cddc028137eb78" title="cache for rvx.count()">dimx</a> ) ),B ( zeros ( <a class="code" href="classdiffbifn.html#f6918bc0a9dad656b4cddc028137eb78" title="cache for rvx.count()">dimx</a>,<a class="code" href="classdiffbifn.html#2e07ce491e973f03d763e37624d0fe79" title="cache for rvu.count()">dimu</a> ) )       {}; 
     90<a name="l00108"></a>00108                 <a class="code" href="classbilinfn.html#af9f36282730d910a41b95f4d1fb8221" title="Default constructor.">bilinfn</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvx0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvu0, <span class="keyword">const</span> mat &amp;A0, <span class="keyword">const</span> mat &amp;B0 ); 
     91<a name="l00110"></a><a class="code" href="classbilinfn.html#79c022de8dbe2b054bb9cc49345f3ef5">00110</a>                 <span class="keywordtype">void</span> <a class="code" href="classbilinfn.html#79c022de8dbe2b054bb9cc49345f3ef5" 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;F, <span class="keywordtype">bool</span> full ) 
     92<a name="l00111"></a>00111                 { 
     93<a name="l00112"></a>00112                         it_assert_debug ( ( F.cols() ==A.cols() ) &amp; ( F.rows() ==A.rows() ),<span class="stringliteral">"Allocated F is not compatible."</span> ); 
     94<a name="l00113"></a>00113                         <span class="keywordflow">if</span> ( full ) F=A;        <span class="comment">//else : nothing has changed no need to regenerate</span> 
     95<a name="l00114"></a>00114                 } 
     96<a name="l00116"></a><a class="code" href="classbilinfn.html#90f2b15612b14883d6ed2b0e295cb82b">00116</a>                 <span class="keywordtype">void</span> <a class="code" href="classbilinfn.html#90f2b15612b14883d6ed2b0e295cb82b" 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;F,  <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) 
     97<a name="l00117"></a>00117                 { 
     98<a name="l00118"></a>00118                         it_assert_debug ( ( F.cols() ==B.cols() ) &amp; ( F.rows() ==B.rows() ),<span class="stringliteral">"Allocated F is not compatible."</span> ); 
     99<a name="l00119"></a>00119                         <span class="keywordflow">if</span> ( full ) F=B;        <span class="comment">//else : nothing has changed no need to regenerate</span> 
     100<a name="l00120"></a>00120                 } 
     101<a name="l00121"></a>00121 }; 
     102<a name="l00122"></a>00122  
     103<a name="l00123"></a>00123 <span class="preprocessor">#endif // FN_H</span> 
     104</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Wed Mar 5 15:40:01 2008 for mixpp by&nbsp; 
    106105<a href="http://www.doxygen.org/index.html"> 
    107106<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>