Show
Ignore:
Timestamp:
08/30/09 22:13:15 (15 years ago)
Author:
smidl
Message:

doc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/doc/html/functions_8h_source.html

    r472 r591  
    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"> 
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     2<html xmlns="http://www.w3.org/1999/xhtml"> 
     3<head> 
     4<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 
    35<title>mixpp: functions.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.9 --> 
     6<link href="tabs.css" rel="stylesheet" type="text/css"/> 
     7<link href="doxygen.css" rel="stylesheet" type="text/css"/> 
     8</head> 
     9<body> 
     10<!-- Generated by Doxygen 1.6.1 --> 
    811<script type="text/javascript"> 
    912<!-- 
     
    7679<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#define FN_H</span> 
    7780<a name="l00014"></a>00014 <span class="preprocessor"></span> 
    78 <a name="l00015"></a>00015 <span class="preprocessor">#include "../base/bdmbase.h"</span> 
    79 <a name="l00016"></a>00016  
    80 <a name="l00017"></a>00017 <span class="keyword">namespace </span>bdm{ 
    81 <a name="l00018"></a>00018  
    82 <a name="l00020"></a><a class="code" href="classbdm_1_1constfn.html">00020</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1constfn.html" title="class representing function , here rv is empty">constfn</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a> 
    83 <a name="l00021"></a>00021 { 
    84 <a name="l00023"></a>00023                 vec val; 
     81<a name="l00015"></a>00015 <span class="preprocessor">#include &quot;../bdmerror.h&quot;</span> 
     82<a name="l00016"></a>00016 <span class="preprocessor">#include &quot;../base/bdmbase.h&quot;</span> 
     83<a name="l00017"></a>00017  
     84<a name="l00018"></a>00018 <span class="keyword">namespace </span>bdm { 
     85<a name="l00019"></a>00019  
     86<a name="l00021"></a><a class="code" href="classbdm_1_1constfn.html">00021</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1constfn.html" title="class representing function , here rv is empty">constfn</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a> { 
     87<a name="l00023"></a>00023         vec val; 
    8588<a name="l00024"></a>00024  
    86 <a name="l00025"></a>00025         <span class="keyword">public</span>: 
    87 <a name="l00026"></a>00026                 <span class="comment">//vec eval() {return val;};</span> 
    88 <a name="l00028"></a><a class="code" href="classbdm_1_1constfn.html#33c2631ddcad9e81ef4b743d83eed4d4">00028</a> <span class="comment"></span>                vec <a class="code" href="classbdm_1_1constfn.html#33c2631ddcad9e81ef4b743d83eed4d4" title="inherited">eval</a> ( <span class="keyword">const</span> vec &amp;cond ) {<span class="keywordflow">return</span> val;}; 
    89 <a name="l00030"></a><a class="code" href="classbdm_1_1constfn.html#7df0693d3ef4f1d2a52a5a3c3fce44af">00030</a>                 <a class="code" href="classbdm_1_1constfn.html#7df0693d3ef4f1d2a52a5a3c3fce44af" title="Default constructor.">constfn</a> ( <span class="keyword">const</span> vec &amp;val0 ) :<a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a>(), val ( val0 ) {<a class="code" href="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>=val.length();}; 
    90 <a name="l00031"></a>00031 }; 
    91 <a name="l00032"></a>00032  
    92 <a name="l00034"></a><a class="code" href="classbdm_1_1linfn.html">00034</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1linfn.html" title="Class representing function .">linfn</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a> 
    93 <a name="l00035"></a>00035 { 
    94 <a name="l00037"></a>00037                 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rv; 
    95 <a name="l00039"></a>00039                 mat A; 
    96 <a name="l00041"></a>00041                 vec B; 
    97 <a name="l00042"></a>00042         <span class="keyword">public</span> : 
    98 <a name="l00043"></a><a class="code" href="classbdm_1_1linfn.html#b8063094a2aa210dcf7ae73e2b85e09c">00043</a>                 vec <a class="code" href="classbdm_1_1linfn.html#b8063094a2aa210dcf7ae73e2b85e09c" title="function evaluates numerical value of  at  cond ">eval</a> (<span class="keyword">const</span> vec &amp;cond ) {it_assert_debug ( cond.length() ==A.cols(), <span class="stringliteral">"linfn::eval Wrong cond."</span> );<span class="keywordflow">return</span> A*cond+B;}; 
    99 <a name="l00044"></a>00044  
    100 <a name="l00045"></a>00045 <span class="comment">//              linfn evalsome ( ivec &amp;rvind );</span> 
    101 <a name="l00047"></a><a class="code" href="classbdm_1_1linfn.html#b39c494c12863c031eb2acf86c0bc429">00047</a> <span class="comment"></span>                <a class="code" href="classbdm_1_1linfn.html#b39c494c12863c031eb2acf86c0bc429" title="default constructor">linfn</a> ( ) : <a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a>(), A ( ),B () { }; 
    102 <a name="l00049"></a><a class="code" href="classbdm_1_1linfn.html#7e0e714b814532fc3e38daede24c5e68">00049</a>                 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1linfn.html#7e0e714b814532fc3e38daede24c5e68" 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; <a class="code" href="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>=A.rows();}; 
    103 <a name="l00050"></a>00050 }; 
    104 <a name="l00051"></a>00051  
    105 <a name="l00052"></a>00052  
    106 <a name="l00062"></a><a class="code" href="classbdm_1_1diffbifn.html">00062</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a> 
    107 <a name="l00063"></a>00063 { 
    108 <a name="l00064"></a>00064         <span class="keyword">protected</span>: 
    109 <a name="l00066"></a><a class="code" href="classbdm_1_1diffbifn.html#5f56547d8e9378b669d3cc19d7831cbb">00066</a>                 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1diffbifn.html#5f56547d8e9378b669d3cc19d7831cbb" title="Indentifier of the first rv.">rvx</a>; 
    110 <a name="l00068"></a><a class="code" href="classbdm_1_1diffbifn.html#a8e3e861d5ec2a7ae9524e6338e58320">00068</a>                 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1diffbifn.html#a8e3e861d5ec2a7ae9524e6338e58320" title="Indentifier of the second rv.">rvu</a>; 
    111 <a name="l00070"></a><a class="code" href="classbdm_1_1diffbifn.html#a193aa2c4a500139c0c4b669691e588e">00070</a>                 <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1diffbifn.html#a193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>; 
    112 <a name="l00072"></a><a class="code" href="classbdm_1_1diffbifn.html#30c45617eec89adeb4ebaa763d093fb0">00072</a>                 <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1diffbifn.html#30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a>; 
    113 <a name="l00073"></a>00073         <span class="keyword">public</span>: 
    114 <a name="l00075"></a><a class="code" href="classbdm_1_1diffbifn.html#188f31066bd72e1bf0ddacd1eb0e6af3">00075</a>                 vec <a class="code" href="classbdm_1_1diffbifn.html#188f31066bd72e1bf0ddacd1eb0e6af3" title="Evaluates  (VS: Do we really need common eval? ).">eval</a> ( <span class="keyword">const</span> vec &amp;cond ) 
    115 <a name="l00076"></a>00076                 { 
    116 <a name="l00077"></a>00077                         it_assert_debug ( cond.length() == ( <a class="code" href="classbdm_1_1diffbifn.html#a193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>+<a class="code" href="classbdm_1_1diffbifn.html#30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a> ), <span class="stringliteral">"linfn::eval Wrong cond."</span> ); 
    117 <a name="l00078"></a>00078                         <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1diffbifn.html#188f31066bd72e1bf0ddacd1eb0e6af3" title="Evaluates  (VS: Do we really need common eval? ).">eval</a> ( cond ( 0,<a class="code" href="classbdm_1_1diffbifn.html#a193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>-1 ),cond ( <a class="code" href="classbdm_1_1diffbifn.html#a193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>,<a class="code" href="classbdm_1_1diffbifn.html#a193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>+<a class="code" href="classbdm_1_1diffbifn.html#30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a>-1 ) );<span class="comment">//-1 = end (in matlab)</span> 
    118 <a name="l00079"></a>00079                 }; 
    119 <a name="l00080"></a>00080  
    120 <a name="l00082"></a><a class="code" href="classbdm_1_1diffbifn.html#b5462c05b58cd38367ff946836bb82d3">00082</a>                 <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1diffbifn.html#b5462c05b58cd38367ff946836bb82d3" title="Evaluates .">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="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a> );}; 
    121 <a name="l00084"></a><a class="code" href="classbdm_1_1diffbifn.html#651184f808a35f236dbfea21aca1b6ac">00084</a>                 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1diffbifn.html#651184f808a35f236dbfea21aca1b6ac" 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> ) {}; 
    122 <a name="l00086"></a><a class="code" href="classbdm_1_1diffbifn.html#6ea1dc7a482601b29c5ba36a52d20d07">00086</a>                 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1diffbifn.html#6ea1dc7a482601b29c5ba36a52d20d07" 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> ) {}; 
    123 <a name="l00088"></a><a class="code" href="classbdm_1_1diffbifn.html#92ff29d748e445b440453a38d0b09681">00088</a>                 <a class="code" href="classbdm_1_1diffbifn.html#92ff29d748e445b440453a38d0b09681" title="Default constructor (dimy is not set!).">diffbifn</a> () : <a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a>() {}; 
    124 <a name="l00090"></a><a class="code" href="classbdm_1_1diffbifn.html#1b3c8f5949f13d86d2661e191d4b369b">00090</a>                 <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1diffbifn.html#1b3c8f5949f13d86d2661e191d4b369b" title="access function">_dimx</a>()<span class="keyword"> const</span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1diffbifn.html#a193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>;} 
    125 <a name="l00092"></a><a class="code" href="classbdm_1_1diffbifn.html#031458f38c97cdb3aecde16f6a06dced">00092</a>                 <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1diffbifn.html#031458f38c97cdb3aecde16f6a06dced" title="access function">_dimu</a>()<span class="keyword"> const</span>{<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1diffbifn.html#30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a>;} 
    126 <a name="l00093"></a>00093 }; 
    127 <a name="l00094"></a>00094  
    128 <a name="l00096"></a>00096 <span class="comment">//TODO can be generalized into multilinear form!</span> 
    129 <a name="l00097"></a><a class="code" href="classbdm_1_1bilinfn.html">00097</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1bilinfn.html" title="Class representing function .">bilinfn</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> 
    130 <a name="l00098"></a>00098 { 
    131 <a name="l00099"></a>00099                 mat A; 
    132 <a name="l00100"></a>00100                 mat B; 
    133 <a name="l00101"></a>00101         <span class="keyword">public</span> : 
    134 <a name="l00104"></a>00104                  
    135 <a name="l00105"></a>00105                 <a class="code" href="classbdm_1_1bilinfn.html" title="Class representing function .">bilinfn</a> () : <a class="code" href="classbdm_1_1diffbifn.html#92ff29d748e445b440453a38d0b09681" title="Default constructor (dimy is not set!).">diffbifn</a> () ,A() ,B()      {}; 
    136 <a name="l00106"></a>00106                 <a class="code" href="classbdm_1_1bilinfn.html" title="Class representing function .">bilinfn</a> (<span class="keyword">const</span> mat A0, <span class="keyword">const</span> mat B0) {<a class="code" href="classbdm_1_1bilinfn.html#5a508fbb5fc013904d9b62b2231442de" title="Alternative constructor.">set_parameters</a>(A0,B0);}; 
    137 <a name="l00108"></a><a class="code" href="classbdm_1_1bilinfn.html#5a508fbb5fc013904d9b62b2231442de">00108</a>                 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1bilinfn.html#5a508fbb5fc013904d9b62b2231442de" title="Alternative constructor.">set_parameters</a>(<span class="keyword">const</span> mat A0, <span class="keyword">const</span> mat B0){ 
    138 <a name="l00109"></a>00109                         it_assert_debug(A0.rows()==B0.rows(),<span class="stringliteral">""</span>); 
    139 <a name="l00110"></a>00110                         A=A0;B=B0; 
    140 <a name="l00111"></a>00111                         <a class="code" href="classbdm_1_1fnc.html#52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a>=A.rows(); 
    141 <a name="l00112"></a>00112                         <a class="code" href="classbdm_1_1diffbifn.html#a193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>=A.cols(); 
    142 <a name="l00113"></a>00113                         <a class="code" href="classbdm_1_1diffbifn.html#30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a>=B.cols(); 
    143 <a name="l00114"></a>00114                 } 
    144 <a name="l00116"></a>00116                  
    145 <a name="l00119"></a><a class="code" href="classbdm_1_1bilinfn.html#846c21e8e8d41555eb7c075f5ff86ffd">00119</a>                 <span class="keyword">inline</span> vec <a class="code" href="classbdm_1_1bilinfn.html#846c21e8e8d41555eb7c075f5ff86ffd" title="Evaluates .">eval</a> ( <span class="keyword">const</span>  vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) 
    146 <a name="l00120"></a>00120                 { 
    147 <a name="l00121"></a>00121                         it_assert_debug ( x0.length() ==<a class="code" href="classbdm_1_1diffbifn.html#a193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>, <span class="stringliteral">"linfn::eval Wrong xcond."</span> ); 
    148 <a name="l00122"></a>00122                         it_assert_debug ( u0.length() ==<a class="code" href="classbdm_1_1diffbifn.html#30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a>, <span class="stringliteral">"linfn::eval Wrong ucond."</span> ); 
    149 <a name="l00123"></a>00123                         <span class="keywordflow">return</span> A*x0+B*u0; 
    150 <a name="l00124"></a>00124                 } 
    151 <a name="l00125"></a>00125  
    152 <a name="l00126"></a><a class="code" href="classbdm_1_1bilinfn.html#33066f1054dd259df2ec5fafae4b46e6">00126</a>                 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1bilinfn.html#33066f1054dd259df2ec5fafae4b46e6" 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 ) 
    153 <a name="l00127"></a>00127                 { 
    154 <a name="l00128"></a>00128                         it_assert_debug ( ( F.cols() ==A.cols() ) &amp; ( F.rows() ==A.rows() ),<span class="stringliteral">"Allocated F is not compatible."</span> ); 
    155 <a name="l00129"></a>00129                         <span class="keywordflow">if</span> ( full ) F=A;        <span class="comment">//else : nothing has changed no need to regenerate</span> 
    156 <a name="l00130"></a>00130                 } 
    157 <a name="l00132"></a><a class="code" href="classbdm_1_1bilinfn.html#9cfe2f1c115ba7c3c75849a10a4f2c08">00132</a>                 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1bilinfn.html#9cfe2f1c115ba7c3c75849a10a4f2c08" 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> ) 
    158 <a name="l00133"></a>00133                 { 
    159 <a name="l00134"></a>00134                         it_assert_debug ( ( F.cols() ==B.cols() ) &amp; ( F.rows() ==B.rows() ),<span class="stringliteral">"Allocated F is not compatible."</span> ); 
    160 <a name="l00135"></a>00135                         <span class="keywordflow">if</span> ( full ) F=B;        <span class="comment">//else : nothing has changed no need to regenerate</span> 
    161 <a name="l00136"></a>00136                 } 
    162 <a name="l00138"></a>00138 }; 
    163 <a name="l00139"></a>00139  
    164 <a name="l00140"></a>00140 } <span class="comment">//namespace</span> 
    165 <a name="l00141"></a>00141 <span class="preprocessor">#endif // FN_H</span> 
     89<a name="l00025"></a>00025 <span class="keyword">public</span>: 
     90<a name="l00026"></a>00026         <span class="comment">//vec eval() {return val;};</span> 
     91<a name="l00028"></a><a class="code" href="classbdm_1_1constfn.html#a33c2631ddcad9e81ef4b743d83eed4d4">00028</a> <span class="comment"></span>        vec <a class="code" href="classbdm_1_1constfn.html#a33c2631ddcad9e81ef4b743d83eed4d4" title="inherited">eval</a> ( <span class="keyword">const</span> vec &amp;cond ) { 
     92<a name="l00029"></a>00029                 <span class="keywordflow">return</span> val; 
     93<a name="l00030"></a>00030         }; 
     94<a name="l00032"></a><a class="code" href="classbdm_1_1constfn.html#a7df0693d3ef4f1d2a52a5a3c3fce44af">00032</a>         <a class="code" href="classbdm_1_1constfn.html#a7df0693d3ef4f1d2a52a5a3c3fce44af" title="Default constructor.">constfn</a> ( <span class="keyword">const</span> vec &amp;val0 ) : <a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a>(), val ( val0 ) { 
     95<a name="l00033"></a>00033                 <a class="code" href="classbdm_1_1fnc.html#a52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a> = val.length(); 
     96<a name="l00034"></a>00034         }; 
     97<a name="l00035"></a>00035 }; 
     98<a name="l00036"></a>00036  
     99<a name="l00038"></a><a class="code" href="classbdm_1_1linfn.html">00038</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1linfn.html" title="Class representing function .">linfn</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a> { 
     100<a name="l00040"></a>00040         <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rv; 
     101<a name="l00042"></a>00042         mat A; 
     102<a name="l00044"></a>00044         vec B; 
     103<a name="l00045"></a>00045 <span class="keyword">public</span> : 
     104<a name="l00046"></a><a class="code" href="classbdm_1_1linfn.html#ab8063094a2aa210dcf7ae73e2b85e09c">00046</a>         vec <a class="code" href="classbdm_1_1linfn.html#ab8063094a2aa210dcf7ae73e2b85e09c" title="function evaluates numerical value of  at  cond ">eval</a> ( <span class="keyword">const</span> vec &amp;cond ) { 
     105<a name="l00047"></a>00047                 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( cond.length() == A.cols(), <span class="stringliteral">&quot;linfn::eval Wrong cond.&quot;</span> ); 
     106<a name="l00048"></a>00048                 <span class="keywordflow">return</span> A * cond + B; 
     107<a name="l00049"></a>00049         } 
     108<a name="l00050"></a>00050  
     109<a name="l00051"></a>00051 <span class="comment">//              linfn evalsome ( ivec &amp;rvind );</span> 
     110<a name="l00053"></a><a class="code" href="classbdm_1_1linfn.html#ab39c494c12863c031eb2acf86c0bc429">00053</a> <span class="comment"></span>        <a class="code" href="classbdm_1_1linfn.html#ab39c494c12863c031eb2acf86c0bc429" title="default constructor">linfn</a> ( ) : <a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a>(), A ( ), B () { }; 
     111<a name="l00055"></a><a class="code" href="classbdm_1_1linfn.html#a7e0e714b814532fc3e38daede24c5e68">00055</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1linfn.html#a7e0e714b814532fc3e38daede24c5e68" 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 ) { 
     112<a name="l00056"></a>00056                 A = A0; 
     113<a name="l00057"></a>00057                 B = B0; 
     114<a name="l00058"></a>00058                 <a class="code" href="classbdm_1_1fnc.html#a52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a> = A.rows(); 
     115<a name="l00059"></a>00059         }; 
     116<a name="l00060"></a>00060 }; 
     117<a name="l00061"></a>00061  
     118<a name="l00062"></a>00062  
     119<a name="l00072"></a><a class="code" href="classbdm_1_1diffbifn.html">00072</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a> { 
     120<a name="l00073"></a>00073 <span class="keyword">protected</span>: 
     121<a name="l00075"></a><a class="code" href="classbdm_1_1diffbifn.html#a5f56547d8e9378b669d3cc19d7831cbb">00075</a>         <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1diffbifn.html#a5f56547d8e9378b669d3cc19d7831cbb" title="Indentifier of the first rv.">rvx</a>; 
     122<a name="l00077"></a><a class="code" href="classbdm_1_1diffbifn.html#aa8e3e861d5ec2a7ae9524e6338e58320">00077</a>         <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classbdm_1_1diffbifn.html#aa8e3e861d5ec2a7ae9524e6338e58320" title="Indentifier of the second rv.">rvu</a>; 
     123<a name="l00079"></a><a class="code" href="classbdm_1_1diffbifn.html#aa193aa2c4a500139c0c4b669691e588e">00079</a>         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1diffbifn.html#aa193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>; 
     124<a name="l00081"></a><a class="code" href="classbdm_1_1diffbifn.html#a30c45617eec89adeb4ebaa763d093fb0">00081</a>         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1diffbifn.html#a30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a>; 
     125<a name="l00082"></a>00082 <span class="keyword">public</span>: 
     126<a name="l00084"></a><a class="code" href="classbdm_1_1diffbifn.html#a188f31066bd72e1bf0ddacd1eb0e6af3">00084</a>         vec <a class="code" href="classbdm_1_1diffbifn.html#a188f31066bd72e1bf0ddacd1eb0e6af3" title="Evaluates  (VS: Do we really need common eval? ).">eval</a> ( <span class="keyword">const</span> vec &amp;cond ) { 
     127<a name="l00085"></a>00085                 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( cond.length() == ( <a class="code" href="classbdm_1_1diffbifn.html#aa193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a> + <a class="code" href="classbdm_1_1diffbifn.html#a30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a> ), <span class="stringliteral">&quot;linfn::eval Wrong cond.&quot;</span> ); 
     128<a name="l00086"></a>00086                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1diffbifn.html#a188f31066bd72e1bf0ddacd1eb0e6af3" title="Evaluates  (VS: Do we really need common eval? ).">eval</a> ( cond ( 0, <a class="code" href="classbdm_1_1diffbifn.html#aa193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a> - 1 ), cond ( <a class="code" href="classbdm_1_1diffbifn.html#aa193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>, <a class="code" href="classbdm_1_1diffbifn.html#aa193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a> + <a class="code" href="classbdm_1_1diffbifn.html#a30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a> - 1 ) );<span class="comment">//-1 = end (in matlab)</span> 
     129<a name="l00087"></a>00087         } 
     130<a name="l00088"></a>00088  
     131<a name="l00090"></a><a class="code" href="classbdm_1_1diffbifn.html#ab5462c05b58cd38367ff946836bb82d3">00090</a>         <span class="keyword">virtual</span> vec <a class="code" href="classbdm_1_1diffbifn.html#ab5462c05b58cd38367ff946836bb82d3" title="Evaluates .">eval</a> ( <span class="keyword">const</span> vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) { 
     132<a name="l00091"></a>00091                 <span class="keywordflow">return</span> zeros ( <a class="code" href="classbdm_1_1fnc.html#a52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a> ); 
     133<a name="l00092"></a>00092         }; 
     134<a name="l00094"></a><a class="code" href="classbdm_1_1diffbifn.html#a651184f808a35f236dbfea21aca1b6ac">00094</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1diffbifn.html#a651184f808a35f236dbfea21aca1b6ac" 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> ) {}; 
     135<a name="l00096"></a><a class="code" href="classbdm_1_1diffbifn.html#a6ea1dc7a482601b29c5ba36a52d20d07">00096</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1diffbifn.html#a6ea1dc7a482601b29c5ba36a52d20d07" 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> ) {}; 
     136<a name="l00098"></a><a class="code" href="classbdm_1_1diffbifn.html#a92ff29d748e445b440453a38d0b09681">00098</a>         <a class="code" href="classbdm_1_1diffbifn.html#a92ff29d748e445b440453a38d0b09681" title="Default constructor (dimy is not set!).">diffbifn</a> () : <a class="code" href="classbdm_1_1fnc.html" title="Class representing function  of variable  represented by rv.">fnc</a>() {}; 
     137<a name="l00100"></a><a class="code" href="classbdm_1_1diffbifn.html#a1b3c8f5949f13d86d2661e191d4b369b">00100</a>         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1diffbifn.html#a1b3c8f5949f13d86d2661e191d4b369b" title="access function">_dimx</a>()<span class="keyword"> const </span>{ 
     138<a name="l00101"></a>00101                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1diffbifn.html#aa193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>; 
     139<a name="l00102"></a>00102         } 
     140<a name="l00104"></a><a class="code" href="classbdm_1_1diffbifn.html#a031458f38c97cdb3aecde16f6a06dced">00104</a>         <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1diffbifn.html#a031458f38c97cdb3aecde16f6a06dced" title="access function">_dimu</a>()<span class="keyword"> const </span>{ 
     141<a name="l00105"></a>00105                 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1diffbifn.html#a30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a>; 
     142<a name="l00106"></a>00106         } 
     143<a name="l00107"></a>00107 }; 
     144<a name="l00108"></a>00108  
     145<a name="l00110"></a>00110 <span class="comment">//TODO can be generalized into multilinear form!</span> 
     146<a name="l00111"></a><a class="code" href="classbdm_1_1bilinfn.html">00111</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1bilinfn.html" title="Class representing function .">bilinfn</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> { 
     147<a name="l00112"></a>00112         mat A; 
     148<a name="l00113"></a>00113         mat B; 
     149<a name="l00114"></a>00114 <span class="keyword">public</span> : 
     150<a name="l00117"></a>00117  
     151<a name="l00118"></a>00118         <a class="code" href="classbdm_1_1bilinfn.html" title="Class representing function .">bilinfn</a> () : <a class="code" href="classbdm_1_1diffbifn.html#a92ff29d748e445b440453a38d0b09681" title="Default constructor (dimy is not set!).">diffbifn</a> (), A(), B() { } 
     152<a name="l00119"></a>00119  
     153<a name="l00120"></a>00120         <a class="code" href="classbdm_1_1bilinfn.html" title="Class representing function .">bilinfn</a> ( <span class="keyword">const</span> mat &amp;A0, <span class="keyword">const</span> mat &amp;B0 ) { 
     154<a name="l00121"></a>00121                 <a class="code" href="classbdm_1_1bilinfn.html#aa4cc832cf8f54b6f6d9ac0dd8c7899dd" title="Alternative initialization.">set_parameters</a> ( A0, B0 ); 
     155<a name="l00122"></a>00122         } 
     156<a name="l00123"></a>00123  
     157<a name="l00125"></a><a class="code" href="classbdm_1_1bilinfn.html#aa4cc832cf8f54b6f6d9ac0dd8c7899dd">00125</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1bilinfn.html#aa4cc832cf8f54b6f6d9ac0dd8c7899dd" title="Alternative initialization.">set_parameters</a> ( <span class="keyword">const</span> mat &amp;A0, <span class="keyword">const</span> mat &amp;B0 ) { 
     158<a name="l00126"></a>00126                 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( A0.rows() == B0.rows(), <span class="stringliteral">&quot;bilinfn matrices must have the same number of rows&quot;</span> ); 
     159<a name="l00127"></a>00127                 A = A0; 
     160<a name="l00128"></a>00128                 B = B0; 
     161<a name="l00129"></a>00129                 <a class="code" href="classbdm_1_1fnc.html#a52156cb4a52a62d51fc7455985797a62" title="Length of the output vector.">dimy</a> = A.rows(); 
     162<a name="l00130"></a>00130                 <a class="code" href="classbdm_1_1diffbifn.html#aa193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a> = A.cols(); 
     163<a name="l00131"></a>00131                 <a class="code" href="classbdm_1_1diffbifn.html#a30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a> = B.cols(); 
     164<a name="l00132"></a>00132         } 
     165<a name="l00134"></a>00134  
     166<a name="l00137"></a><a class="code" href="classbdm_1_1bilinfn.html#a846c21e8e8d41555eb7c075f5ff86ffd">00137</a>         <span class="keyword">inline</span> vec <a class="code" href="classbdm_1_1bilinfn.html#a846c21e8e8d41555eb7c075f5ff86ffd" title="Evaluates .">eval</a> ( <span class="keyword">const</span>  vec &amp;x0, <span class="keyword">const</span> vec &amp;u0 ) { 
     167<a name="l00138"></a>00138                 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( x0.length() == <a class="code" href="classbdm_1_1diffbifn.html#aa193aa2c4a500139c0c4b669691e588e" title="cache for rvx.count()">dimx</a>, <span class="stringliteral">&quot;bilinfn::eval Wrong xcond.&quot;</span> ); 
     168<a name="l00139"></a>00139                 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( u0.length() == <a class="code" href="classbdm_1_1diffbifn.html#a30c45617eec89adeb4ebaa763d093fb0" title="cache for rvu.count()">dimu</a>, <span class="stringliteral">&quot;bilinfn::eval Wrong ucond.&quot;</span> ); 
     169<a name="l00140"></a>00140                 <span class="keywordflow">return</span> A*x0 + B*u0; 
     170<a name="l00141"></a>00141         } 
     171<a name="l00142"></a>00142  
     172<a name="l00143"></a><a class="code" href="classbdm_1_1bilinfn.html#a33066f1054dd259df2ec5fafae4b46e6">00143</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1bilinfn.html#a33066f1054dd259df2ec5fafae4b46e6" 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 ) { 
     173<a name="l00144"></a>00144                 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( ( F.cols() == A.cols() ) &amp;&amp; ( F.rows() == A.rows() ), <span class="stringliteral">&quot;Allocated F is not compatible.&quot;</span> ); 
     174<a name="l00145"></a>00145                 <span class="keywordflow">if</span> ( full ) F = A;      <span class="comment">//else : nothing has changed no need to regenerate</span> 
     175<a name="l00146"></a>00146         } 
     176<a name="l00147"></a>00147  
     177<a name="l00148"></a><a class="code" href="classbdm_1_1bilinfn.html#a9cfe2f1c115ba7c3c75849a10a4f2c08">00148</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1bilinfn.html#a9cfe2f1c115ba7c3c75849a10a4f2c08" 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> ) { 
     178<a name="l00149"></a>00149                 <a class="code" href="bdmerror_8h.html#a89a0f906b242b79c5d3d342291b2cab4" title="Throw std::runtime_exception if t is not true and NDEBUG is not defined.">bdm_assert_debug</a> ( ( F.cols() == B.cols() ) &amp;&amp; ( F.rows() == B.rows() ), <span class="stringliteral">&quot;Allocated F is not compatible.&quot;</span> ); 
     179<a name="l00150"></a>00150                 <span class="keywordflow">if</span> ( full ) F = B;      <span class="comment">//else : nothing has changed no need to regenerate</span> 
     180<a name="l00151"></a>00151         } 
     181<a name="l00153"></a>00153 }; 
     182<a name="l00154"></a>00154  
     183<a name="l00155"></a>00155 } <span class="comment">//namespace</span> 
     184<a name="l00156"></a>00156 <span class="preprocessor">#endif // FN_H</span> 
    166185</pre></div></div> 
    167 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Aug 5 00:06:47 2009 for mixpp by&nbsp; 
     186<hr size="1"/><address style="text-align: right;"><small>Generated on Sun Aug 30 22:10:49 2009 for mixpp by&nbsp; 
    168187<a href="http://www.doxygen.org/index.html"> 
    169 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> 
     188<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> 
    170189</body> 
    171190</html>