704 | | <a name="l00990"></a>00990 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a9a14c64d881e838ddc3a5617ee8a973b" title="Moves from to , i.e. perfroms the actions and reads response of the system.">step</a>() = 0; |
705 | | <a name="l00991"></a>00991 |
706 | | <a name="l00993"></a><a class="code" href="classbdm_1_1DS.html#a3c9e417d85052396fe74c164857ee67e">00993</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a3c9e417d85052396fe74c164857ee67e" title="Register DS for logging into logger L.">log_add</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
707 | | <a name="l00994"></a>00994 <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> ( <a class="code" href="classbdm_1_1DS.html#af96cae44624e79638a91ec4f2c7c81a9" title="size of data returned by getdata() ">dtsize</a> == <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>(), <span class="stringliteral">"invalid DS: dtsize ("</span> + num2str ( <a class="code" href="classbdm_1_1DS.html#af96cae44624e79638a91ec4f2c7c81a9" title="size of data returned by getdata() ">dtsize</a> ) + <span class="stringliteral">") different from Drv "</span> + num2str ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ) ); |
708 | | <a name="l00995"></a>00995 <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> ( <a class="code" href="classbdm_1_1DS.html#ad7467046a0bd05bc992cc5e1bdedb983" title="size of data">utsize</a> == <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>(), <span class="stringliteral">"invalid DS: utsize ("</span> + num2str ( <a class="code" href="classbdm_1_1DS.html#ad7467046a0bd05bc992cc5e1bdedb983" title="size of data">utsize</a> ) + <span class="stringliteral">") different from Urv "</span> + num2str ( <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ) ); |
709 | | <a name="l00996"></a>00996 |
710 | | <a name="l00997"></a>00997 <a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a> = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>, <span class="stringliteral">""</span> ); |
711 | | <a name="l00998"></a>00998 L_ut = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>, <span class="stringliteral">""</span> ); |
712 | | <a name="l00999"></a>00999 } |
713 | | <a name="l01001"></a><a class="code" href="classbdm_1_1DS.html#ae03d2c93cddd5c3a03107ddd3ae999cf">01001</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#ae03d2c93cddd5c3a03107ddd3ae999cf" title="Register DS for logging into logger L.">logit</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
714 | | <a name="l01002"></a>01002 vec tmp ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() + <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ); |
715 | | <a name="l01003"></a>01003 <a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( tmp ); |
716 | | <a name="l01004"></a>01004 <span class="comment">// d is first in getdata</span> |
717 | | <a name="l01005"></a>01005 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>, tmp.left ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ) ); |
718 | | <a name="l01006"></a>01006 <span class="comment">// u follows after d in getdata</span> |
719 | | <a name="l01007"></a>01007 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( L_ut, tmp.mid ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>(), <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ) ); |
720 | | <a name="l01008"></a>01008 } |
721 | | <a name="l01010"></a><a class="code" href="classbdm_1_1DS.html#a069497b610296be053d862a2493be0ce">01010</a> <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1DS.html#a069497b610296be053d862a2493be0ce" title="access function">_drv</a>()<span class="keyword"> const </span>{ |
722 | | <a name="l01011"></a>01011 <span class="comment">// return concat (Drv, Urv);// why!!!</span> |
723 | | <a name="l01012"></a>01012 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>;<span class="comment">// why!!!</span> |
724 | | <a name="l01013"></a>01013 } |
725 | | <a name="l01015"></a><a class="code" href="classbdm_1_1DS.html#aa6a9a375da64c82fc227bda3418a1f33">01015</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1DS.html#aa6a9a375da64c82fc227bda3418a1f33" title="access function">_urv</a>()<span class="keyword"> const </span>{ |
726 | | <a name="l01016"></a>01016 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>; |
727 | | <a name="l01017"></a>01017 } |
728 | | <a name="l01019"></a><a class="code" href="classbdm_1_1DS.html#ac09878f86907329ac631a3df8755c558">01019</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1DS.html#ac09878f86907329ac631a3df8755c558" title="access function">_yrv</a>()<span class="keyword"> const </span>{ |
729 | | <a name="l01020"></a>01020 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a>; |
730 | | <a name="l01021"></a>01021 } |
731 | | <a name="l01023"></a><a class="code" href="classbdm_1_1DS.html#a3a92d77fd97fdb6bf1c8edb1e38c6bbc">01023</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a3a92d77fd97fdb6bf1c8edb1e38c6bbc" title="set random variables">set_drv</a> (<span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &yrv, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &urv) { |
732 | | <a name="l01024"></a>01024 <a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a> = yrv; |
733 | | <a name="l01025"></a>01025 <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a> = concat(yrv,urv); |
734 | | <a name="l01026"></a>01026 <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> = urv; |
735 | | <a name="l01027"></a>01027 } |
736 | | <a name="l01028"></a>01028 }; |
737 | | <a name="l01029"></a>01029 |
738 | | <a name="l01051"></a><a class="code" href="classbdm_1_1BM.html">01051</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> { |
739 | | <a name="l01052"></a>01052 <span class="keyword">protected</span>: |
740 | | <a name="l01054"></a><a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed">01054</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_1BM.html#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>; |
741 | | <a name="l01056"></a><a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a">01056</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
742 | | <a name="l01058"></a><a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee">01058</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>; |
743 | | <a name="l01059"></a>01059 <span class="keyword">public</span>: |
744 | | <a name="l01062"></a>01062 |
745 | | <a name="l01063"></a>01063 <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a>() : <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( 0 ), <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( true ), <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 4 ), <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 4 ) { |
746 | | <a name="l01064"></a>01064 <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> = -1;<span class="comment">/*empty IDs*/</span> |
747 | | <a name="l01065"></a>01065 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> = 0; |
748 | | <a name="l01066"></a>01066 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 0 ) = 1; <span class="comment">/*log only mean*/</span> |
749 | | <a name="l01067"></a>01067 }; |
750 | | <a name="l01068"></a>01068 <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> &B ) : <a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ( B.<a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ), <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( B.<a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ), <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( B.<a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {} |
751 | | <a name="l01071"></a><a class="code" href="classbdm_1_1BM.html#a40f01563651c1e4fe926189e41a6b8ab">01071</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a>* <a class="code" href="classbdm_1_1BM.html#a40f01563651c1e4fe926189e41a6b8ab">_copy_</a>()<span class="keyword"> const </span>{ |
752 | | <a name="l01072"></a>01072 <span class="keywordflow">return</span> NULL; |
753 | | <a name="l01073"></a>01073 }; |
754 | | <a name="l01075"></a>01075 |
| 704 | <a name="l00990"></a><a class="code" href="classbdm_1_1DS.html#a4df78b21d352013d8804a8dda860b7ea">00990</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a4df78b21d352013d8804a8dda860b7ea" title="Moves from to , i.e. perfroms the actions and reads response of the system.">step</a>() |
| 705 | <a name="l00991"></a>00991 { |
| 706 | <a name="l00992"></a>00992 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"abstract class"</span> ); |
| 707 | <a name="l00993"></a>00993 } |
| 708 | <a name="l00994"></a>00994 |
| 709 | <a name="l00996"></a><a class="code" href="classbdm_1_1DS.html#a3c9e417d85052396fe74c164857ee67e">00996</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a3c9e417d85052396fe74c164857ee67e" title="Register DS for logging into logger L.">log_add</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
| 710 | <a name="l00997"></a>00997 <a class="code" href="bdmerror_8h.html#a7a3399d182b8e3065532596e76f84849" title="Throw std::runtime_exception if t is not true.">bdm_assert</a> ( <a class="code" href="classbdm_1_1DS.html#af96cae44624e79638a91ec4f2c7c81a9" title="size of data returned by getdata() ">dtsize</a> == <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>(), <span class="stringliteral">"invalid DS: dtsize ("</span> + num2str ( <a class="code" href="classbdm_1_1DS.html#af96cae44624e79638a91ec4f2c7c81a9" title="size of data returned by getdata() ">dtsize</a> ) + <span class="stringliteral">") different from Drv "</span> + num2str ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ) ); |
| 711 | <a name="l00998"></a>00998 <a class="code" href="bdmerror_8h.html#a7a3399d182b8e3065532596e76f84849" title="Throw std::runtime_exception if t is not true.">bdm_assert</a> ( <a class="code" href="classbdm_1_1DS.html#ad7467046a0bd05bc992cc5e1bdedb983" title="size of data">utsize</a> == <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>(), <span class="stringliteral">"invalid DS: utsize ("</span> + num2str ( <a class="code" href="classbdm_1_1DS.html#ad7467046a0bd05bc992cc5e1bdedb983" title="size of data">utsize</a> ) + <span class="stringliteral">") different from Urv "</span> + num2str ( <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ) ); |
| 712 | <a name="l00999"></a>00999 |
| 713 | <a name="l01000"></a>01000 <a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a> = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>, <span class="stringliteral">""</span> ); |
| 714 | <a name="l01001"></a>01001 L_ut = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>, <span class="stringliteral">""</span> ); |
| 715 | <a name="l01002"></a>01002 } |
| 716 | <a name="l01004"></a><a class="code" href="classbdm_1_1DS.html#ae03d2c93cddd5c3a03107ddd3ae999cf">01004</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#ae03d2c93cddd5c3a03107ddd3ae999cf" title="Register DS for logging into logger L.">logit</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
| 717 | <a name="l01005"></a>01005 vec tmp ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() + <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ); |
| 718 | <a name="l01006"></a>01006 <a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( tmp ); |
| 719 | <a name="l01007"></a>01007 <span class="comment">// d is first in getdata</span> |
| 720 | <a name="l01008"></a>01008 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>, tmp.left ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ) ); |
| 721 | <a name="l01009"></a>01009 <span class="comment">// u follows after d in getdata</span> |
| 722 | <a name="l01010"></a>01010 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( L_ut, tmp.mid ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>(), <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() ) ); |
| 723 | <a name="l01011"></a>01011 } |
| 724 | <a name="l01013"></a><a class="code" href="classbdm_1_1DS.html#a069497b610296be053d862a2493be0ce">01013</a> <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1DS.html#a069497b610296be053d862a2493be0ce" title="access function">_drv</a>()<span class="keyword"> const </span>{ |
| 725 | <a name="l01014"></a>01014 <span class="comment">// return concat (Drv, Urv);// why!!!</span> |
| 726 | <a name="l01015"></a>01015 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>;<span class="comment">// why!!!</span> |
| 727 | <a name="l01016"></a>01016 } |
| 728 | <a name="l01018"></a><a class="code" href="classbdm_1_1DS.html#aa6a9a375da64c82fc227bda3418a1f33">01018</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1DS.html#aa6a9a375da64c82fc227bda3418a1f33" title="access function">_urv</a>()<span class="keyword"> const </span>{ |
| 729 | <a name="l01019"></a>01019 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>; |
| 730 | <a name="l01020"></a>01020 } |
| 731 | <a name="l01022"></a><a class="code" href="classbdm_1_1DS.html#ac09878f86907329ac631a3df8755c558">01022</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1DS.html#ac09878f86907329ac631a3df8755c558" title="access function">_yrv</a>()<span class="keyword"> const </span>{ |
| 732 | <a name="l01023"></a>01023 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a>; |
| 733 | <a name="l01024"></a>01024 } |
| 734 | <a name="l01026"></a><a class="code" href="classbdm_1_1DS.html#a3a92d77fd97fdb6bf1c8edb1e38c6bbc">01026</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a3a92d77fd97fdb6bf1c8edb1e38c6bbc" title="set random variables">set_drv</a> (<span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &yrv, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &urv) { |
| 735 | <a name="l01027"></a>01027 <a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a> = yrv; |
| 736 | <a name="l01028"></a>01028 <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a> = concat(yrv,urv); |
| 737 | <a name="l01029"></a>01029 <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> = urv; |
| 738 | <a name="l01030"></a>01030 } |
| 739 | <a name="l01031"></a>01031 }; |
| 740 | <a name="l01032"></a>01032 |
| 741 | <a name="l01054"></a><a class="code" href="classbdm_1_1BM.html">01054</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> { |
| 742 | <a name="l01055"></a>01055 <span class="keyword">protected</span>: |
| 743 | <a name="l01057"></a><a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed">01057</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_1BM.html#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a>; |
| 744 | <a name="l01059"></a><a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a">01059</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
| 745 | <a name="l01061"></a><a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee">01061</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>; |
| 746 | <a name="l01062"></a>01062 <span class="keyword">public</span>: |
| 747 | <a name="l01065"></a>01065 |
| 748 | <a name="l01066"></a>01066 <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a>() : <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( 0 ), <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( true ), <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 4 ), <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 4 ) { |
| 749 | <a name="l01067"></a>01067 <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> = -1;<span class="comment">/*empty IDs*/</span> |
| 750 | <a name="l01068"></a>01068 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> = 0; |
| 751 | <a name="l01069"></a>01069 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 0 ) = 1; <span class="comment">/*log only mean*/</span> |
| 752 | <a name="l01070"></a>01070 }; |
| 753 | <a name="l01071"></a>01071 <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> &B ) : <a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ( B.<a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed" title="Random variable of the data (optional).">drv</a> ), <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ( B.<a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ), <a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ( B.<a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {} |
| 754 | <a name="l01074"></a><a class="code" href="classbdm_1_1BM.html#a40f01563651c1e4fe926189e41a6b8ab">01074</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a>* <a class="code" href="classbdm_1_1BM.html#a40f01563651c1e4fe926189e41a6b8ab">_copy_</a>()<span class="keyword"> const </span>{ |
| 755 | <a name="l01075"></a>01075 <span class="keywordflow">return</span> NULL; |
| 756 | <a name="l01076"></a>01076 }; |
756 | | <a name="l01082"></a>01082 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a60b1779a577367c369a932cabd3a6188" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &dt ) = 0; |
757 | | <a name="l01084"></a>01084 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a1dee3fddaf021e62d925289660a707dc" title="Batch Bayes rule (columns of Dt are observations).">bayesB</a> ( <span class="keyword">const</span> mat &Dt ); |
758 | | <a name="l01087"></a><a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">01087</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( <span class="keyword">const</span> vec &dt )<span class="keyword"> const </span>{ |
759 | | <a name="l01088"></a>01088 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
760 | | <a name="l01089"></a>01089 <span class="keywordflow">return</span> 0.0; |
761 | | <a name="l01090"></a>01090 } |
762 | | <a name="l01091"></a>01091 |
763 | | <a name="l01093"></a><a class="code" href="classbdm_1_1BM.html#a0e8ebe61fb14990abe1254bd3dda5fae">01093</a> vec <a class="code" href="classbdm_1_1BM.html#a0e8ebe61fb14990abe1254bd3dda5fae" title="Matrix version of logpred.">logpred_m</a> ( <span class="keyword">const</span> mat &dt )<span class="keyword"> const </span>{ |
764 | | <a name="l01094"></a>01094 vec tmp ( dt.cols() ); |
765 | | <a name="l01095"></a>01095 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < dt.cols(); i++ ) { |
766 | | <a name="l01096"></a>01096 tmp ( i ) = <a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( dt.get_col ( i ) ); |
767 | | <a name="l01097"></a>01097 } |
768 | | <a name="l01098"></a>01098 <span class="keywordflow">return</span> tmp; |
769 | | <a name="l01099"></a>01099 } |
770 | | <a name="l01100"></a>01100 |
771 | | <a name="l01102"></a><a class="code" href="classbdm_1_1BM.html#a688d7a2aced1e06aa1c468d73a9e5eba">01102</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1BM.html#a688d7a2aced1e06aa1c468d73a9e5eba" title="Constructs a predictive density .">epredictor</a>()<span class="keyword"> const </span>{ |
772 | | <a name="l01103"></a>01103 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
773 | | <a name="l01104"></a>01104 <span class="keywordflow">return</span> NULL; |
774 | | <a name="l01105"></a>01105 }; |
775 | | <a name="l01107"></a><a class="code" href="classbdm_1_1BM.html#a598b25e3f3d96a5bc00a5faeb5b3c912">01107</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a>* <a class="code" href="classbdm_1_1BM.html#a598b25e3f3d96a5bc00a5faeb5b3c912" title="Constructs conditional density of 1-step ahead predictor .">predictor</a>()<span class="keyword"> const </span>{ |
776 | | <a name="l01108"></a>01108 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
777 | | <a name="l01109"></a>01109 <span class="keywordflow">return</span> NULL; |
778 | | <a name="l01110"></a>01110 }; |
779 | | <a name="l01112"></a>01112 |
780 | | <a name="l01117"></a>01117 |
781 | | <a name="l01119"></a><a class="code" href="classbdm_1_1BM.html#ade95c590d650b2db423d53992f0906cb">01119</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_1BM.html#ade95c590d650b2db423d53992f0906cb" title="Name of extension variable.">rvc</a>; |
782 | | <a name="l01121"></a><a class="code" href="classbdm_1_1BM.html#ab5e8e016be16e4029c789063cb3f3b33">01121</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1BM.html#ab5e8e016be16e4029c789063cb3f3b33" title="access function">_rvc</a>()<span class="keyword"> const </span>{ |
783 | | <a name="l01122"></a>01122 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#ade95c590d650b2db423d53992f0906cb" title="Name of extension variable.">rvc</a>; |
784 | | <a name="l01123"></a>01123 } |
785 | | <a name="l01124"></a>01124 |
786 | | <a name="l01126"></a><a class="code" href="classbdm_1_1BM.html#a6799f4b16a6a59ed58b1d0d6e17116f4">01126</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a6799f4b16a6a59ed58b1d0d6e17116f4" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &val ) { |
787 | | <a name="l01127"></a>01127 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented!"</span> ); |
788 | | <a name="l01128"></a>01128 } |
789 | | <a name="l01129"></a>01129 |
790 | | <a name="l01131"></a>01131 |
| 758 | <a name="l01081"></a>01081 |
| 759 | <a name="l01085"></a>01085 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a60b1779a577367c369a932cabd3a6188" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &dt ) = 0; |
| 760 | <a name="l01087"></a>01087 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a1dee3fddaf021e62d925289660a707dc" title="Batch Bayes rule (columns of Dt are observations).">bayesB</a> ( <span class="keyword">const</span> mat &Dt ); |
| 761 | <a name="l01090"></a><a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">01090</a> <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( <span class="keyword">const</span> vec &dt )<span class="keyword"> const </span>{ |
| 762 | <a name="l01091"></a>01091 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 763 | <a name="l01092"></a>01092 <span class="keywordflow">return</span> 0.0; |
| 764 | <a name="l01093"></a>01093 } |
| 765 | <a name="l01094"></a>01094 |
| 766 | <a name="l01096"></a><a class="code" href="classbdm_1_1BM.html#a0e8ebe61fb14990abe1254bd3dda5fae">01096</a> vec <a class="code" href="classbdm_1_1BM.html#a0e8ebe61fb14990abe1254bd3dda5fae" title="Matrix version of logpred.">logpred_m</a> ( <span class="keyword">const</span> mat &dt )<span class="keyword"> const </span>{ |
| 767 | <a name="l01097"></a>01097 vec tmp ( dt.cols() ); |
| 768 | <a name="l01098"></a>01098 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < dt.cols(); i++ ) { |
| 769 | <a name="l01099"></a>01099 tmp ( i ) = <a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( dt.get_col ( i ) ); |
| 770 | <a name="l01100"></a>01100 } |
| 771 | <a name="l01101"></a>01101 <span class="keywordflow">return</span> tmp; |
| 772 | <a name="l01102"></a>01102 } |
| 773 | <a name="l01103"></a>01103 |
| 774 | <a name="l01105"></a><a class="code" href="classbdm_1_1BM.html#a688d7a2aced1e06aa1c468d73a9e5eba">01105</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1BM.html#a688d7a2aced1e06aa1c468d73a9e5eba" title="Constructs a predictive density .">epredictor</a>()<span class="keyword"> const </span>{ |
| 775 | <a name="l01106"></a>01106 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 776 | <a name="l01107"></a>01107 <span class="keywordflow">return</span> NULL; |
| 777 | <a name="l01108"></a>01108 }; |
| 778 | <a name="l01110"></a><a class="code" href="classbdm_1_1BM.html#a598b25e3f3d96a5bc00a5faeb5b3c912">01110</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a>* <a class="code" href="classbdm_1_1BM.html#a598b25e3f3d96a5bc00a5faeb5b3c912" title="Constructs conditional density of 1-step ahead predictor .">predictor</a>()<span class="keyword"> const </span>{ |
| 779 | <a name="l01111"></a>01111 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 780 | <a name="l01112"></a>01112 <span class="keywordflow">return</span> NULL; |
| 781 | <a name="l01113"></a>01113 }; |
| 782 | <a name="l01115"></a>01115 |
| 783 | <a name="l01120"></a>01120 |
| 784 | <a name="l01122"></a><a class="code" href="classbdm_1_1BM.html#ade95c590d650b2db423d53992f0906cb">01122</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_1BM.html#ade95c590d650b2db423d53992f0906cb" title="Name of extension variable.">rvc</a>; |
| 785 | <a name="l01124"></a><a class="code" href="classbdm_1_1BM.html#ab5e8e016be16e4029c789063cb3f3b33">01124</a> <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a>& <a class="code" href="classbdm_1_1BM.html#ab5e8e016be16e4029c789063cb3f3b33" title="access function">_rvc</a>()<span class="keyword"> const </span>{ |
| 786 | <a name="l01125"></a>01125 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#ade95c590d650b2db423d53992f0906cb" title="Name of extension variable.">rvc</a>; |
| 787 | <a name="l01126"></a>01126 } |
| 788 | <a name="l01127"></a>01127 |
| 789 | <a name="l01129"></a><a class="code" href="classbdm_1_1BM.html#a6799f4b16a6a59ed58b1d0d6e17116f4">01129</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a6799f4b16a6a59ed58b1d0d6e17116f4" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &val ) { |
| 790 | <a name="l01130"></a>01130 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented!"</span> ); |
| 791 | <a name="l01131"></a>01131 } |
820 | | <a name="l01167"></a>01167 } |
821 | | <a name="l01169"></a><a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca">01169</a> ivec <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a>; |
822 | | <a name="l01170"></a>01170 |
823 | | <a name="l01172"></a><a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207">01172</a> ivec <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>; |
824 | | <a name="l01174"></a><a class="code" href="classbdm_1_1BM.html#a2298ca6af9b13a78a4c9e18ab43f1827">01174</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a2298ca6af9b13a78a4c9e18ab43f1827" title="Add all logged variables to a logger.">log_add</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ) { |
825 | | <a name="l01175"></a>01175 <span class="comment">// internal</span> |
826 | | <a name="l01176"></a>01176 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> r; |
827 | | <a name="l01177"></a>01177 <span class="keywordflow">if</span> ( posterior().isnamed() ) { |
828 | | <a name="l01178"></a>01178 r = posterior().<a class="code" href="classbdm_1_1epdf.html#aa4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>(); |
829 | | <a name="l01179"></a>01179 } <span class="keywordflow">else</span> { |
830 | | <a name="l01180"></a>01180 r = <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ( <span class="stringliteral">"est"</span>, posterior().dimension() ); |
831 | | <a name="l01181"></a>01181 }; |
832 | | <a name="l01182"></a>01182 |
833 | | <a name="l01183"></a>01183 <span class="comment">// Add mean value</span> |
834 | | <a name="l01184"></a>01184 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 0 ) ) <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 0 ) = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( r, name + <span class="stringliteral">"mean_"</span> ); |
835 | | <a name="l01185"></a>01185 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 1 ) ) <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 1 ) = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( r, name + <span class="stringliteral">"lb_"</span> ); |
836 | | <a name="l01186"></a>01186 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 2 ) ) <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 2 ) = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( r, name + <span class="stringliteral">"ub_"</span> ); |
837 | | <a name="l01187"></a>01187 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 3 ) ) <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 3 ) = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ( <span class="stringliteral">"ll"</span>, 1 ), name ); <span class="comment">//TODO: "local" RV</span> |
838 | | <a name="l01188"></a>01188 } |
839 | | <a name="l01189"></a>01189 <span class="keyword">virtual</span> <span class="keywordtype">void</span> logit ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
840 | | <a name="l01190"></a>01190 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 0 ), posterior().mean() ); |
841 | | <a name="l01191"></a>01191 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 1 ) || <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 2 ) ) { <span class="comment">//if one of them is off, its LID==-1 and will not be stored</span> |
842 | | <a name="l01192"></a>01192 vec ub, lb; |
843 | | <a name="l01193"></a>01193 posterior().<a class="code" href="classbdm_1_1epdf.html#a0a7705e80601957f7226d333a0a6d539" title="Lower and upper bounds of percentage % quantile, returns mean-2*sigma as default...">qbounds</a> ( lb, ub ); |
844 | | <a name="l01194"></a>01194 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 1 ), lb ); |
845 | | <a name="l01195"></a>01195 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 2 ), ub ); |
846 | | <a name="l01196"></a>01196 } |
847 | | <a name="l01197"></a>01197 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 3 ) ) L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 3 ), <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ); |
848 | | <a name="l01198"></a>01198 } |
849 | | <a name="l01200"></a><a class="code" href="classbdm_1_1BM.html#a23c6a8f71f922023ab08dcb0487a86de">01200</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a23c6a8f71f922023ab08dcb0487a86de" title="This method arrange instance properties according the data stored in the Setting...">from_setting</a> ( <span class="keyword">const</span> Setting &<span class="keyword">set</span> ) { |
850 | | <a name="l01201"></a>01201 <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr<RV></a> r = UI::build<RV> ( <span class="keyword">set</span>, <span class="stringliteral">"drv"</span>, UI::optional ); |
851 | | <a name="l01202"></a>01202 <span class="keywordflow">if</span> ( r ) { |
852 | | <a name="l01203"></a>01203 set_drv ( *r ); |
853 | | <a name="l01204"></a>01204 } |
854 | | <a name="l01205"></a>01205 <span class="keywordtype">string</span> opt; |
855 | | <a name="l01206"></a>01206 <span class="keywordflow">if</span> ( !<a class="code" href="classbdm_1_1UI.html#acd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a> ( opt, <span class="keyword">set</span>, <span class="stringliteral">"options"</span>, UI::optional ) ) { |
856 | | <a name="l01207"></a>01207 <a class="code" href="classbdm_1_1BM.html#aadb539fa2585c8a2a91c54e5aebf330e" title="Set boolean options from a string, recognized are: &quot;logbounds,logll&quot;.">set_options</a> ( opt ); |
857 | | <a name="l01208"></a>01208 } |
858 | | <a name="l01209"></a>01209 } |
859 | | <a name="l01210"></a>01210 |
860 | | <a name="l01211"></a>01211 }; |
861 | | <a name="l01212"></a>01212 |
862 | | <a name="l01213"></a>01213 <span class="keyword">typedef</span> Array<shared_ptr<epdf> > epdf_array; |
863 | | <a name="l01214"></a>01214 |
864 | | <a name="l01215"></a>01215 <span class="keyword">typedef</span> Array<shared_ptr<mpdf> > mpdf_array; |
865 | | <a name="l01216"></a>01216 |
866 | | <a name="l01217"></a>01217 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
867 | | <a name="l01218"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ad8e547695d1cc19219b91164d825c930">01218</a> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ad8e547695d1cc19219b91164d825c930" title="Reimplements samplecond using condition().">mpdf_internal<EPDF>::samplecond</a> ( <span class="keyword">const</span> vec &cond ) { |
868 | | <a name="l01219"></a>01219 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
869 | | <a name="l01220"></a>01220 vec temp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.sample(); |
870 | | <a name="l01221"></a>01221 <span class="keywordflow">return</span> temp; |
871 | | <a name="l01222"></a>01222 } |
872 | | <a name="l01223"></a>01223 |
873 | | <a name="l01224"></a>01224 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
874 | | <a name="l01225"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a9554c554054da2d22cb8e908ae9c8823">01225</a> mat <a class="code" href="classbdm_1_1mpdf__internal.html#a9554c554054da2d22cb8e908ae9c8823" title="Efficient version of samplecond.">mpdf_internal<EPDF>::samplecond_m</a> ( <span class="keyword">const</span> vec &cond, <span class="keywordtype">int</span> N ) { |
875 | | <a name="l01226"></a>01226 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
876 | | <a name="l01227"></a>01227 mat temp ( dimension(), N ); |
877 | | <a name="l01228"></a>01228 vec smp ( dimension() ); |
878 | | <a name="l01229"></a>01229 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < N; i++ ) { |
879 | | <a name="l01230"></a>01230 smp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.sample(); |
880 | | <a name="l01231"></a>01231 temp.set_col ( i, smp ); |
881 | | <a name="l01232"></a>01232 } |
882 | | <a name="l01233"></a>01233 |
883 | | <a name="l01234"></a>01234 <span class="keywordflow">return</span> temp; |
884 | | <a name="l01235"></a>01235 } |
| 820 | <a name="l01167"></a>01167 <span class="keywordflow">if</span> ( opt.find ( <span class="stringliteral">"logll"</span> ) != string::npos ) { |
| 821 | <a name="l01168"></a>01168 <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 3 ) = 1; |
| 822 | <a name="l01169"></a>01169 } |
| 823 | <a name="l01170"></a>01170 } |
| 824 | <a name="l01172"></a><a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca">01172</a> ivec <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a>; |
| 825 | <a name="l01173"></a>01173 |
| 826 | <a name="l01175"></a><a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207">01175</a> ivec <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a>; |
| 827 | <a name="l01177"></a><a class="code" href="classbdm_1_1BM.html#a2298ca6af9b13a78a4c9e18ab43f1827">01177</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a2298ca6af9b13a78a4c9e18ab43f1827" title="Add all logged variables to a logger.">log_add</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L, <span class="keyword">const</span> <span class="keywordtype">string</span> &name = <span class="stringliteral">""</span> ) { |
| 828 | <a name="l01178"></a>01178 <span class="comment">// internal</span> |
| 829 | <a name="l01179"></a>01179 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> r; |
| 830 | <a name="l01180"></a>01180 <span class="keywordflow">if</span> ( posterior().isnamed() ) { |
| 831 | <a name="l01181"></a>01181 r = posterior().<a class="code" href="classbdm_1_1epdf.html#aa4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>(); |
| 832 | <a name="l01182"></a>01182 } <span class="keywordflow">else</span> { |
| 833 | <a name="l01183"></a>01183 r = <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ( <span class="stringliteral">"est"</span>, posterior().dimension() ); |
| 834 | <a name="l01184"></a>01184 }; |
| 835 | <a name="l01185"></a>01185 |
| 836 | <a name="l01186"></a>01186 <span class="comment">// Add mean value</span> |
| 837 | <a name="l01187"></a>01187 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 0 ) ) <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 0 ) = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( r, name + <span class="stringliteral">"mean_"</span> ); |
| 838 | <a name="l01188"></a>01188 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 1 ) ) <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 1 ) = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( r, name + <span class="stringliteral">"lb_"</span> ); |
| 839 | <a name="l01189"></a>01189 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 2 ) ) <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 2 ) = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( r, name + <span class="stringliteral">"ub_"</span> ); |
| 840 | <a name="l01190"></a>01190 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 3 ) ) <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 3 ) = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7" title="returns an identifier which will be later needed for calling the logit() function...">add</a> ( <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ( <span class="stringliteral">"ll"</span>, 1 ), name ); <span class="comment">//TODO: "local" RV</span> |
| 841 | <a name="l01191"></a>01191 } |
| 842 | <a name="l01192"></a>01192 <span class="keyword">virtual</span> <span class="keywordtype">void</span> logit ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
| 843 | <a name="l01193"></a>01193 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 0 ), posterior().mean() ); |
| 844 | <a name="l01194"></a>01194 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 1 ) || <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 2 ) ) { <span class="comment">//if one of them is off, its LID==-1 and will not be stored</span> |
| 845 | <a name="l01195"></a>01195 vec ub, lb; |
| 846 | <a name="l01196"></a>01196 posterior().<a class="code" href="classbdm_1_1epdf.html#a0a7705e80601957f7226d333a0a6d539" title="Lower and upper bounds of percentage % quantile, returns mean-2*sigma as default...">qbounds</a> ( lb, ub ); |
| 847 | <a name="l01197"></a>01197 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 1 ), lb ); |
| 848 | <a name="l01198"></a>01198 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 2 ), ub ); |
| 849 | <a name="l01199"></a>01199 } |
| 850 | <a name="l01200"></a>01200 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207" title="Flags for logging - same size as LIDs, each entry correspond to the same in LIDs...">LFlags</a> ( 3 ) ) L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a> ( 3 ), <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a> ); |
| 851 | <a name="l01201"></a>01201 } |
| 852 | <a name="l01203"></a><a class="code" href="classbdm_1_1BM.html#a23c6a8f71f922023ab08dcb0487a86de">01203</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a23c6a8f71f922023ab08dcb0487a86de" title="This method arrange instance properties according the data stored in the Setting...">from_setting</a> ( <span class="keyword">const</span> Setting &<span class="keyword">set</span> ) { |
| 853 | <a name="l01204"></a>01204 <a class="code" href="classbdm_1_1shared__ptr.html" title="A naive implementation of roughly a subset of the std::tr1::shared_ptr spec.">shared_ptr<RV></a> r = UI::build<RV> ( <span class="keyword">set</span>, <span class="stringliteral">"drv"</span>, UI::optional ); |
| 854 | <a name="l01205"></a>01205 <span class="keywordflow">if</span> ( r ) { |
| 855 | <a name="l01206"></a>01206 set_drv ( *r ); |
| 856 | <a name="l01207"></a>01207 } |
| 857 | <a name="l01208"></a>01208 <span class="keywordtype">string</span> opt; |
| 858 | <a name="l01209"></a>01209 <span class="keywordflow">if</span> ( !<a class="code" href="classbdm_1_1UI.html#acd1667e6fec99ec64dabcb3ca2ff922d">UI::get</a> ( opt, <span class="keyword">set</span>, <span class="stringliteral">"options"</span>, UI::optional ) ) { |
| 859 | <a name="l01210"></a>01210 <a class="code" href="classbdm_1_1BM.html#aadb539fa2585c8a2a91c54e5aebf330e" title="Set boolean options from a string, recognized are: &quot;logbounds,logll&quot;.">set_options</a> ( opt ); |
| 860 | <a name="l01211"></a>01211 } |
| 861 | <a name="l01212"></a>01212 } |
| 862 | <a name="l01213"></a>01213 |
| 863 | <a name="l01214"></a>01214 }; |
| 864 | <a name="l01215"></a>01215 |
| 865 | <a name="l01216"></a>01216 <span class="keyword">typedef</span> Array<shared_ptr<epdf> > epdf_array; |
| 866 | <a name="l01217"></a>01217 |
| 867 | <a name="l01218"></a>01218 <span class="keyword">typedef</span> Array<shared_ptr<mpdf> > mpdf_array; |
| 868 | <a name="l01219"></a>01219 |
| 869 | <a name="l01220"></a>01220 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 870 | <a name="l01221"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ad8e547695d1cc19219b91164d825c930">01221</a> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ad8e547695d1cc19219b91164d825c930" title="Reimplements samplecond using condition().">mpdf_internal<EPDF>::samplecond</a> ( <span class="keyword">const</span> vec &cond ) { |
| 871 | <a name="l01222"></a>01222 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
| 872 | <a name="l01223"></a>01223 vec temp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.sample(); |
| 873 | <a name="l01224"></a>01224 <span class="keywordflow">return</span> temp; |
| 874 | <a name="l01225"></a>01225 } |
| 875 | <a name="l01226"></a>01226 |
| 876 | <a name="l01227"></a>01227 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 877 | <a name="l01228"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a9554c554054da2d22cb8e908ae9c8823">01228</a> mat <a class="code" href="classbdm_1_1mpdf__internal.html#a9554c554054da2d22cb8e908ae9c8823" title="Efficient version of samplecond.">mpdf_internal<EPDF>::samplecond_m</a> ( <span class="keyword">const</span> vec &cond, <span class="keywordtype">int</span> N ) { |
| 878 | <a name="l01229"></a>01229 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
| 879 | <a name="l01230"></a>01230 mat temp ( dimension(), N ); |
| 880 | <a name="l01231"></a>01231 vec smp ( dimension() ); |
| 881 | <a name="l01232"></a>01232 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < N; i++ ) { |
| 882 | <a name="l01233"></a>01233 smp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.sample(); |
| 883 | <a name="l01234"></a>01234 temp.set_col ( i, smp ); |
| 884 | <a name="l01235"></a>01235 } |
886 | | <a name="l01237"></a>01237 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
887 | | <a name="l01238"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a89076e62b8d7df7616bad68c94591948">01238</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a89076e62b8d7df7616bad68c94591948" title="Reimplements evallogcond using condition().">mpdf_internal<EPDF>::evallogcond</a> ( <span class="keyword">const</span> vec &dt, <span class="keyword">const</span> vec &cond ) { |
888 | | <a name="l01239"></a>01239 <span class="keywordtype">double</span> tmp; |
889 | | <a name="l01240"></a>01240 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
890 | | <a name="l01241"></a>01241 tmp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog ( dt ); |
891 | | <a name="l01242"></a>01242 <span class="keywordflow">return</span> tmp; |
892 | | <a name="l01243"></a>01243 } |
893 | | <a name="l01244"></a>01244 |
894 | | <a name="l01245"></a>01245 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
895 | | <a name="l01246"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c">01246</a> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c" title="Efficient version of evallogcond for matrices.">mpdf_internal<EPDF>::evallogcond_m</a> ( <span class="keyword">const</span> mat &Dt, <span class="keyword">const</span> vec &cond ) { |
896 | | <a name="l01247"></a>01247 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
897 | | <a name="l01248"></a>01248 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog_m ( Dt ); |
898 | | <a name="l01249"></a>01249 } |
899 | | <a name="l01250"></a>01250 |
900 | | <a name="l01251"></a>01251 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
901 | | <a name="l01252"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae82db07ce8af02f29cfd81e014edb3db">01252</a> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c" title="Efficient version of evallogcond for matrices.">mpdf_internal<EPDF>::evallogcond_m</a> ( <span class="keyword">const</span> Array<vec> &Dt, <span class="keyword">const</span> vec &cond ) { |
902 | | <a name="l01253"></a>01253 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
903 | | <a name="l01254"></a>01254 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog_m ( Dt ); |
904 | | <a name="l01255"></a>01255 } |
905 | | <a name="l01256"></a>01256 |
906 | | <a name="l01257"></a>01257 }; <span class="comment">//namespace</span> |
907 | | <a name="l01258"></a>01258 <span class="preprocessor">#endif // BDMBASE_H</span> |
| 886 | <a name="l01237"></a>01237 <span class="keywordflow">return</span> temp; |
| 887 | <a name="l01238"></a>01238 } |
| 888 | <a name="l01239"></a>01239 |
| 889 | <a name="l01240"></a>01240 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 890 | <a name="l01241"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a89076e62b8d7df7616bad68c94591948">01241</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a89076e62b8d7df7616bad68c94591948" title="Reimplements evallogcond using condition().">mpdf_internal<EPDF>::evallogcond</a> ( <span class="keyword">const</span> vec &dt, <span class="keyword">const</span> vec &cond ) { |
| 891 | <a name="l01242"></a>01242 <span class="keywordtype">double</span> tmp; |
| 892 | <a name="l01243"></a>01243 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
| 893 | <a name="l01244"></a>01244 tmp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog ( dt ); |
| 894 | <a name="l01245"></a>01245 <span class="keywordflow">return</span> tmp; |
| 895 | <a name="l01246"></a>01246 } |
| 896 | <a name="l01247"></a>01247 |
| 897 | <a name="l01248"></a>01248 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 898 | <a name="l01249"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c">01249</a> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c" title="Efficient version of evallogcond for matrices.">mpdf_internal<EPDF>::evallogcond_m</a> ( <span class="keyword">const</span> mat &Dt, <span class="keyword">const</span> vec &cond ) { |
| 899 | <a name="l01250"></a>01250 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
| 900 | <a name="l01251"></a>01251 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog_m ( Dt ); |
| 901 | <a name="l01252"></a>01252 } |
| 902 | <a name="l01253"></a>01253 |
| 903 | <a name="l01254"></a>01254 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 904 | <a name="l01255"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae82db07ce8af02f29cfd81e014edb3db">01255</a> vec <a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c" title="Efficient version of evallogcond for matrices.">mpdf_internal<EPDF>::evallogcond_m</a> ( <span class="keyword">const</span> Array<vec> &Dt, <span class="keyword">const</span> vec &cond ) { |
| 905 | <a name="l01256"></a>01256 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e" title="Update iepdf so that it represents this mpdf conditioned on rvc = cond This function...">condition</a> ( cond ); |
| 906 | <a name="l01257"></a>01257 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog_m ( Dt ); |
| 907 | <a name="l01258"></a>01258 } |
| 908 | <a name="l01259"></a>01259 |
| 909 | <a name="l01260"></a>01260 }; <span class="comment">//namespace</span> |
| 910 | <a name="l01261"></a>01261 <span class="preprocessor">#endif // BDMBASE_H</span> |