65 | | <a name="l00063"></a>00063 <span class="keywordtype">int</span> dimy; |
66 | | <a name="l00064"></a>00064 <span class="keyword">public</span>: |
67 | | <a name="l00066"></a><a class="code" href="classdiffbifn.html#ad7673e16aa1a046b131b24c731c4632">00066</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 &cond ) |
68 | | <a name="l00067"></a>00067 { |
69 | | <a name="l00068"></a>00068 it_assert_debug ( cond.length() == ( dimx+dimu ), <span class="stringliteral">"linfn::eval Wrong cond."</span> ); |
70 | | <a name="l00069"></a>00069 <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="l00070"></a>00070 }; |
72 | | <a name="l00071"></a>00071 |
73 | | <a name="l00073"></a><a class="code" href="classdiffbifn.html#40d8a7eee45acc55cda33d43282faa03">00073</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 &x0, <span class="keyword">const</span> vec &u0 ) {<span class="keywordflow">return</span> zeros ( dimy );}; |
74 | | <a name="l00075"></a><a class="code" href="classdiffbifn.html#6d217a02d4fa13931258d4bebdd0feb4">00075</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 &x0, <span class="keyword">const</span> vec &u0, mat &A , <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {}; |
75 | | <a name="l00077"></a><a class="code" href="classdiffbifn.html#1978bafd7909d15c139a08c495c24aa0">00077</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 &x0, <span class="keyword">const</span> vec &u0, mat &A, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) {}; |
76 | | <a name="l00079"></a><a class="code" href="classdiffbifn.html#0b33e1bfa23be5ed234d172eb4c0e4b5">00079</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="l00081"></a><a class="code" href="classdiffbifn.html#436de7a7301ea9eac7d6081b893bbf57">00081</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="l00083"></a><a class="code" href="classdiffbifn.html#fc8779acbff170611aff0ee70cee3879">00083</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="l00084"></a>00084 }; |
80 | | <a name="l00085"></a>00085 |
81 | | <a name="l00087"></a>00087 <span class="comment">//TODO can be generalized into multilinear form!</span> |
82 | | <a name="l00088"></a><a class="code" href="classbilinfn.html">00088</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="l00089"></a>00089 { |
84 | | <a name="l00090"></a>00090 mat A; |
85 | | <a name="l00091"></a>00091 mat B; |
86 | | <a name="l00092"></a>00092 <span class="keyword">public</span> : |
87 | | <a name="l00093"></a>00093 vec <a class="code" href="classbilinfn.html#e36a16e72e7f9fedf3cb18d2d5505a24" title="Evaluates $f(x0,u0)$.">eval</a> ( <span class="keyword">const</span> vec &x0, <span class="keyword">const</span> vec &u0 ); |
88 | | <a name="l00094"></a>00094 |
89 | | <a name="l00096"></a><a class="code" href="classbilinfn.html#af9f36282730d910a41b95f4d1fb8221">00096</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> &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" 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="l00097"></a>00097 <span class="comment">//</span> |
91 | | <a name="l00098"></a>00098 <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> &rvx0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvu0, <span class="keyword">const</span> mat &A0, <span class="keyword">const</span> mat &B0 ); |
92 | | <a name="l00099"></a>00099 <span class="comment">//</span> |
93 | | <a name="l00100"></a><a class="code" href="classbilinfn.html#79c022de8dbe2b054bb9cc49345f3ef5">00100</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 &x0, <span class="keyword">const</span> vec &u0, mat &F, <span class="keywordtype">bool</span> full ) |
94 | | <a name="l00101"></a>00101 { |
95 | | <a name="l00102"></a>00102 it_assert_debug ( ( F.cols() ==A.cols() ) & ( F.rows() ==A.rows() ),<span class="stringliteral">"Allocated F is not compatible."</span> ); |
96 | | <a name="l00103"></a>00103 <span class="keywordflow">if</span> ( full ) F=A; <span class="comment">//else : nothing has changed no need to regenerate</span> |
97 | | <a name="l00104"></a>00104 } |
98 | | <a name="l00105"></a>00105 <span class="comment">//</span> |
99 | | <a name="l00106"></a><a class="code" href="classbilinfn.html#90f2b15612b14883d6ed2b0e295cb82b">00106</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 &x0, <span class="keyword">const</span> vec &u0, mat &F, <span class="keywordtype">bool</span> full=<span class="keyword">true</span> ) |
100 | | <a name="l00107"></a>00107 { |
101 | | <a name="l00108"></a>00108 it_assert_debug ( ( F.cols() ==B.cols() ) & ( F.rows() ==B.rows() ),<span class="stringliteral">"Allocated F is not compatible."</span> ); |
102 | | <a name="l00109"></a>00109 <span class="keywordflow">if</span> ( full ) F=B; <span class="comment">//else : nothing has changed no need to regenerate</span> |
103 | | <a name="l00110"></a>00110 } |
104 | | <a name="l00111"></a>00111 }; |
105 | | </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Sun Feb 17 16:14:14 2008 for mixpp by |
| 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 &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 &x0, <span class="keyword">const</span> vec &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 &x0, <span class="keyword">const</span> vec &u0, mat &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 &x0, <span class="keyword">const</span> vec &u0, mat &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 &x0, <span class="keyword">const</span> vec &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> &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" 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> &rvx0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvu0, <span class="keyword">const</span> mat &A0, <span class="keyword">const</span> mat &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 &x0, <span class="keyword">const</span> vec &u0, mat &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() ) & ( 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 &x0, <span class="keyword">const</span> vec &u0, mat &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() ) & ( 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 Mon Feb 18 21:48:39 2008 for mixpp by |