558 | | <a name="l00766"></a>00766 <a class="code" href="classbdm_1_1datalink__buffered.html" title="Datalink that buffers delayed values - do not forget to call step().">datalink_buffered</a> dl1; |
559 | | <a name="l00767"></a>00767 <a class="code" href="classbdm_1_1datalink__buffered.html" title="Datalink that buffers delayed values - do not forget to call step().">datalink_buffered</a> dl2; |
560 | | <a name="l00768"></a>00768 <span class="keyword">public</span>: |
561 | | <a name="l00770"></a><a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aef1441b4885ae4d8e95b3ff28e575364">00770</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aef1441b4885ae4d8e95b3ff28e575364" title="set connection between RVs">set_connection</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up1, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up2 ) { |
562 | | <a name="l00771"></a>00771 dl1.<a class="code" href="classbdm_1_1datalink__buffered.html#aadefa427312905425ebab8531da1846a" title="set connection, rv must be fully present in rv_up">set_connection</a> ( rv, rv_up1 ); |
563 | | <a name="l00772"></a>00772 dl2.<a class="code" href="classbdm_1_1datalink__buffered.html#aadefa427312905425ebab8531da1846a" title="set connection, rv must be fully present in rv_up">set_connection</a> ( rv, rv_up2 ); |
564 | | <a name="l00773"></a>00773 } |
565 | | <a name="l00774"></a>00774 <span class="keywordtype">void</span> filldown ( <span class="keyword">const</span> vec &val1, <span class="keyword">const</span> vec &val2, vec &val_down ) { |
566 | | <a name="l00775"></a>00775 <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> ( val_down.length() >= dl1.<a class="code" href="classbdm_1_1datalink.html#a8f0cce4477e906f3090bb803e06d8698" title="access functions">_downsize</a>() + dl2.<a class="code" href="classbdm_1_1datalink.html#a8f0cce4477e906f3090bb803e06d8698" title="access functions">_downsize</a>(), <span class="stringliteral">"short val_down"</span> ); |
567 | | <a name="l00776"></a>00776 dl1.<a class="code" href="classbdm_1_1datalink__buffered.html#a681745a319728a416486df38aacd579f" title="Get val for vector val_down from val of &quot;Up&quot;.">filldown</a> ( val1, val_down ); |
568 | | <a name="l00777"></a>00777 dl2.<a class="code" href="classbdm_1_1datalink__buffered.html#a681745a319728a416486df38aacd579f" title="Get val for vector val_down from val of &quot;Up&quot;.">filldown</a> ( val2, val_down ); |
569 | | <a name="l00778"></a>00778 } |
570 | | <a name="l00779"></a>00779 <span class="keywordtype">void</span> step ( <span class="keyword">const</span> vec &dt, <span class="keyword">const</span> vec &ut ) { |
571 | | <a name="l00780"></a>00780 dl1.step ( dt ); |
572 | | <a name="l00781"></a>00781 dl2.step ( ut ); |
573 | | <a name="l00782"></a>00782 } |
574 | | <a name="l00783"></a>00783 }; |
575 | | <a name="l00784"></a>00784 |
576 | | <a name="l00785"></a>00785 |
577 | | <a name="l00786"></a>00786 |
578 | | <a name="l00788"></a><a class="code" href="classbdm_1_1datalink__m2e.html">00788</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__m2e.html" title="Data link with a condition.">datalink_m2e</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1datalink.html" title="DataLink is a connection between two data vectors Up and Down.">datalink</a> { |
579 | | <a name="l00789"></a>00789 <span class="keyword">protected</span>: |
580 | | <a name="l00791"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9">00791</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>; |
581 | | <a name="l00792"></a>00792 |
582 | | <a name="l00794"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a43fe3e2d7aa04134053ec15793722783">00794</a> ivec <a class="code" href="classbdm_1_1datalink__m2e.html#a43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indices of the upper val">v2c_up</a>; |
583 | | <a name="l00795"></a>00795 |
584 | | <a name="l00797"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc">00797</a> ivec <a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, indices of the local cond">v2c_lo</a>; |
585 | | <a name="l00798"></a>00798 |
586 | | <a name="l00799"></a>00799 <span class="keyword">public</span>: |
587 | | <a name="l00801"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a5ad951e9cf850c9bfe4e492e91a50af6">00801</a> <a class="code" href="classbdm_1_1datalink__m2e.html#a5ad951e9cf850c9bfe4e492e91a50af6" title="Constructor.">datalink_m2e</a>() : <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ( 0 ) { } |
| 558 | <a name="l00767"></a><a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aef99848172760c7d989b59063ca1bb55">00767</a> <a class="code" href="classbdm_1_1datalink__buffered.html" title="Datalink that buffers delayed values - do not forget to call step().">datalink_buffered</a> <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aef99848172760c7d989b59063ca1bb55" title="link 1st vector to down">dl1</a>; |
| 559 | <a name="l00769"></a><a class="code" href="classbdm_1_1datalink__2to1__buffered.html#a2031ad6aeef42ad9ef10d73e7b8cc0f2">00769</a> <a class="code" href="classbdm_1_1datalink__buffered.html" title="Datalink that buffers delayed values - do not forget to call step().">datalink_buffered</a> <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#a2031ad6aeef42ad9ef10d73e7b8cc0f2" title="link 2nd vector to down">dl2</a>; |
| 560 | <a name="l00770"></a>00770 <span class="keyword">public</span>: |
| 561 | <a name="l00772"></a><a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aef1441b4885ae4d8e95b3ff28e575364">00772</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aef1441b4885ae4d8e95b3ff28e575364" title="set connection between RVs">set_connection</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up1, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up2 ) { |
| 562 | <a name="l00773"></a>00773 <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aef99848172760c7d989b59063ca1bb55" title="link 1st vector to down">dl1</a>.<a class="code" href="classbdm_1_1datalink__buffered.html#aadefa427312905425ebab8531da1846a" title="set connection, rv must be fully present in rv_up">set_connection</a> ( rv, rv_up1 ); |
| 563 | <a name="l00774"></a>00774 <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#a2031ad6aeef42ad9ef10d73e7b8cc0f2" title="link 2nd vector to down">dl2</a>.<a class="code" href="classbdm_1_1datalink__buffered.html#aadefa427312905425ebab8531da1846a" title="set connection, rv must be fully present in rv_up">set_connection</a> ( rv, rv_up2 ); |
| 564 | <a name="l00775"></a>00775 } |
| 565 | <a name="l00777"></a><a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aee6ee8524a30aceac28bab01b9b4cb39">00777</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aee6ee8524a30aceac28bab01b9b4cb39" title="fill values of down from the values of the two up vectors">filldown</a> ( <span class="keyword">const</span> vec &val1, <span class="keyword">const</span> vec &val2, vec &val_down ) { |
| 566 | <a name="l00778"></a>00778 <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> ( val_down.length() >= <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aef99848172760c7d989b59063ca1bb55" title="link 1st vector to down">dl1</a>.<a class="code" href="classbdm_1_1datalink.html#a8f0cce4477e906f3090bb803e06d8698" title="access functions">_downsize</a>() + <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#a2031ad6aeef42ad9ef10d73e7b8cc0f2" title="link 2nd vector to down">dl2</a>.<a class="code" href="classbdm_1_1datalink.html#a8f0cce4477e906f3090bb803e06d8698" title="access functions">_downsize</a>(), <span class="stringliteral">"short val_down"</span> ); |
| 567 | <a name="l00779"></a>00779 <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aef99848172760c7d989b59063ca1bb55" title="link 1st vector to down">dl1</a>.<a class="code" href="classbdm_1_1datalink__buffered.html#a681745a319728a416486df38aacd579f" title="Get val for vector val_down from val of &quot;Up&quot;.">filldown</a> ( val1, val_down ); |
| 568 | <a name="l00780"></a>00780 <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#a2031ad6aeef42ad9ef10d73e7b8cc0f2" title="link 2nd vector to down">dl2</a>.<a class="code" href="classbdm_1_1datalink__buffered.html#a681745a319728a416486df38aacd579f" title="Get val for vector val_down from val of &quot;Up&quot;.">filldown</a> ( val2, val_down ); |
| 569 | <a name="l00781"></a>00781 } |
| 570 | <a name="l00783"></a><a class="code" href="classbdm_1_1datalink__2to1__buffered.html#ab083becb2d0744d0346a0267d70ea475">00783</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#ab083becb2d0744d0346a0267d70ea475" title="update buffer">step</a> ( <span class="keyword">const</span> vec &dt, <span class="keyword">const</span> vec &ut ) { |
| 571 | <a name="l00784"></a>00784 <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#aef99848172760c7d989b59063ca1bb55" title="link 1st vector to down">dl1</a>.<a class="code" href="classbdm_1_1datalink__buffered.html#af137706c55891ba8a8aecc52ea96865f" title="push current data to history">step</a> ( dt ); |
| 572 | <a name="l00785"></a>00785 <a class="code" href="classbdm_1_1datalink__2to1__buffered.html#a2031ad6aeef42ad9ef10d73e7b8cc0f2" title="link 2nd vector to down">dl2</a>.<a class="code" href="classbdm_1_1datalink__buffered.html#af137706c55891ba8a8aecc52ea96865f" title="push current data to history">step</a> ( ut ); |
| 573 | <a name="l00786"></a>00786 } |
| 574 | <a name="l00787"></a>00787 }; |
| 575 | <a name="l00788"></a>00788 |
| 576 | <a name="l00789"></a>00789 |
| 577 | <a name="l00790"></a>00790 |
| 578 | <a name="l00792"></a><a class="code" href="classbdm_1_1datalink__m2e.html">00792</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__m2e.html" title="Data link with a condition.">datalink_m2e</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1datalink.html" title="DataLink is a connection between two data vectors Up and Down.">datalink</a> { |
| 579 | <a name="l00793"></a>00793 <span class="keyword">protected</span>: |
| 580 | <a name="l00795"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9">00795</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>; |
| 581 | <a name="l00796"></a>00796 |
| 582 | <a name="l00798"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a43fe3e2d7aa04134053ec15793722783">00798</a> ivec <a class="code" href="classbdm_1_1datalink__m2e.html#a43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indices of the upper val">v2c_up</a>; |
| 583 | <a name="l00799"></a>00799 |
| 584 | <a name="l00801"></a><a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc">00801</a> ivec <a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, indices of the local cond">v2c_lo</a>; |
596 | | <a name="l00815"></a><a class="code" href="classbdm_1_1datalink__m2m.html">00815</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__m2m.html" title="DataLink is a connection between mpdf and its superordinate (Up) This class links...">datalink_m2m</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1datalink__m2e.html" title="Data link with a condition.">datalink_m2e</a> { |
597 | | <a name="l00816"></a>00816 <span class="keyword">protected</span>: |
598 | | <a name="l00818"></a><a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d">00818</a> ivec <a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indices of the upper cond">c2c_up</a>; |
599 | | <a name="l00820"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5">00820</a> ivec <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>; |
600 | | <a name="l00821"></a>00821 |
601 | | <a name="l00822"></a>00822 <span class="keyword">public</span>: |
602 | | <a name="l00824"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a3baed32cb66f0e2f731032cec0a4d287">00824</a> <a class="code" href="classbdm_1_1datalink__m2m.html#a3baed32cb66f0e2f731032cec0a4d287" title="Constructor.">datalink_m2m</a>() {}; |
603 | | <a name="l00826"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a0ed49a99e8a3be264b952558b6f515d4">00826</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__m2m.html#a0ed49a99e8a3be264b952558b6f515d4" title="Set connection between the vectors.">set_connection</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc_up ) { |
604 | | <a name="l00827"></a>00827 <a class="code" href="classbdm_1_1datalink__m2m.html#a0ed49a99e8a3be264b952558b6f515d4" title="Set connection between the vectors.">datalink_m2e::set_connection</a> ( rv, rvc, rv_up ); |
605 | | <a name="l00828"></a>00828 <span class="comment">//establish c2c connection</span> |
606 | | <a name="l00829"></a>00829 rvc.<a class="code" href="classbdm_1_1RV.html#acbebdb5e0d30101a6eb63550ef701c55" title="when this rv is a part of bigger rv, this function returns indices of self in the...">dataind</a> ( rvc_up, <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>, <a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indices of the upper cond">c2c_up</a> ); |
607 | | <a name="l00830"></a>00830 <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_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>.length() + <a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, indices of the local cond">v2c_lo</a>.length() == <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>, <span class="stringliteral">"cond is not fully given"</span> ); |
608 | | <a name="l00831"></a>00831 } |
609 | | <a name="l00832"></a>00832 |
610 | | <a name="l00834"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a911fb7fcfa80d4e31db8e0cc03141a90">00834</a> vec <a class="code" href="classbdm_1_1datalink__m2m.html#a911fb7fcfa80d4e31db8e0cc03141a90" title="Get cond for myself from val and cond of &quot;Up&quot;.">get_cond</a> ( <span class="keyword">const</span> vec &val_up, <span class="keyword">const</span> vec &cond_up ) { |
611 | | <a name="l00835"></a>00835 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
612 | | <a name="l00836"></a>00836 set_subvector ( tmp, <a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, indices of the local cond">v2c_lo</a>, val_up ( <a class="code" href="classbdm_1_1datalink__m2e.html#a43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indices of the upper val">v2c_up</a> ) ); |
613 | | <a name="l00837"></a>00837 set_subvector ( tmp, <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>, cond_up ( <a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indices of the upper cond">c2c_up</a> ) ); |
614 | | <a name="l00838"></a>00838 <span class="keywordflow">return</span> tmp; |
615 | | <a name="l00839"></a>00839 } |
616 | | <a name="l00841"></a>00841 |
617 | | <a name="l00842"></a>00842 }; |
618 | | <a name="l00843"></a>00843 |
619 | | <a name="l00849"></a><a class="code" href="classbdm_1_1logger.html">00849</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> { |
620 | | <a name="l00850"></a>00850 <span class="keyword">protected</span>: |
621 | | <a name="l00852"></a><a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f">00852</a> Array<RV> <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>; |
622 | | <a name="l00854"></a><a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02">00854</a> Array<string> <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>; |
623 | | <a name="l00855"></a>00855 <span class="keyword">public</span>: |
624 | | <a name="l00857"></a><a class="code" href="classbdm_1_1logger.html#af9c2fe7db5ddbda0098a4a5bd2c29fbf">00857</a> <a class="code" href="classbdm_1_1logger.html#af9c2fe7db5ddbda0098a4a5bd2c29fbf" title="Default constructor.">logger</a>() : <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( 0 ), <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a> ( 0 ) {} |
625 | | <a name="l00858"></a>00858 |
626 | | <a name="l00861"></a><a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7">00861</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> <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> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keywordtype">string</span> prefix = <span class="stringliteral">""</span> ) { |
627 | | <a name="l00862"></a>00862 <span class="keywordtype">int</span> id; |
628 | | <a name="l00863"></a>00863 <span class="keywordflow">if</span> ( rv.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() > 0 ) { |
629 | | <a name="l00864"></a>00864 <span class="keywordtype">id</span> = <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.length(); |
630 | | <a name="l00865"></a>00865 <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a> = concat ( <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>, prefix ); <span class="comment">// diff</span> |
631 | | <a name="l00866"></a>00866 <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.set_length ( <span class="keywordtype">id</span> + 1, <span class="keyword">true</span> ); |
632 | | <a name="l00867"></a>00867 <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( <span class="keywordtype">id</span> ) = rv; |
633 | | <a name="l00868"></a>00868 } <span class="keywordflow">else</span> { |
634 | | <a name="l00869"></a>00869 <span class="keywordtype">id</span> = -1; |
635 | | <a name="l00870"></a>00870 } |
636 | | <a name="l00871"></a>00871 <span class="keywordflow">return</span> id; <span class="comment">// identifier of the last entry</span> |
637 | | <a name="l00872"></a>00872 } |
638 | | <a name="l00873"></a>00873 |
639 | | <a name="l00875"></a><a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309">00875</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> vec &v ) { |
640 | | <a name="l00876"></a>00876 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
641 | | <a name="l00877"></a>00877 }; |
642 | | <a name="l00879"></a><a class="code" href="classbdm_1_1logger.html#aaa1d72cd3d2ff6bbf87340154af02ea6">00879</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#aaa1d72cd3d2ff6bbf87340154af02ea6" title="log this double">logit</a> ( <span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> <span class="keywordtype">double</span> &d ) { |
| 593 | <a name="l00814"></a>00814 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__m2e.html#ab29bc3c7bf2a1d87e77ccaa793d097d5" title="Copy corresponding values to Up.condition.">pushup_cond</a> ( vec &val_up, <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ); |
| 594 | <a name="l00815"></a>00815 }; |
| 595 | <a name="l00816"></a>00816 |
| 596 | <a name="l00819"></a><a class="code" href="classbdm_1_1datalink__m2m.html">00819</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1datalink__m2m.html">datalink_m2m</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1datalink__m2e.html" title="Data link with a condition.">datalink_m2e</a> { |
| 597 | <a name="l00820"></a>00820 <span class="keyword">protected</span>: |
| 598 | <a name="l00822"></a><a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d">00822</a> ivec <a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indices of the upper cond">c2c_up</a>; |
| 599 | <a name="l00824"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5">00824</a> ivec <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>; |
| 600 | <a name="l00825"></a>00825 |
| 601 | <a name="l00826"></a>00826 <span class="keyword">public</span>: |
| 602 | <a name="l00828"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a3baed32cb66f0e2f731032cec0a4d287">00828</a> <a class="code" href="classbdm_1_1datalink__m2m.html#a3baed32cb66f0e2f731032cec0a4d287" title="Constructor.">datalink_m2m</a>() {}; |
| 603 | <a name="l00830"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a0ed49a99e8a3be264b952558b6f515d4">00830</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1datalink__m2m.html#a0ed49a99e8a3be264b952558b6f515d4" title="Set connection between the vectors.">set_connection</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv_up, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rvc_up ) { |
| 604 | <a name="l00831"></a>00831 <a class="code" href="classbdm_1_1datalink__m2m.html#a0ed49a99e8a3be264b952558b6f515d4" title="Set connection between the vectors.">datalink_m2e::set_connection</a> ( rv, rvc, rv_up ); |
| 605 | <a name="l00832"></a>00832 <span class="comment">//establish c2c connection</span> |
| 606 | <a name="l00833"></a>00833 rvc.<a class="code" href="classbdm_1_1RV.html#acbebdb5e0d30101a6eb63550ef701c55">dataind</a> ( rvc_up, <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>, <a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indices of the upper cond">c2c_up</a> ); |
| 607 | <a name="l00834"></a>00834 <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_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>.length() + <a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, indices of the local cond">v2c_lo</a>.length() == <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a>, <span class="stringliteral">"cond is not fully given"</span> ); |
| 608 | <a name="l00835"></a>00835 } |
| 609 | <a name="l00836"></a>00836 |
| 610 | <a name="l00838"></a><a class="code" href="classbdm_1_1datalink__m2m.html#a911fb7fcfa80d4e31db8e0cc03141a90">00838</a> vec <a class="code" href="classbdm_1_1datalink__m2m.html#a911fb7fcfa80d4e31db8e0cc03141a90" title="Get cond for myself from val and cond of &quot;Up&quot;.">get_cond</a> ( <span class="keyword">const</span> vec &val_up, <span class="keyword">const</span> vec &cond_up ) { |
| 611 | <a name="l00839"></a>00839 vec tmp ( <a class="code" href="classbdm_1_1datalink__m2e.html#a3fb26525e0bfa7932a37c5cd404801f9" title="Remember how long cond should be.">condsize</a> ); |
| 612 | <a name="l00840"></a>00840 set_subvector ( tmp, <a class="code" href="classbdm_1_1datalink__m2e.html#a9e0048d87bda78e9b8d38761440c7abc" title="upper_val-to-local_cond link, indices of the local cond">v2c_lo</a>, val_up ( <a class="code" href="classbdm_1_1datalink__m2e.html#a43fe3e2d7aa04134053ec15793722783" title="upper_val-to-local_cond link, indices of the upper val">v2c_up</a> ) ); |
| 613 | <a name="l00841"></a>00841 set_subvector ( tmp, <a class="code" href="classbdm_1_1datalink__m2m.html#a0ea05c47de4538b7042ff878e6e309a5" title="cond-to-cond link, indices of the local cond">c2c_lo</a>, cond_up ( <a class="code" href="classbdm_1_1datalink__m2m.html#ad64dda6f92654628276bbcebb7600d0d" title="cond-to-cond link, indices of the upper cond">c2c_up</a> ) ); |
| 614 | <a name="l00842"></a>00842 <span class="keywordflow">return</span> tmp; |
| 615 | <a name="l00843"></a>00843 } |
| 616 | <a name="l00845"></a>00845 |
| 617 | <a name="l00846"></a>00846 }; |
| 618 | <a name="l00847"></a>00847 |
| 619 | <a name="l00853"></a><a class="code" href="classbdm_1_1logger.html">00853</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> { |
| 620 | <a name="l00854"></a>00854 <span class="keyword">protected</span>: |
| 621 | <a name="l00856"></a><a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f">00856</a> Array<RV> <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>; |
| 622 | <a name="l00858"></a><a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02">00858</a> Array<string> <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>; |
| 623 | <a name="l00859"></a>00859 <span class="keyword">public</span>: |
| 624 | <a name="l00861"></a><a class="code" href="classbdm_1_1logger.html#af9c2fe7db5ddbda0098a4a5bd2c29fbf">00861</a> <a class="code" href="classbdm_1_1logger.html#af9c2fe7db5ddbda0098a4a5bd2c29fbf" title="Default constructor.">logger</a>() : <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( 0 ), <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a> ( 0 ) {} |
| 625 | <a name="l00862"></a>00862 |
| 626 | <a name="l00865"></a><a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7">00865</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7">add</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &rv, <span class="keywordtype">string</span> prefix = <span class="stringliteral">""</span> ) { |
| 627 | <a name="l00866"></a>00866 <span class="keywordtype">int</span> id; |
| 628 | <a name="l00867"></a>00867 <span class="keywordflow">if</span> ( rv.<a class="code" href="classbdm_1_1RV.html#ade30156104f61d86c94f758861418089" title="total size of a random variable">_dsize</a>() > 0 ) { |
| 629 | <a name="l00868"></a>00868 <span class="keywordtype">id</span> = <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.length(); |
| 630 | <a name="l00869"></a>00869 <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a> = concat ( <a class="code" href="classbdm_1_1logger.html#a68ca1f05cf3d414ba0f39211977b8d02" title="Names of logged quantities, e.g. names of algorithm variants.">names</a>, prefix ); <span class="comment">// diff</span> |
| 631 | <a name="l00870"></a>00870 <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.set_length ( <span class="keywordtype">id</span> + 1, <span class="keyword">true</span> ); |
| 632 | <a name="l00871"></a>00871 <a class="code" href="classbdm_1_1logger.html#ac54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a> ( <span class="keywordtype">id</span> ) = rv; |
| 633 | <a name="l00872"></a>00872 } <span class="keywordflow">else</span> { |
| 634 | <a name="l00873"></a>00873 <span class="keywordtype">id</span> = -1; |
| 635 | <a name="l00874"></a>00874 } |
| 636 | <a name="l00875"></a>00875 <span class="keywordflow">return</span> id; <span class="comment">// identifier of the last entry</span> |
| 637 | <a name="l00876"></a>00876 } |
| 638 | <a name="l00877"></a>00877 |
| 639 | <a name="l00879"></a><a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309">00879</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> vec &v ) { |
645 | | <a name="l00882"></a>00882 |
646 | | <a name="l00884"></a><a class="code" href="classbdm_1_1logger.html#af137e9a0c905357c5c3fbb16eac34a99">00884</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#af137e9a0c905357c5c3fbb16eac34a99" title="Shifts storage position for another time step.">step</a>() { |
647 | | <a name="l00885"></a>00885 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemneted"</span> ); |
648 | | <a name="l00886"></a>00886 }; |
649 | | <a name="l00887"></a>00887 |
650 | | <a name="l00889"></a><a class="code" href="classbdm_1_1logger.html#a0e3fc7d13e23a8f71fc7c8a5ea68559d">00889</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#a0e3fc7d13e23a8f71fc7c8a5ea68559d" title="Finalize storing information.">finalize</a>() {}; |
651 | | <a name="l00890"></a>00890 |
652 | | <a name="l00892"></a><a class="code" href="classbdm_1_1logger.html#acd6291a73491f755dc7bc88d022eb2fc">00892</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#acd6291a73491f755dc7bc88d022eb2fc" title="Initialize the storage.">init</a>() {}; |
653 | | <a name="l00893"></a>00893 |
654 | | <a name="l00894"></a>00894 }; |
655 | | <a name="l00895"></a>00895 |
656 | | <a name="l00899"></a><a class="code" href="classbdm_1_1mepdf.html">00899</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mepdf.html" title="Unconditional mpdf, allows using epdf in the role of mpdf.">mepdf</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a> { |
657 | | <a name="l00901"></a>00901 <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<epdf></a> iepdf; |
658 | | <a name="l00902"></a>00902 <span class="keyword">public</span>: |
659 | | <a name="l00904"></a><a class="code" href="classbdm_1_1mepdf.html#a4a2b01e7bb510c6b8946757cae6c9155">00904</a> <a class="code" href="classbdm_1_1mepdf.html#a4a2b01e7bb510c6b8946757cae6c9155" title="Default constructor.">mepdf</a>() { } |
660 | | <a name="l00906"></a><a class="code" href="classbdm_1_1mepdf.html#a1f94e70702ff676f53d95ca7ec38e25c">00906</a> <a class="code" href="classbdm_1_1mepdf.html#a1f94e70702ff676f53d95ca7ec38e25c" title="Set internal shared pointer.">mepdf</a> ( <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<epdf></a> em ) { |
661 | | <a name="l00907"></a>00907 iepdf = em; |
662 | | <a name="l00908"></a>00908 <a class="code" href="classbdm_1_1mpdf.html#a147afacb393324bb3f9a7a89e33f835e" title="set internal pointer ep to point to given iepdf ">set_ep</a> ( *iepdf.<a class="code" href="classbdm_1_1shared__ptr.html#a37ebcfb6750dd7b5630f1d2354c07a96">get</a>() ); |
663 | | <a name="l00909"></a>00909 <a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> = 0; |
664 | | <a name="l00910"></a>00910 } |
665 | | <a name="l00911"></a>00911 |
666 | | <a name="l00913"></a><a class="code" href="classbdm_1_1mepdf.html#ab904a90ef78294040b498717cc13015e">00913</a> vec <a class="code" href="classbdm_1_1mepdf.html#ab904a90ef78294040b498717cc13015e" title="empty">samplecond</a> ( <span class="keyword">const</span> vec &cond ) { |
667 | | <a name="l00914"></a>00914 <span class="keywordflow">return</span> iepdf->sample(); |
668 | | <a name="l00915"></a>00915 } |
669 | | <a name="l00916"></a><a class="code" href="classbdm_1_1mepdf.html#a57decd7718f3789e9d1f10f19def935b">00916</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mepdf.html#a57decd7718f3789e9d1f10f19def935b" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a> ( <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ) { |
670 | | <a name="l00917"></a>00917 <span class="keywordflow">return</span> iepdf->evallog ( val ); |
671 | | <a name="l00918"></a>00918 } |
672 | | <a name="l00919"></a>00919 |
673 | | <a name="l00927"></a>00927 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mepdf.html#a27ef18a3e3b1b5de02739d1324bf25fb" title="Load from structure with elements:.">from_setting</a> ( <span class="keyword">const</span> Setting &<span class="keyword">set</span> ); |
674 | | <a name="l00928"></a>00928 }; |
675 | | <a name="l00929"></a>00929 <a class="code" href="user__info_8h.html#a4f9de2f17e844047726487b99def99c6" title="Macro for registration of class into map of user-infos, registered class is scriptable...">UIREGISTER</a> ( mepdf ); |
676 | | <a name="l00930"></a>00930 SHAREDPTR ( mepdf ); |
677 | | <a name="l00931"></a>00931 |
678 | | <a name="l00933"></a>00933 RV get_composite_rv ( <span class="keyword">const</span> Array<shared_ptr<mpdf> > &mpdfs, <span class="keywordtype">bool</span> checkoverlap = <span class="keyword">false</span> ); |
679 | | <a name="l00934"></a>00934 |
680 | | <a name="l00950"></a><a class="code" href="classbdm_1_1DS.html">00950</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> { |
681 | | <a name="l00951"></a>00951 <span class="keyword">protected</span>: |
682 | | <a name="l00953"></a><a class="code" href="classbdm_1_1DS.html#af96cae44624e79638a91ec4f2c7c81a9">00953</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#af96cae44624e79638a91ec4f2c7c81a9" title="size of data returned by getdata() ">dtsize</a>; |
683 | | <a name="l00955"></a><a class="code" href="classbdm_1_1DS.html#ad7467046a0bd05bc992cc5e1bdedb983">00955</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#ad7467046a0bd05bc992cc5e1bdedb983" title="size of data">utsize</a>; |
684 | | <a name="l00957"></a><a class="code" href="classbdm_1_1DS.html#a22a4b29aa6e9f3bf17bcc4b28567e8bd">00957</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#a22a4b29aa6e9f3bf17bcc4b28567e8bd" title="size of output">ytsize</a>; |
685 | | <a name="l00959"></a><a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec">00959</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_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>; |
686 | | <a name="l00961"></a><a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702">00961</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_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>; <span class="comment">//</span> |
687 | | <a name="l00963"></a><a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995">00963</a> <span class="comment"></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#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a>; <span class="comment">//</span> |
688 | | <a name="l00965"></a><a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867">00965</a> <span class="comment"></span> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#ab4b7bdb9d98a11ab587aa0ad803bb867" title="Remember its own index in Logger L.">L_dt</a>, L_ut; |
689 | | <a name="l00966"></a>00966 <span class="keyword">public</span>: |
690 | | <a name="l00968"></a><a class="code" href="classbdm_1_1DS.html#abedd82e08ae6686b4b1732a122c2201a">00968</a> <a class="code" href="classbdm_1_1DS.html#abedd82e08ae6686b4b1732a122c2201a" title="default constructors">DS</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_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>(),<a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a>() {}; |
691 | | <a name="l00969"></a>00969 |
692 | | <a name="l00971"></a><a class="code" href="classbdm_1_1DS.html#a76d11928675f276f805655ae2a05d773">00971</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#a76d11928675f276f805655ae2a05d773" title="Returns maximum number of provided data, by default it is set to maximum allowed...">max_length</a>() {<span class="keywordflow">return</span> std::numeric_limits< int >::max();} |
693 | | <a name="l00973"></a><a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba">00973</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( vec &dt ) { |
694 | | <a name="l00974"></a>00974 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"abstract class"</span> ); |
695 | | <a name="l00975"></a>00975 } |
696 | | <a name="l00977"></a><a class="code" href="classbdm_1_1DS.html#aa0bf451c7fea73ff4150ff9e83da4832">00977</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#aa0bf451c7fea73ff4150ff9e83da4832" title="Returns data records at indeces.">getdata</a> ( vec &dt, <span class="keyword">const</span> ivec &indeces ) { |
| 642 | <a name="l00883"></a><a class="code" href="classbdm_1_1logger.html#aaa1d72cd3d2ff6bbf87340154af02ea6">00883</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#aaa1d72cd3d2ff6bbf87340154af02ea6" title="log this double">logit</a> ( <span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> <span class="keywordtype">double</span> &d ) { |
| 643 | <a name="l00884"></a>00884 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 644 | <a name="l00885"></a>00885 }; |
| 645 | <a name="l00886"></a>00886 |
| 646 | <a name="l00888"></a><a class="code" href="classbdm_1_1logger.html#af137e9a0c905357c5c3fbb16eac34a99">00888</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#af137e9a0c905357c5c3fbb16eac34a99" title="Shifts storage position for another time step.">step</a>() { |
| 647 | <a name="l00889"></a>00889 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemneted"</span> ); |
| 648 | <a name="l00890"></a>00890 }; |
| 649 | <a name="l00891"></a>00891 |
| 650 | <a name="l00893"></a><a class="code" href="classbdm_1_1logger.html#a0e3fc7d13e23a8f71fc7c8a5ea68559d">00893</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#a0e3fc7d13e23a8f71fc7c8a5ea68559d" title="Finalize storing information.">finalize</a>() {}; |
| 651 | <a name="l00894"></a>00894 |
| 652 | <a name="l00896"></a><a class="code" href="classbdm_1_1logger.html#acd6291a73491f755dc7bc88d022eb2fc">00896</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#acd6291a73491f755dc7bc88d022eb2fc" title="Initialize the storage.">init</a>() {}; |
| 653 | <a name="l00897"></a>00897 |
| 654 | <a name="l00898"></a>00898 }; |
| 655 | <a name="l00899"></a>00899 |
| 656 | <a name="l00903"></a><a class="code" href="classbdm_1_1mepdf.html">00903</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mepdf.html" title="Unconditional mpdf, allows using epdf in the role of mpdf.">mepdf</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling , where is random variable, rv, and...">mpdf</a> { |
| 657 | <a name="l00905"></a>00905 <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<epdf></a> iepdf; |
| 658 | <a name="l00906"></a>00906 <span class="keyword">public</span>: |
| 659 | <a name="l00908"></a><a class="code" href="classbdm_1_1mepdf.html#a4a2b01e7bb510c6b8946757cae6c9155">00908</a> <a class="code" href="classbdm_1_1mepdf.html#a4a2b01e7bb510c6b8946757cae6c9155" title="Default constructor.">mepdf</a>() { } |
| 660 | <a name="l00910"></a><a class="code" href="classbdm_1_1mepdf.html#a1f94e70702ff676f53d95ca7ec38e25c">00910</a> <a class="code" href="classbdm_1_1mepdf.html#a1f94e70702ff676f53d95ca7ec38e25c" title="Set internal shared pointer.">mepdf</a> ( <a class="code" href="classbdm_1_1shared__ptr.html">shared_ptr<epdf></a> em ) { |
| 661 | <a name="l00911"></a>00911 iepdf = em; |
| 662 | <a name="l00912"></a>00912 <a class="code" href="classbdm_1_1mpdf.html#a147afacb393324bb3f9a7a89e33f835e" title="set internal pointer ep to point to given iepdf ">set_ep</a> ( *iepdf.<a class="code" href="classbdm_1_1shared__ptr.html#a37ebcfb6750dd7b5630f1d2354c07a96">get</a>() ); |
| 663 | <a name="l00913"></a>00913 <a class="code" href="classbdm_1_1mpdf.html#a7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> = 0; |
| 664 | <a name="l00914"></a>00914 } |
| 665 | <a name="l00915"></a>00915 |
| 666 | <a name="l00917"></a><a class="code" href="classbdm_1_1mepdf.html#ab904a90ef78294040b498717cc13015e">00917</a> vec <a class="code" href="classbdm_1_1mepdf.html#ab904a90ef78294040b498717cc13015e" title="empty">samplecond</a> ( <span class="keyword">const</span> vec &cond ) { |
| 667 | <a name="l00918"></a>00918 <span class="keywordflow">return</span> iepdf->sample(); |
| 668 | <a name="l00919"></a>00919 } |
| 669 | <a name="l00920"></a><a class="code" href="classbdm_1_1mepdf.html#a57decd7718f3789e9d1f10f19def935b">00920</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mepdf.html#a57decd7718f3789e9d1f10f19def935b" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a> ( <span class="keyword">const</span> vec &val, <span class="keyword">const</span> vec &cond ) { |
| 670 | <a name="l00921"></a>00921 <span class="keywordflow">return</span> iepdf->evallog ( val ); |
| 671 | <a name="l00922"></a>00922 } |
| 672 | <a name="l00923"></a>00923 |
| 673 | <a name="l00931"></a>00931 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mepdf.html#a27ef18a3e3b1b5de02739d1324bf25fb">from_setting</a> ( <span class="keyword">const</span> Setting &<span class="keyword">set</span> ); |
| 674 | <a name="l00932"></a>00932 }; |
| 675 | <a name="l00933"></a>00933 <a class="code" href="user__info_8h.html#a4f9de2f17e844047726487b99def99c6" title="Macro for registration of class into map of user-infos, registered class is scriptable...">UIREGISTER</a> ( mepdf ); |
| 676 | <a name="l00934"></a>00934 SHAREDPTR ( mepdf ); |
| 677 | <a name="l00935"></a>00935 |
| 678 | <a name="l00937"></a>00937 RV get_composite_rv ( <span class="keyword">const</span> Array<shared_ptr<mpdf> > &mpdfs, <span class="keywordtype">bool</span> checkoverlap = <span class="keyword">false</span> ); |
| 679 | <a name="l00938"></a>00938 |
| 680 | <a name="l00954"></a><a class="code" href="classbdm_1_1DS.html">00954</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1DS.html" title="Abstract class for discrete-time sources of data.">DS</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1root.html" title="Root class of BDM objects.">root</a> { |
| 681 | <a name="l00955"></a>00955 <span class="keyword">protected</span>: |
| 682 | <a name="l00957"></a><a class="code" href="classbdm_1_1DS.html#af96cae44624e79638a91ec4f2c7c81a9">00957</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#af96cae44624e79638a91ec4f2c7c81a9" title="size of data returned by getdata() ">dtsize</a>; |
| 683 | <a name="l00959"></a><a class="code" href="classbdm_1_1DS.html#ad7467046a0bd05bc992cc5e1bdedb983">00959</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#ad7467046a0bd05bc992cc5e1bdedb983" title="size of data">utsize</a>; |
| 684 | <a name="l00961"></a><a class="code" href="classbdm_1_1DS.html#a22a4b29aa6e9f3bf17bcc4b28567e8bd">00961</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#a22a4b29aa6e9f3bf17bcc4b28567e8bd" title="size of output">ytsize</a>; |
| 685 | <a name="l00963"></a><a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec">00963</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_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>; |
| 686 | <a name="l00965"></a><a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702">00965</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_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>; <span class="comment">//</span> |
| 687 | <a name="l00967"></a><a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995">00967</a> <span class="comment"></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#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a>; <span class="comment">//</span> |
| 688 | <a name="l00969"></a><a class="code" href="classbdm_1_1DS.html#a13c89cfedbd132742534641ed69391d4">00969</a> <span class="comment"></span> ivec <a class="code" href="classbdm_1_1DS.html#a13c89cfedbd132742534641ed69391d4" title="Remember its own index in Logger L, [0=dt, 1=ut].">LIDs</a>; |
| 689 | <a name="l00970"></a>00970 <span class="keyword">public</span>: |
| 690 | <a name="l00972"></a><a class="code" href="classbdm_1_1DS.html#abedd82e08ae6686b4b1732a122c2201a">00972</a> <a class="code" href="classbdm_1_1DS.html#abedd82e08ae6686b4b1732a122c2201a" title="default constructors">DS</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_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>(),<a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a>(), <a class="code" href="classbdm_1_1DS.html#a13c89cfedbd132742534641ed69391d4" title="Remember its own index in Logger L, [0=dt, 1=ut].">LIDs</a>(2) {}; |
| 691 | <a name="l00973"></a>00973 |
| 692 | <a name="l00975"></a><a class="code" href="classbdm_1_1DS.html#a76d11928675f276f805655ae2a05d773">00975</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1DS.html#a76d11928675f276f805655ae2a05d773" title="Returns maximum number of provided data, by default it is set to maximum allowed...">max_length</a>() {<span class="keywordflow">return</span> std::numeric_limits< int >::max();} |
| 693 | <a name="l00977"></a><a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba">00977</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( vec &dt ) { |
699 | | <a name="l00980"></a>00980 |
700 | | <a name="l00982"></a><a class="code" href="classbdm_1_1DS.html#af5baeee8528e5e4c5c7a344b2e3f192a">00982</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#af5baeee8528e5e4c5c7a344b2e3f192a" title="Accepts action variable and schedule it for application.">write</a> ( vec &ut ) { |
701 | | <a name="l00983"></a>00983 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"abstract class"</span> ); |
702 | | <a name="l00984"></a>00984 } |
703 | | <a name="l00985"></a>00985 |
704 | | <a name="l00987"></a><a class="code" href="classbdm_1_1DS.html#a6bced13f84f6bf04449728817e049e1d">00987</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a6bced13f84f6bf04449728817e049e1d" title="Accepts action variables at specific indeces.">write</a> ( vec &ut, <span class="keyword">const</span> ivec &indeces ) { |
705 | | <a name="l00988"></a>00988 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"abstract class"</span> ); |
706 | | <a name="l00989"></a>00989 } |
707 | | <a name="l00990"></a>00990 |
708 | | <a name="l00992"></a><a class="code" href="classbdm_1_1DS.html#a4df78b21d352013d8804a8dda860b7ea">00992</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>() |
709 | | <a name="l00993"></a>00993 { |
710 | | <a name="l00994"></a>00994 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"abstract class"</span> ); |
711 | | <a name="l00995"></a>00995 } |
712 | | <a name="l00996"></a>00996 |
713 | | <a name="l00998"></a><a class="code" href="classbdm_1_1DS.html#a3c9e417d85052396fe74c164857ee67e">00998</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 ) { |
714 | | <a name="l00999"></a>00999 <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>() ) ); |
715 | | <a name="l01000"></a>01000 <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>() ) ); |
716 | | <a name="l01001"></a>01001 |
717 | | <a name="l01002"></a>01002 <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> ); |
718 | | <a name="l01003"></a>01003 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> ); |
719 | | <a name="l01004"></a>01004 } |
720 | | <a name="l01006"></a><a class="code" href="classbdm_1_1DS.html#ae03d2c93cddd5c3a03107ddd3ae999cf">01006</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 ) { |
721 | | <a name="l01007"></a>01007 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>() ); |
722 | | <a name="l01008"></a>01008 <a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( tmp ); |
723 | | <a name="l01009"></a>01009 <span class="comment">// d is first in getdata</span> |
724 | | <a name="l01010"></a>01010 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>() ) ); |
725 | | <a name="l01011"></a>01011 <span class="comment">// u follows after d in getdata</span> |
726 | | <a name="l01012"></a>01012 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>() ) ); |
727 | | <a name="l01013"></a>01013 } |
728 | | <a name="l01015"></a><a class="code" href="classbdm_1_1DS.html#a069497b610296be053d862a2493be0ce">01015</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>{ |
729 | | <a name="l01016"></a>01016 <span class="comment">// return concat (Drv, Urv);// why!!!</span> |
730 | | <a name="l01017"></a>01017 <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> |
731 | | <a name="l01018"></a>01018 } |
732 | | <a name="l01020"></a><a class="code" href="classbdm_1_1DS.html#aa6a9a375da64c82fc227bda3418a1f33">01020</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>{ |
733 | | <a name="l01021"></a>01021 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>; |
| 696 | <a name="l00981"></a><a class="code" href="classbdm_1_1DS.html#aa0bf451c7fea73ff4150ff9e83da4832">00981</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#aa0bf451c7fea73ff4150ff9e83da4832" title="Returns data records at indeces.">getdata</a> ( vec &dt, <span class="keyword">const</span> ivec &indeces ) { |
| 697 | <a name="l00982"></a>00982 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"abstract class"</span> ); |
| 698 | <a name="l00983"></a>00983 } |
| 699 | <a name="l00984"></a>00984 |
| 700 | <a name="l00986"></a><a class="code" href="classbdm_1_1DS.html#a19ed7794819b195e9d9adbd29da999bd">00986</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#a19ed7794819b195e9d9adbd29da999bd" title="Accepts action variable and schedule it for application.">write</a> (<span class="keyword">const</span> vec &ut ) { |
| 701 | <a name="l00987"></a>00987 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"abstract class"</span> ); |
| 702 | <a name="l00988"></a>00988 } |
| 703 | <a name="l00989"></a>00989 |
| 704 | <a name="l00991"></a><a class="code" href="classbdm_1_1DS.html#aa5a8d2a5125cda38fd191c246129ece6">00991</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1DS.html#aa5a8d2a5125cda38fd191c246129ece6" title="Accepts action variables at specific indeces.">write</a> (<span class="keyword">const</span> vec &ut, <span class="keyword">const</span> ivec &indeces ) { |
| 705 | <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> ); |
| 706 | <a name="l00993"></a>00993 } |
| 707 | <a name="l00994"></a>00994 |
| 708 | <a name="l00996"></a><a class="code" href="classbdm_1_1DS.html#a4df78b21d352013d8804a8dda860b7ea">00996</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>() |
| 709 | <a name="l00997"></a>00997 { |
| 710 | <a name="l00998"></a>00998 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"abstract class"</span> ); |
| 711 | <a name="l00999"></a>00999 } |
| 712 | <a name="l01000"></a>01000 |
| 713 | <a name="l01002"></a><a class="code" href="classbdm_1_1DS.html#a3c9e417d85052396fe74c164857ee67e">01002</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 ) { |
| 714 | <a name="l01003"></a>01003 <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>() ) ); |
| 715 | <a name="l01004"></a>01004 <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>() ) ); |
| 716 | <a name="l01005"></a>01005 |
| 717 | <a name="l01006"></a>01006 <a class="code" href="classbdm_1_1DS.html#a13c89cfedbd132742534641ed69391d4" title="Remember its own index in Logger L, [0=dt, 1=ut].">LIDs</a>(0) = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7">add</a> ( <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a>, <span class="stringliteral">""</span> ); |
| 718 | <a name="l01007"></a>01007 <a class="code" href="classbdm_1_1DS.html#a13c89cfedbd132742534641ed69391d4" title="Remember its own index in Logger L, [0=dt, 1=ut].">LIDs</a>(1) = L.<a class="code" href="classbdm_1_1logger.html#a47aa3b098a81d02a8ffaea2c9fa09ac7">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> ); |
| 719 | <a name="l01008"></a>01008 } |
| 720 | <a name="l01010"></a><a class="code" href="classbdm_1_1DS.html#ae03d2c93cddd5c3a03107ddd3ae999cf">01010</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 ) { |
| 721 | <a name="l01011"></a>01011 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>() ); |
| 722 | <a name="l01012"></a>01012 <a class="code" href="classbdm_1_1DS.html#ac1ec862dec7164fee3284c6f9a51b0ba" title="Returns full vector of observed data=[output, input].">getdata</a> ( tmp ); |
| 723 | <a name="l01013"></a>01013 <span class="comment">// d is first in getdata</span> |
| 724 | <a name="l01014"></a>01014 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1DS.html#a13c89cfedbd132742534641ed69391d4" title="Remember its own index in Logger L, [0=dt, 1=ut].">LIDs</a>(0), 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>() ) ); |
| 725 | <a name="l01015"></a>01015 <span class="comment">// u follows after d in getdata</span> |
| 726 | <a name="l01016"></a>01016 L.<a class="code" href="classbdm_1_1logger.html#ae30f695619931b3c372ab280e452d309" title="log this vector">logit</a> ( <a class="code" href="classbdm_1_1DS.html#a13c89cfedbd132742534641ed69391d4" title="Remember its own index in Logger L, [0=dt, 1=ut].">LIDs</a>(1), 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>() ) ); |
| 727 | <a name="l01017"></a>01017 } |
| 728 | <a name="l01019"></a><a class="code" href="classbdm_1_1DS.html#a069497b610296be053d862a2493be0ce">01019</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>{ |
| 729 | <a name="l01020"></a>01020 <span class="comment">// return concat (Drv, Urv);// why!!!</span> |
| 730 | <a name="l01021"></a>01021 <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> |
735 | | <a name="l01024"></a><a class="code" href="classbdm_1_1DS.html#ac09878f86907329ac631a3df8755c558">01024</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>{ |
736 | | <a name="l01025"></a>01025 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a>; |
737 | | <a name="l01026"></a>01026 } |
738 | | <a name="l01028"></a><a class="code" href="classbdm_1_1DS.html#a3a92d77fd97fdb6bf1c8edb1e38c6bbc">01028</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) { |
739 | | <a name="l01029"></a>01029 <a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a> = yrv; |
740 | | <a name="l01030"></a>01030 <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a> = concat(yrv,urv); |
741 | | <a name="l01031"></a>01031 <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> = urv; |
742 | | <a name="l01032"></a>01032 } |
743 | | <a name="l01033"></a>01033 }; |
744 | | <a name="l01034"></a>01034 |
745 | | <a name="l01056"></a><a class="code" href="classbdm_1_1BM.html">01056</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> { |
746 | | <a name="l01057"></a>01057 <span class="keyword">protected</span>: |
747 | | <a name="l01059"></a><a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed">01059</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>; |
748 | | <a name="l01061"></a><a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a">01061</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
749 | | <a name="l01063"></a><a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee">01063</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>; |
750 | | <a name="l01064"></a>01064 <span class="keyword">public</span>: |
751 | | <a name="l01067"></a>01067 |
752 | | <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>() : <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 ) { |
753 | | <a name="l01069"></a>01069 <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> |
754 | | <a name="l01070"></a>01070 <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; |
755 | | <a name="l01071"></a>01071 <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> |
756 | | <a name="l01072"></a>01072 }; |
757 | | <a name="l01073"></a>01073 <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> ) {} |
758 | | <a name="l01076"></a><a class="code" href="classbdm_1_1BM.html#a40f01563651c1e4fe926189e41a6b8ab">01076</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" title="Copy function required in vectors, Arrays of BM etc. Have to be DELETED manually!...">_copy_</a>()<span class="keyword"> const </span>{ |
759 | | <a name="l01077"></a>01077 <span class="keywordflow">return</span> NULL; |
760 | | <a name="l01078"></a>01078 }; |
761 | | <a name="l01080"></a>01080 |
762 | | <a name="l01083"></a>01083 |
763 | | <a name="l01087"></a>01087 <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; |
764 | | <a name="l01089"></a>01089 <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 ); |
765 | | <a name="l01092"></a><a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">01092</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>{ |
766 | | <a name="l01093"></a>01093 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
767 | | <a name="l01094"></a>01094 <span class="keywordflow">return</span> 0.0; |
768 | | <a name="l01095"></a>01095 } |
769 | | <a name="l01096"></a>01096 |
770 | | <a name="l01098"></a><a class="code" href="classbdm_1_1BM.html#a0e8ebe61fb14990abe1254bd3dda5fae">01098</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>{ |
771 | | <a name="l01099"></a>01099 vec tmp ( dt.cols() ); |
772 | | <a name="l01100"></a>01100 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < dt.cols(); i++ ) { |
773 | | <a name="l01101"></a>01101 tmp ( i ) = <a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( dt.get_col ( i ) ); |
774 | | <a name="l01102"></a>01102 } |
775 | | <a name="l01103"></a>01103 <span class="keywordflow">return</span> tmp; |
776 | | <a name="l01104"></a>01104 } |
777 | | <a name="l01105"></a>01105 |
778 | | <a name="l01107"></a><a class="code" href="classbdm_1_1BM.html#a688d7a2aced1e06aa1c468d73a9e5eba">01107</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>{ |
779 | | <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> ); |
780 | | <a name="l01109"></a>01109 <span class="keywordflow">return</span> NULL; |
781 | | <a name="l01110"></a>01110 }; |
782 | | <a name="l01112"></a><a class="code" href="classbdm_1_1BM.html#a598b25e3f3d96a5bc00a5faeb5b3c912">01112</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>{ |
783 | | <a name="l01113"></a>01113 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
784 | | <a name="l01114"></a>01114 <span class="keywordflow">return</span> NULL; |
785 | | <a name="l01115"></a>01115 }; |
786 | | <a name="l01117"></a>01117 |
787 | | <a name="l01122"></a>01122 |
788 | | <a name="l01124"></a><a class="code" href="classbdm_1_1BM.html#ade95c590d650b2db423d53992f0906cb">01124</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>; |
789 | | <a name="l01126"></a><a class="code" href="classbdm_1_1BM.html#ab5e8e016be16e4029c789063cb3f3b33">01126</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>{ |
790 | | <a name="l01127"></a>01127 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#ade95c590d650b2db423d53992f0906cb" title="Name of extension variable.">rvc</a>; |
791 | | <a name="l01128"></a>01128 } |
792 | | <a name="l01129"></a>01129 |
793 | | <a name="l01131"></a><a class="code" href="classbdm_1_1BM.html#a6799f4b16a6a59ed58b1d0d6e17116f4">01131</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 ) { |
794 | | <a name="l01132"></a>01132 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented!"</span> ); |
795 | | <a name="l01133"></a>01133 } |
796 | | <a name="l01134"></a>01134 |
797 | | <a name="l01136"></a>01136 |
798 | | <a name="l01137"></a>01137 |
| 732 | <a name="l01024"></a><a class="code" href="classbdm_1_1DS.html#aa6a9a375da64c82fc227bda3418a1f33">01024</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>{ |
| 733 | <a name="l01025"></a>01025 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a>; |
| 734 | <a name="l01026"></a>01026 } |
| 735 | <a name="l01028"></a><a class="code" href="classbdm_1_1DS.html#ac09878f86907329ac631a3df8755c558">01028</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>{ |
| 736 | <a name="l01029"></a>01029 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a>; |
| 737 | <a name="l01030"></a>01030 } |
| 738 | <a name="l01032"></a><a class="code" href="classbdm_1_1DS.html#a3a92d77fd97fdb6bf1c8edb1e38c6bbc">01032</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) { |
| 739 | <a name="l01033"></a>01033 <a class="code" href="classbdm_1_1DS.html#aeb9de2a85f0d8257d79d9b68c05c4995" title="Description of output data.">Yrv</a> = yrv; |
| 740 | <a name="l01034"></a>01034 <a class="code" href="classbdm_1_1DS.html#ad8db125ac35f3b8eeb773fc9a4cb45ec" title="Description of data returned by getdata().">Drv</a> = concat(yrv,urv); |
| 741 | <a name="l01035"></a>01035 <a class="code" href="classbdm_1_1DS.html#a9ac5970128fd39f4f6226723cd1de702" title="Description of data witten by by write().">Urv</a> = urv; |
| 742 | <a name="l01036"></a>01036 } |
| 743 | <a name="l01037"></a>01037 }; |
| 744 | <a name="l01038"></a>01038 |
| 745 | <a name="l01060"></a><a class="code" href="classbdm_1_1BM.html">01060</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> { |
| 746 | <a name="l01061"></a>01061 <span class="keyword">protected</span>: |
| 747 | <a name="l01063"></a><a class="code" href="classbdm_1_1BM.html#ac400357e37d27a4834b2b1d9211009ed">01063</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>; |
| 748 | <a name="l01065"></a><a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a">01065</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
| 749 | <a name="l01067"></a><a class="code" href="classbdm_1_1BM.html#afaff0ad12556fe7dc0e2807d4fd938ee">01067</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>; |
| 750 | <a name="l01068"></a>01068 <span class="keyword">public</span>: |
| 751 | <a name="l01071"></a>01071 |
| 752 | <a name="l01072"></a>01072 <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 ) { |
| 753 | <a name="l01073"></a>01073 <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> |
| 754 | <a name="l01074"></a>01074 <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; |
| 755 | <a name="l01075"></a>01075 <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> |
| 756 | <a name="l01076"></a>01076 }; |
| 757 | <a name="l01077"></a>01077 <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> ) {} |
| 758 | <a name="l01080"></a><a class="code" href="classbdm_1_1BM.html#a40f01563651c1e4fe926189e41a6b8ab">01080</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" title="Copy function required in vectors, Arrays of BM etc. Have to be DELETED manually!...">_copy_</a>()<span class="keyword"> const </span>{ |
| 759 | <a name="l01081"></a>01081 <span class="keywordflow">return</span> NULL; |
| 760 | <a name="l01082"></a>01082 }; |
| 761 | <a name="l01084"></a>01084 |
| 762 | <a name="l01087"></a>01087 |
| 763 | <a name="l01091"></a>01091 <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; |
| 764 | <a name="l01093"></a>01093 <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 ); |
| 765 | <a name="l01096"></a><a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">01096</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>{ |
| 766 | <a name="l01097"></a>01097 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 767 | <a name="l01098"></a>01098 <span class="keywordflow">return</span> 0.0; |
| 768 | <a name="l01099"></a>01099 } |
| 769 | <a name="l01100"></a>01100 |
| 770 | <a name="l01102"></a><a class="code" href="classbdm_1_1BM.html#a0e8ebe61fb14990abe1254bd3dda5fae">01102</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>{ |
| 771 | <a name="l01103"></a>01103 vec tmp ( dt.cols() ); |
| 772 | <a name="l01104"></a>01104 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < dt.cols(); i++ ) { |
| 773 | <a name="l01105"></a>01105 tmp ( i ) = <a class="code" href="classbdm_1_1BM.html#a50257e0c1e5b5c73153ea6e716ad8ae0">logpred</a> ( dt.get_col ( i ) ); |
| 774 | <a name="l01106"></a>01106 } |
| 775 | <a name="l01107"></a>01107 <span class="keywordflow">return</span> tmp; |
| 776 | <a name="l01108"></a>01108 } |
| 777 | <a name="l01109"></a>01109 |
| 778 | <a name="l01111"></a><a class="code" href="classbdm_1_1BM.html#a688d7a2aced1e06aa1c468d73a9e5eba">01111</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>{ |
| 779 | <a name="l01112"></a>01112 <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="l01113"></a>01113 <span class="keywordflow">return</span> NULL; |
| 781 | <a name="l01114"></a>01114 }; |
| 782 | <a name="l01116"></a><a class="code" href="classbdm_1_1BM.html#a598b25e3f3d96a5bc00a5faeb5b3c912">01116</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>{ |
| 783 | <a name="l01117"></a>01117 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented"</span> ); |
| 784 | <a name="l01118"></a>01118 <span class="keywordflow">return</span> NULL; |
| 785 | <a name="l01119"></a>01119 }; |
| 786 | <a name="l01121"></a>01121 |
| 787 | <a name="l01126"></a>01126 |
| 788 | <a name="l01128"></a><a class="code" href="classbdm_1_1BM.html#ade95c590d650b2db423d53992f0906cb">01128</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>; |
| 789 | <a name="l01130"></a><a class="code" href="classbdm_1_1BM.html#ab5e8e016be16e4029c789063cb3f3b33">01130</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>{ |
| 790 | <a name="l01131"></a>01131 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#ade95c590d650b2db423d53992f0906cb" title="Name of extension variable.">rvc</a>; |
| 791 | <a name="l01132"></a>01132 } |
| 792 | <a name="l01133"></a>01133 |
| 793 | <a name="l01135"></a><a class="code" href="classbdm_1_1BM.html#a6799f4b16a6a59ed58b1d0d6e17116f4">01135</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 ) { |
| 794 | <a name="l01136"></a>01136 <a class="code" href="bdmerror_8h.html#a7c43f3a72afe68ab0c85663a1bb3521a" title="Unconditionally throw std::runtime_error.">bdm_error</a> ( <span class="stringliteral">"Not implemented!"</span> ); |
| 795 | <a name="l01137"></a>01137 } |
| 796 | <a name="l01138"></a>01138 |
815 | | <a name="l01156"></a>01156 <span class="keyword">virtual</span> <span class="keyword">const</span> epdf& posterior() <span class="keyword">const</span> = 0; |
816 | | <a name="l01158"></a>01158 |
817 | | <a name="l01161"></a>01161 |
818 | | <a name="l01163"></a><a class="code" href="classbdm_1_1BM.html#aadb539fa2585c8a2a91c54e5aebf330e">01163</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <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> ( <span class="keyword">const</span> <span class="keywordtype">string</span> &opt ) { |
819 | | <a name="l01164"></a>01164 <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; |
820 | | <a name="l01165"></a>01165 <span class="keywordflow">if</span> ( opt.find ( <span class="stringliteral">"logbounds"</span> ) != string::npos ) { |
821 | | <a name="l01166"></a>01166 <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 ) = 1; |
822 | | <a name="l01167"></a>01167 <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 ) = 1; |
823 | | <a name="l01168"></a>01168 } |
824 | | <a name="l01169"></a>01169 <span class="keywordflow">if</span> ( opt.find ( <span class="stringliteral">"logll"</span> ) != string::npos ) { |
825 | | <a name="l01170"></a>01170 <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; |
826 | | <a name="l01171"></a>01171 } |
827 | | <a name="l01172"></a>01172 } |
828 | | <a name="l01174"></a><a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca">01174</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>; |
829 | | <a name="l01175"></a>01175 |
830 | | <a name="l01177"></a><a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207">01177</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>; |
831 | | <a name="l01179"></a><a class="code" href="classbdm_1_1BM.html#a2298ca6af9b13a78a4c9e18ab43f1827">01179</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> ) { |
832 | | <a name="l01180"></a>01180 <span class="comment">// internal</span> |
833 | | <a name="l01181"></a>01181 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> r; |
834 | | <a name="l01182"></a>01182 <span class="keywordflow">if</span> ( posterior().isnamed() ) { |
835 | | <a name="l01183"></a>01183 r = posterior().<a class="code" href="classbdm_1_1epdf.html#aa4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>(); |
836 | | <a name="l01184"></a>01184 } <span class="keywordflow">else</span> { |
837 | | <a name="l01185"></a>01185 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() ); |
838 | | <a name="l01186"></a>01186 }; |
839 | | <a name="l01187"></a>01187 |
840 | | <a name="l01188"></a>01188 <span class="comment">// Add mean value</span> |
841 | | <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> ( 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> ); |
842 | | <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> ( 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> ); |
843 | | <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> ( 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> ); |
844 | | <a name="l01192"></a>01192 <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> |
845 | | <a name="l01193"></a>01193 } |
846 | | <a name="l01195"></a><a class="code" href="classbdm_1_1BM.html#ab517e1679eaa94e803ea4cd0b8efbcd7">01195</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#ab517e1679eaa94e803ea4cd0b8efbcd7" title="Save results to the given logger, details of what is stored is configured by LIDs...">logit</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
847 | | <a name="l01196"></a>01196 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() ); |
848 | | <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> ( 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> |
849 | | <a name="l01198"></a>01198 vec ub, lb; |
850 | | <a name="l01199"></a>01199 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 ); |
851 | | <a name="l01200"></a>01200 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 ); |
852 | | <a name="l01201"></a>01201 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 ); |
853 | | <a name="l01202"></a>01202 } |
854 | | <a name="l01203"></a>01203 <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> ); |
855 | | <a name="l01204"></a>01204 } |
856 | | <a name="l01206"></a><a class="code" href="classbdm_1_1BM.html#a23c6a8f71f922023ab08dcb0487a86de">01206</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> ) { |
857 | | <a name="l01207"></a>01207 <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 ); |
858 | | <a name="l01208"></a>01208 <span class="keywordflow">if</span> ( r ) { |
859 | | <a name="l01209"></a>01209 set_drv ( *r ); |
860 | | <a name="l01210"></a>01210 } |
861 | | <a name="l01211"></a>01211 <span class="keywordtype">string</span> opt; |
862 | | <a name="l01212"></a>01212 <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 ) ) { |
863 | | <a name="l01213"></a>01213 <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 ); |
864 | | <a name="l01214"></a>01214 } |
865 | | <a name="l01215"></a>01215 } |
866 | | <a name="l01216"></a>01216 |
867 | | <a name="l01217"></a>01217 }; |
868 | | <a name="l01218"></a>01218 |
869 | | <a name="l01219"></a>01219 <span class="keyword">typedef</span> Array<shared_ptr<epdf> > epdf_array; |
870 | | <a name="l01220"></a>01220 |
871 | | <a name="l01221"></a>01221 <span class="keyword">typedef</span> Array<shared_ptr<mpdf> > mpdf_array; |
872 | | <a name="l01222"></a>01222 |
873 | | <a name="l01223"></a>01223 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
874 | | <a name="l01224"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ad8e547695d1cc19219b91164d825c930">01224</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 ) { |
875 | | <a name="l01225"></a>01225 <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="l01226"></a>01226 vec temp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.sample(); |
877 | | <a name="l01227"></a>01227 <span class="keywordflow">return</span> temp; |
878 | | <a name="l01228"></a>01228 } |
879 | | <a name="l01229"></a>01229 |
880 | | <a name="l01230"></a>01230 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
881 | | <a name="l01231"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a9554c554054da2d22cb8e908ae9c8823">01231</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 ) { |
882 | | <a name="l01232"></a>01232 <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 ); |
883 | | <a name="l01233"></a>01233 mat temp ( dimension(), N ); |
884 | | <a name="l01234"></a>01234 vec smp ( dimension() ); |
885 | | <a name="l01235"></a>01235 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < N; i++ ) { |
886 | | <a name="l01236"></a>01236 smp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.sample(); |
887 | | <a name="l01237"></a>01237 temp.set_col ( i, smp ); |
888 | | <a name="l01238"></a>01238 } |
889 | | <a name="l01239"></a>01239 |
890 | | <a name="l01240"></a>01240 <span class="keywordflow">return</span> temp; |
891 | | <a name="l01241"></a>01241 } |
892 | | <a name="l01242"></a>01242 |
893 | | <a name="l01243"></a>01243 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
894 | | <a name="l01244"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a89076e62b8d7df7616bad68c94591948">01244</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 ) { |
895 | | <a name="l01245"></a>01245 <span class="keywordtype">double</span> tmp; |
896 | | <a name="l01246"></a>01246 <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="l01247"></a>01247 tmp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog ( dt ); |
898 | | <a name="l01248"></a>01248 <span class="keywordflow">return</span> tmp; |
899 | | <a name="l01249"></a>01249 } |
900 | | <a name="l01250"></a>01250 |
901 | | <a name="l01251"></a>01251 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
902 | | <a name="l01252"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c">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> mat &Dt, <span class="keyword">const</span> vec &cond ) { |
903 | | <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 ); |
904 | | <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 ); |
905 | | <a name="l01255"></a>01255 } |
906 | | <a name="l01256"></a>01256 |
907 | | <a name="l01257"></a>01257 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
908 | | <a name="l01258"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae82db07ce8af02f29cfd81e014edb3db">01258</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 ) { |
909 | | <a name="l01259"></a>01259 <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 ); |
910 | | <a name="l01260"></a>01260 <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 ); |
911 | | <a name="l01261"></a>01261 } |
912 | | <a name="l01262"></a>01262 |
913 | | <a name="l01263"></a>01263 }; <span class="comment">//namespace</span> |
914 | | <a name="l01264"></a>01264 <span class="preprocessor">#endif // BDMBASE_H</span> |
| 808 | <a name="l01157"></a><a class="code" href="classbdm_1_1BM.html#a5be65d37dedfe33a3671e7065f523a70">01157</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1BM.html#a5be65d37dedfe33a3671e7065f523a70" title="return internal log-likelihood of the last data vector">_ll</a>()<span class="keyword"> const </span>{ |
| 809 | <a name="l01158"></a>01158 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1BM.html#a4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>; |
| 810 | <a name="l01159"></a>01159 } |
| 811 | <a name="l01161"></a><a class="code" href="classbdm_1_1BM.html#a236b3abbcc93594fc97cd86d82c1a83f">01161</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#a236b3abbcc93594fc97cd86d82c1a83f" title="switch evaluation of log-likelihood on/off">set_evalll</a> ( <span class="keywordtype">bool</span> evl0 ) { |
| 812 | <a name="l01162"></a>01162 <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> = evl0; |
| 813 | <a name="l01163"></a>01163 } |
| 814 | <a name="l01165"></a>01165 <span class="keyword">virtual</span> <span class="keyword">const</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#abb7b0065d6cb722a66b371a8260121e1" title="return posterior density">posterior</a>() <span class="keyword">const</span> = 0; |
| 815 | <a name="l01167"></a>01167 |
| 816 | <a name="l01170"></a>01170 |
| 817 | <a name="l01172"></a><a class="code" href="classbdm_1_1BM.html#aadb539fa2585c8a2a91c54e5aebf330e">01172</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <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> ( <span class="keyword">const</span> <span class="keywordtype">string</span> &opt ) { |
| 818 | <a name="l01173"></a>01173 <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; |
| 819 | <a name="l01174"></a>01174 <span class="keywordflow">if</span> ( opt.find ( <span class="stringliteral">"logbounds"</span> ) != string::npos ) { |
| 820 | <a name="l01175"></a>01175 <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 ) = 1; |
| 821 | <a name="l01176"></a>01176 <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 ) = 1; |
| 822 | <a name="l01177"></a>01177 } |
| 823 | <a name="l01178"></a>01178 <span class="keywordflow">if</span> ( opt.find ( <span class="stringliteral">"logll"</span> ) != string::npos ) { |
| 824 | <a name="l01179"></a>01179 <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; |
| 825 | <a name="l01180"></a>01180 } |
| 826 | <a name="l01181"></a>01181 } |
| 827 | <a name="l01183"></a><a class="code" href="classbdm_1_1BM.html#a109c1a626a69031658e3a44e9e500cca">01183</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>; |
| 828 | <a name="l01184"></a>01184 |
| 829 | <a name="l01186"></a><a class="code" href="classbdm_1_1BM.html#a398b7e7a162cf37d0022d6126495f207">01186</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>; |
| 830 | <a name="l01188"></a><a class="code" href="classbdm_1_1BM.html#a2298ca6af9b13a78a4c9e18ab43f1827">01188</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> ) { |
| 831 | <a name="l01189"></a>01189 <span class="comment">// internal</span> |
| 832 | <a name="l01190"></a>01190 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> r; |
| 833 | <a name="l01191"></a>01191 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#abb7b0065d6cb722a66b371a8260121e1" title="return posterior density">posterior</a>().isnamed() ) { |
| 834 | <a name="l01192"></a>01192 r = <a class="code" href="classbdm_1_1BM.html#abb7b0065d6cb722a66b371a8260121e1" title="return posterior density">posterior</a>().<a class="code" href="classbdm_1_1epdf.html#aa4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>(); |
| 835 | <a name="l01193"></a>01193 } <span class="keywordflow">else</span> { |
| 836 | <a name="l01194"></a>01194 r = <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ( <span class="stringliteral">"est"</span>, <a class="code" href="classbdm_1_1BM.html#abb7b0065d6cb722a66b371a8260121e1" title="return posterior density">posterior</a>().dimension() ); |
| 837 | <a name="l01195"></a>01195 }; |
| 838 | <a name="l01196"></a>01196 |
| 839 | <a name="l01197"></a>01197 <span class="comment">// Add mean value</span> |
| 840 | <a name="l01198"></a>01198 <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">add</a> ( r, name + <span class="stringliteral">"mean_"</span> ); |
| 841 | <a name="l01199"></a>01199 <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">add</a> ( r, name + <span class="stringliteral">"lb_"</span> ); |
| 842 | <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> ( 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">add</a> ( r, name + <span class="stringliteral">"ub_"</span> ); |
| 843 | <a name="l01201"></a>01201 <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">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> |
| 844 | <a name="l01202"></a>01202 } |
| 845 | <a name="l01204"></a><a class="code" href="classbdm_1_1BM.html#ab517e1679eaa94e803ea4cd0b8efbcd7">01204</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1BM.html#ab517e1679eaa94e803ea4cd0b8efbcd7" title="Save results to the given logger, details of what is stored is configured by LIDs...">logit</a> ( <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> &L ) { |
| 846 | <a name="l01205"></a>01205 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 ), <a class="code" href="classbdm_1_1BM.html#abb7b0065d6cb722a66b371a8260121e1" title="return posterior density">posterior</a>().mean() ); |
| 847 | <a name="l01206"></a>01206 <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> |
| 848 | <a name="l01207"></a>01207 vec ub, lb; |
| 849 | <a name="l01208"></a>01208 <a class="code" href="classbdm_1_1BM.html#abb7b0065d6cb722a66b371a8260121e1" title="return posterior density">posterior</a>().<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 ); |
| 850 | <a name="l01209"></a>01209 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 ); |
| 851 | <a name="l01210"></a>01210 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 ); |
| 852 | <a name="l01211"></a>01211 } |
| 853 | <a name="l01212"></a>01212 <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> ); |
| 854 | <a name="l01213"></a>01213 } |
| 855 | <a name="l01215"></a><a class="code" href="classbdm_1_1BM.html#a23c6a8f71f922023ab08dcb0487a86de">01215</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> ) { |
| 856 | <a name="l01216"></a>01216 <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 ); |
| 857 | <a name="l01217"></a>01217 <span class="keywordflow">if</span> ( r ) { |
| 858 | <a name="l01218"></a>01218 <a class="code" href="classbdm_1_1BM.html#af135ae6dce7e9f30c9f88229c7930b96" title="access function">set_drv</a> ( *r ); |
| 859 | <a name="l01219"></a>01219 } |
| 860 | <a name="l01220"></a>01220 <span class="keywordtype">string</span> opt; |
| 861 | <a name="l01221"></a>01221 <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 ) ) { |
| 862 | <a name="l01222"></a>01222 <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 ); |
| 863 | <a name="l01223"></a>01223 } |
| 864 | <a name="l01224"></a>01224 } |
| 865 | <a name="l01225"></a>01225 |
| 866 | <a name="l01226"></a>01226 }; |
| 867 | <a name="l01228"></a>01228 <span class="keyword">typedef</span> Array<shared_ptr<epdf> > epdf_array; |
| 868 | <a name="l01230"></a>01230 <span class="keyword">typedef</span> Array<shared_ptr<mpdf> > mpdf_array; |
| 869 | <a name="l01231"></a>01231 |
| 870 | <a name="l01232"></a>01232 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 871 | <a name="l01233"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ad8e547695d1cc19219b91164d825c930">01233</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 ) { |
| 872 | <a name="l01234"></a>01234 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">condition</a> ( cond ); |
| 873 | <a name="l01235"></a>01235 vec temp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.sample(); |
| 874 | <a name="l01236"></a>01236 <span class="keywordflow">return</span> temp; |
| 875 | <a name="l01237"></a>01237 } |
| 876 | <a name="l01238"></a>01238 |
| 877 | <a name="l01239"></a>01239 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 878 | <a name="l01240"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a9554c554054da2d22cb8e908ae9c8823">01240</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 ) { |
| 879 | <a name="l01241"></a>01241 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">condition</a> ( cond ); |
| 880 | <a name="l01242"></a>01242 mat temp ( dimension(), N ); |
| 881 | <a name="l01243"></a>01243 vec smp ( dimension() ); |
| 882 | <a name="l01244"></a>01244 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i < N; i++ ) { |
| 883 | <a name="l01245"></a>01245 smp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.sample(); |
| 884 | <a name="l01246"></a>01246 temp.set_col ( i, smp ); |
| 885 | <a name="l01247"></a>01247 } |
| 886 | <a name="l01248"></a>01248 |
| 887 | <a name="l01249"></a>01249 <span class="keywordflow">return</span> temp; |
| 888 | <a name="l01250"></a>01250 } |
| 889 | <a name="l01251"></a>01251 |
| 890 | <a name="l01252"></a>01252 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 891 | <a name="l01253"></a><a class="code" href="classbdm_1_1mpdf__internal.html#a89076e62b8d7df7616bad68c94591948">01253</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 ) { |
| 892 | <a name="l01254"></a>01254 <span class="keywordtype">double</span> tmp; |
| 893 | <a name="l01255"></a>01255 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">condition</a> ( cond ); |
| 894 | <a name="l01256"></a>01256 tmp = <a class="code" href="classbdm_1_1mpdf__internal.html#a47bab632af15120c88aad647ae129468" title="Internal epdf used for sampling.">iepdf</a>.evallog ( dt ); |
| 895 | <a name="l01257"></a>01257 <span class="keywordflow">return</span> tmp; |
| 896 | <a name="l01258"></a>01258 } |
| 897 | <a name="l01259"></a>01259 |
| 898 | <a name="l01260"></a>01260 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 899 | <a name="l01261"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae28c214e3063733a6e4d17738941c61c">01261</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 ) { |
| 900 | <a name="l01262"></a>01262 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">condition</a> ( cond ); |
| 901 | <a name="l01263"></a>01263 <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 ); |
| 902 | <a name="l01264"></a>01264 } |
| 903 | <a name="l01265"></a>01265 |
| 904 | <a name="l01266"></a>01266 <span class="keyword">template</span><<span class="keyword">class</span> EPDF> |
| 905 | <a name="l01267"></a><a class="code" href="classbdm_1_1mpdf__internal.html#ae82db07ce8af02f29cfd81e014edb3db">01267</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 ) { |
| 906 | <a name="l01268"></a>01268 <a class="code" href="classbdm_1_1mpdf__internal.html#a1ac61da081667fc54bcd050cc4f6a93e">condition</a> ( cond ); |
| 907 | <a name="l01269"></a>01269 <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 ); |
| 908 | <a name="l01270"></a>01270 } |
| 909 | <a name="l01271"></a>01271 |
| 910 | <a name="l01272"></a>01272 }; <span class="comment">//namespace</span> |
| 911 | <a name="l01273"></a>01273 <span class="preprocessor">#endif // BDMBASE_H</span> |