Changeset 353 for doc/html/merger_8h-source.html
- Timestamp:
- 06/02/09 10:08:06 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
doc/html/merger_8h-source.html
r323 r353 78 78 <a name="l00031"></a>00031 <span class="keyword">protected</span>: 79 79 <a name="l00033"></a><a class="code" href="classbdm_1_1merger.html#67ae71cbf0686d7c7bf116fa5db86d81">00033</a> <a class="code" href="classbdm_1_1MixEF.html" title="Mixture of Exponential Family Densities.">MixEF</a> <a class="code" href="classbdm_1_1merger.html#67ae71cbf0686d7c7bf116fa5db86d81" title="Internal mixture of EF models.">Mix</a>; 80 <a name="l00035"></a><a class="code" href="classbdm_1_1merger.html#ea3c9f4739f857877fd5285b3973289c">00035</a> Array<datalink_m2e*><a class="code" href="classbdm_1_1merger.html#ea3c9f4739f857877fd5285b3973289c" title="Data link for each mpdf in mpdfs.">dls</a>;81 <a name="l00037"></a><a class="code" href="classbdm_1_1merger.html#135b938f841cb88ad00a8bbded818703">00037</a> Array<RV><a class="code" href="classbdm_1_1merger.html#135b938f841cb88ad00a8bbded818703" title="Array of rvs that are not modelled by mpdfs at all (aux).">rvzs</a>;82 <a name="l00039"></a><a class="code" href="classbdm_1_1merger.html#6c48bf36ec1f3f7b52e3159cf428a193">00039</a> Array<datalink_m2e*><a class="code" href="classbdm_1_1merger.html#6c48bf36ec1f3f7b52e3159cf428a193" title="Data Links of rv0 mpdfs - these will be conditioned the (rv,rvc) of mpdfs.">zdls</a>;80 <a name="l00035"></a><a class="code" href="classbdm_1_1merger.html#ea3c9f4739f857877fd5285b3973289c">00035</a> <a class="code" href="classitpp_1_1Array.html">Array<datalink_m2e*></a> <a class="code" href="classbdm_1_1merger.html#ea3c9f4739f857877fd5285b3973289c" title="Data link for each mpdf in mpdfs.">dls</a>; 81 <a name="l00037"></a><a class="code" href="classbdm_1_1merger.html#135b938f841cb88ad00a8bbded818703">00037</a> <a class="code" href="classitpp_1_1Array.html">Array<RV></a> <a class="code" href="classbdm_1_1merger.html#135b938f841cb88ad00a8bbded818703" title="Array of rvs that are not modelled by mpdfs at all (aux).">rvzs</a>; 82 <a name="l00039"></a><a class="code" href="classbdm_1_1merger.html#6c48bf36ec1f3f7b52e3159cf428a193">00039</a> <a class="code" href="classitpp_1_1Array.html">Array<datalink_m2e*></a> <a class="code" href="classbdm_1_1merger.html#6c48bf36ec1f3f7b52e3159cf428a193" title="Data Links of rv0 mpdfs - these will be conditioned the (rv,rvc) of mpdfs.">zdls</a>; 83 83 <a name="l00040"></a>00040 84 84 <a name="l00042"></a><a class="code" href="classbdm_1_1merger.html#e91b83e6d9076848c71ae27664072109">00042</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1merger.html#e91b83e6d9076848c71ae27664072109" title="Number of samples used in approximation.">Ns</a>; … … 89 89 <a name="l00051"></a>00051 90 90 <a name="l00053"></a><a class="code" href="classbdm_1_1merger.html#14081d8c5cffdcc6c2f81cb61da41dbe">00053</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1merger.html#14081d8c5cffdcc6c2f81cb61da41dbe" title="debug or not debug">DBG</a>; 91 <a name="l00055"></a><a class="code" href="classbdm_1_1merger.html#2b99a4a9384dc088dc164372d206138f">00055</a> it_file* <a class="code" href="classbdm_1_1merger.html#2b99a4a9384dc088dc164372d206138f" title="debugging file">dbg</a>;91 <a name="l00055"></a><a class="code" href="classbdm_1_1merger.html#2b99a4a9384dc088dc164372d206138f">00055</a> <a class="code" href="classitpp_1_1it__file.html" title="The IT++ file format reading and writing class.">it_file</a>* <a class="code" href="classbdm_1_1merger.html#2b99a4a9384dc088dc164372d206138f" title="debugging file">dbg</a>; 92 92 <a name="l00057"></a><a class="code" href="classbdm_1_1merger.html#05dc6d9876677fcf84806d39f24e5509">00057</a> <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1merger.html#05dc6d9876677fcf84806d39f24e5509" title="Flag if the samples are fixed or not.">fix_smp</a>; 93 93 <a name="l00058"></a>00058 <span class="keyword">public</span>: 94 <a name="l00060"></a><a class="code" href="classbdm_1_1merger.html#30ae0fa8a88737185f598bf63fec0569">00060</a> <a class="code" href="classbdm_1_1merger.html#30ae0fa8a88737185f598bf63fec0569" title="Default constructor.">merger</a> ( <span class="keyword">const</span> Array<mpdf*>&S ) :94 <a name="l00060"></a><a class="code" href="classbdm_1_1merger.html#30ae0fa8a88737185f598bf63fec0569">00060</a> <a class="code" href="classbdm_1_1merger.html#30ae0fa8a88737185f598bf63fec0569" title="Default constructor.">merger</a> ( <span class="keyword">const</span> <a class="code" href="classitpp_1_1Array.html">Array<mpdf*></a> &S ) : 95 95 <a name="l00061"></a>00061 <a class="code" href="classbdm_1_1compositepdf.html" title="Abstract composition of pdfs, will be used for specific classes this abstract class...">compositepdf</a> ( S ), <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( ), 96 <a name="l00062"></a>00062 <a class="code" href="classbdm_1_1merger.html#67ae71cbf0686d7c7bf116fa5db86d81" title="Internal mixture of EF models.">Mix</a> ( Array<<a class="code" href="classbdm_1_1BMEF.html" title="Estimator for Exponential family.">BMEF</a>*> ( 0 ),vec ( 0 ) ), <a class="code" href="classbdm_1_1merger.html#ea3c9f4739f857877fd5285b3973289c" title="Data link for each mpdf in mpdfs.">dls</a> ( <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ), <a class="code" href="classbdm_1_1merger.html#135b938f841cb88ad00a8bbded818703" title="Array of rvs that are not modelled by mpdfs at all (aux).">rvzs</a> ( <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ), <a class="code" href="classbdm_1_1merger.html#6c48bf36ec1f3f7b52e3159cf428a193" title="Data Links of rv0 mpdfs - these will be conditioned the (rv,rvc) of mpdfs.">zdls</a> ( <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ), <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>()96 <a name="l00062"></a>00062 <a class="code" href="classbdm_1_1merger.html#67ae71cbf0686d7c7bf116fa5db86d81" title="Internal mixture of EF models.">Mix</a> ( <a class="code" href="classitpp_1_1Array.html" title="General array class.">Array</a><<a class="code" href="classbdm_1_1BMEF.html" title="Estimator for Exponential family.">BMEF</a>*> ( 0 ),vec ( 0 ) ), <a class="code" href="classbdm_1_1merger.html#ea3c9f4739f857877fd5285b3973289c" title="Data link for each mpdf in mpdfs.">dls</a> ( <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ), <a class="code" href="classbdm_1_1merger.html#135b938f841cb88ad00a8bbded818703" title="Array of rvs that are not modelled by mpdfs at all (aux).">rvzs</a> ( <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ), <a class="code" href="classbdm_1_1merger.html#6c48bf36ec1f3f7b52e3159cf428a193" title="Data Links of rv0 mpdfs - these will be conditioned the (rv,rvc) of mpdfs.">zdls</a> ( <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ), <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>() 97 97 <a name="l00063"></a>00063 { 98 98 <a name="l00064"></a>00064 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> ztmp; … … 121 121 <a name="l00087"></a>00087 <a class="code" href="classbdm_1_1merger.html#05dc6d9876677fcf84806d39f24e5509" title="Flag if the samples are fixed or not.">fix_smp</a> = <span class="keyword">false</span>; 122 122 <a name="l00088"></a>00088 } 123 <a name="l00090"></a><a class="code" href="classbdm_1_1merger.html#94b5358c9558a8389ac78a65b83244f6">00090</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1merger.html#94b5358c9558a8389ac78a65b83244f6" title="set debug file">debug_file</a> ( <span class="keyword">const</span> <span class="keywordtype">string</span> fname ) { <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1merger.html#14081d8c5cffdcc6c2f81cb61da41dbe" title="debug or not debug">DBG</a> ) <span class="keyword">delete</span> <a class="code" href="classbdm_1_1merger.html#2b99a4a9384dc088dc164372d206138f" title="debugging file">dbg</a>; <a class="code" href="classbdm_1_1merger.html#2b99a4a9384dc088dc164372d206138f" title="debugging file">dbg</a> = <span class="keyword">new</span> it_file( fname ); <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1merger.html#2b99a4a9384dc088dc164372d206138f" title="debugging file">dbg</a> ) <a class="code" href="classbdm_1_1merger.html#14081d8c5cffdcc6c2f81cb61da41dbe" title="debug or not debug">DBG</a>=<span class="keyword">true</span>;}123 <a name="l00090"></a><a class="code" href="classbdm_1_1merger.html#94b5358c9558a8389ac78a65b83244f6">00090</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1merger.html#94b5358c9558a8389ac78a65b83244f6" title="set debug file">debug_file</a> ( <span class="keyword">const</span> <span class="keywordtype">string</span> fname ) { <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1merger.html#14081d8c5cffdcc6c2f81cb61da41dbe" title="debug or not debug">DBG</a> ) <span class="keyword">delete</span> <a class="code" href="classbdm_1_1merger.html#2b99a4a9384dc088dc164372d206138f" title="debugging file">dbg</a>; <a class="code" href="classbdm_1_1merger.html#2b99a4a9384dc088dc164372d206138f" title="debugging file">dbg</a> = <span class="keyword">new</span> <a class="code" href="classitpp_1_1it__file.html" title="The IT++ file format reading and writing class.">it_file</a> ( fname ); <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1merger.html#2b99a4a9384dc088dc164372d206138f" title="debugging file">dbg</a> ) <a class="code" href="classbdm_1_1merger.html#14081d8c5cffdcc6c2f81cb61da41dbe" title="debug or not debug">DBG</a>=<span class="keyword">true</span>;} 124 124 <a name="l00092"></a><a class="code" href="classbdm_1_1merger.html#22216ad175880cf2345871f9313a3f19">00092</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1merger.html#22216ad175880cf2345871f9313a3f19" title="Set internal parameters used in approximation.">set_parameters</a> ( <span class="keywordtype">double</span> beta0, <span class="keywordtype">int</span> Ns0, <span class="keywordtype">int</span> Nc0, <span class="keywordtype">double</span> effss_coef0=0.5 ) {<a class="code" href="classbdm_1_1merger.html#1a85d299f202a70afe0cdc1045c26a5d" title="Prior on the log-normal merging model.">beta</a>=beta0; 125 125 <a name="l00093"></a>00093 <a class="code" href="classbdm_1_1merger.html#e91b83e6d9076848c71ae27664072109" title="Number of samples used in approximation.">Ns</a>=Ns0; … … 128 128 <a name="l00096"></a>00096 <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>.<a class="code" href="classbdm_1_1eEmp.html#c74c281d652356c19b6b079e42ca7ef1" title="Set sample.">set_parameters</a> ( Ns0,<span class="keyword">false</span> ); 129 129 <a name="l00097"></a>00097 } 130 <a name="l00098"></a>00098 <span class="keywordtype">void</span> set_grid ( Array<vec>&XYZ )130 <a name="l00098"></a>00098 <span class="keywordtype">void</span> set_grid ( <a class="code" href="classitpp_1_1Array.html">Array<vec></a> &XYZ ) 131 131 <a name="l00099"></a>00099 { 132 <a name="l00100"></a>00100 <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>=XYZ. length(); ivec szs ( dim );133 <a name="l00101"></a>00101 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i<dim;i++){szs=XYZ(i). length();}134 <a name="l00102"></a>00102 <a class="code" href="classbdm_1_1merger.html#e91b83e6d9076848c71ae27664072109" title="Number of samples used in approximation.">Ns</a>= prod(szs);132 <a name="l00100"></a>00100 <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>=XYZ.<a class="code" href="classitpp_1_1Array.html#53629018f146084de506c33c69fa19a3" title="Returns the number of data elements in the array object.">length</a>(); ivec szs ( dim ); 133 <a name="l00101"></a>00101 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i<dim;i++){szs=XYZ(i).<a class="code" href="classitpp_1_1Array.html#53629018f146084de506c33c69fa19a3" title="Returns the number of data elements in the array object.">length</a>();} 134 <a name="l00102"></a>00102 <a class="code" href="classbdm_1_1merger.html#e91b83e6d9076848c71ae27664072109" title="Number of samples used in approximation.">Ns</a>=<a class="code" href="group__matrix__functions.html#g22fdeace9f20483008cf4dc6d471cbc2" title="Product of elements in the matrix m.">prod</a>(szs); 135 135 <a name="l00103"></a>00103 <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>.set_parameters(<a class="code" href="classbdm_1_1merger.html#e91b83e6d9076848c71ae27664072109" title="Number of samples used in approximation.">Ns</a>,<span class="keyword">false</span>); 136 <a name="l00104"></a>00104 Array<vec>&samples=<a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>._samples();137 <a name="l00105"></a>00105 <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>._w()= ones(<a class="code" href="classbdm_1_1merger.html#e91b83e6d9076848c71ae27664072109" title="Number of samples used in approximation.">Ns</a>)/<a class="code" href="classbdm_1_1merger.html#e91b83e6d9076848c71ae27664072109" title="Number of samples used in approximation.">Ns</a>;136 <a name="l00104"></a>00104 <a class="code" href="classitpp_1_1Array.html">Array<vec></a> &samples=<a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>._samples(); 137 <a name="l00105"></a>00105 <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>._w()=<a class="code" href="group__specmat.html#gdc0f3edbf58bced9e82d8b260d395cac" title="A float (rows,cols)-matrix of ones.">ones</a>(<a class="code" href="classbdm_1_1merger.html#e91b83e6d9076848c71ae27664072109" title="Number of samples used in approximation.">Ns</a>)/<a class="code" href="classbdm_1_1merger.html#e91b83e6d9076848c71ae27664072109" title="Number of samples used in approximation.">Ns</a>; 138 138 <a name="l00106"></a>00106 139 139 <a name="l00107"></a>00107 <span class="comment">//set samples</span> 140 <a name="l00108"></a>00108 ivec is= zeros_i(dim);<span class="comment">//indeces of dimensions in for cycle;</span>140 <a name="l00108"></a>00108 ivec is=<a class="code" href="group__specmat.html#g9df9aa3553b6a5c07924954b85466cec" title="A Int (rows,cols)-matrix of zeros.">zeros_i</a>(dim);<span class="comment">//indeces of dimensions in for cycle;</span> 141 141 <a name="l00109"></a>00109 vec smpi(dim); 142 142 <a name="l00110"></a>00110 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i<<a class="code" href="classbdm_1_1merger.html#e91b83e6d9076848c71ae27664072109" title="Number of samples used in approximation.">Ns</a>; i++){ … … 159 159 <a name="l00128"></a><a class="code" href="classbdm_1_1merger.html#8ae79a651e93d6e2d611556001af8aa8">00128</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1merger.html#8ae79a651e93d6e2d611556001af8aa8" title="Initialize the proposal density. This function must be called before merge()!">init</a>() 160 160 <a name="l00129"></a>00129 { 161 <a name="l00130"></a>00130 Array<vec>Smps ( <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> );161 <a name="l00130"></a>00130 <a class="code" href="classitpp_1_1Array.html">Array<vec></a> Smps ( <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ); 162 162 <a name="l00131"></a>00131 <span class="comment">//Gibbs sampling</span> 163 <a name="l00132"></a>00132 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<<a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a>;i++ ) {Smps ( i ) = zeros( 0 );}163 <a name="l00132"></a>00132 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i<<a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a>;i++ ) {Smps ( i ) =<a class="code" href="group__specmat.html#g10723ecada06221cbe64fe2736a59de1" title="A Double (rows,cols)-matrix of zeros.">zeros</a> ( 0 );} 164 164 <a name="l00133"></a>00133 } 165 165 <a name="l00135"></a>00135 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1merger.html#b72f4662c9ac760a8b17ebe5d697f3c2" title="Create a mixture density, make sure to call init() before the first call.">merge</a> ( <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>* g0 ); … … 170 170 <a name="l00144"></a><a class="code" href="classbdm_1_1merger.html#c47543661897638cab9f506c76a1f92f">00144</a> <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1merger.html#c47543661897638cab9f506c76a1f92f" title="Compute log-probability of argument val.">evallog</a> ( <span class="keyword">const</span> vec &dt )<span class="keyword"> const</span> 171 171 <a name="l00145"></a>00145 <span class="keyword"> </span>{ 172 <a name="l00146"></a>00146 vec dtf= ones( dt.length() +1 );172 <a name="l00146"></a>00146 vec dtf=<a class="code" href="group__specmat.html#gdc0f3edbf58bced9e82d8b260d395cac" title="A float (rows,cols)-matrix of ones.">ones</a> ( dt.length() +1 ); 173 173 <a name="l00147"></a>00147 dtf.set_subvector ( 0,dt ); 174 174 <a name="l00148"></a>00148 <span class="keywordflow">return</span> <a class="code" href="classbdm_1_1merger.html#67ae71cbf0686d7c7bf116fa5db86d81" title="Internal mixture of EF models.">Mix</a>.<a class="code" href="classbdm_1_1MixEF.html#da724da464a75e07521941e430929efa">logpred</a> ( dtf ); … … 176 176 <a name="l00150"></a><a class="code" href="classbdm_1_1merger.html#82c5ad7677315fde8e9fc9381c17ece5">00150</a> vec <a class="code" href="classbdm_1_1merger.html#82c5ad7677315fde8e9fc9381c17ece5" title="return expected value">mean</a>()<span class="keyword"> const</span> 177 177 <a name="l00151"></a>00151 <span class="keyword"> </span>{ 178 <a name="l00152"></a>00152 <span class="keyword">const</span> Vec<double>&w = <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>.<a class="code" href="classbdm_1_1eEmp.html#d7f83cc0415cd44ae7cc8b4bdad93aef" title="Potentially dangerous, use with care.">_w</a>();179 <a name="l00153"></a>00153 <span class="keyword">const</span> Array<vec>&S = <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>.<a class="code" href="classbdm_1_1eEmp.html#c24966b0aaeb767bc8a6b4fd60931be2" title="access function">_samples</a>();180 <a name="l00154"></a>00154 vec tmp= zeros( dim );178 <a name="l00152"></a>00152 <span class="keyword">const</span> <a class="code" href="classitpp_1_1Vec.html">Vec<double></a> &w = <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>.<a class="code" href="classbdm_1_1eEmp.html#d7f83cc0415cd44ae7cc8b4bdad93aef" title="Potentially dangerous, use with care.">_w</a>(); 179 <a name="l00153"></a>00153 <span class="keyword">const</span> <a class="code" href="classitpp_1_1Array.html">Array<vec></a> &S = <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>.<a class="code" href="classbdm_1_1eEmp.html#c24966b0aaeb767bc8a6b4fd60931be2" title="access function">_samples</a>(); 180 <a name="l00154"></a>00154 vec tmp=<a class="code" href="group__specmat.html#g10723ecada06221cbe64fe2736a59de1" title="A Double (rows,cols)-matrix of zeros.">zeros</a> ( dim ); 181 181 <a name="l00155"></a>00155 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i<Ns; i++ ) 182 182 <a name="l00156"></a>00156 { … … 188 188 <a name="l00162"></a>00162 <span class="keyword"> </span>{ 189 189 <a name="l00163"></a>00163 <span class="keyword">const</span> vec &w = <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>.<a class="code" href="classbdm_1_1eEmp.html#d7f83cc0415cd44ae7cc8b4bdad93aef" title="Potentially dangerous, use with care.">_w</a>(); 190 <a name="l00164"></a>00164 <span class="keyword">const</span> Array<vec>&S = <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>.<a class="code" href="classbdm_1_1eEmp.html#c24966b0aaeb767bc8a6b4fd60931be2" title="access function">_samples</a>();190 <a name="l00164"></a>00164 <span class="keyword">const</span> <a class="code" href="classitpp_1_1Array.html">Array<vec></a> &S = <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>.<a class="code" href="classbdm_1_1eEmp.html#c24966b0aaeb767bc8a6b4fd60931be2" title="access function">_samples</a>(); 191 191 <a name="l00165"></a>00165 192 192 <a name="l00166"></a>00166 vec mea = <a class="code" href="classbdm_1_1merger.html#82c5ad7677315fde8e9fc9381c17ece5" title="return expected value">mean</a>(); 193 193 <a name="l00167"></a>00167 194 <a name="l00168"></a>00168 cout << sum( w ) << <span class="stringliteral">","</span> << w*w <<endl;194 <a name="l00168"></a>00168 cout << <a class="code" href="group__matrix__functions.html#gfcf8f54c2f4fc257bbc3111700b08355" title="Sum of elements in the matrix m, either along columns or rows.">sum</a> ( w ) << <span class="stringliteral">","</span> << w*w <<endl; 195 195 <a name="l00169"></a>00169 196 <a name="l00170"></a>00170 mat Tmp= zeros( dim, dim );196 <a name="l00170"></a>00170 mat Tmp=<a class="code" href="group__specmat.html#g10723ecada06221cbe64fe2736a59de1" title="A Double (rows,cols)-matrix of zeros.">zeros</a> ( dim, dim ); 197 197 <a name="l00171"></a>00171 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i<Ns; i++ ) 198 198 <a name="l00172"></a>00172 { … … 204 204 <a name="l00178"></a>00178 <span class="keyword"> </span>{ 205 205 <a name="l00179"></a>00179 <span class="keyword">const</span> vec &w = <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>.<a class="code" href="classbdm_1_1eEmp.html#d7f83cc0415cd44ae7cc8b4bdad93aef" title="Potentially dangerous, use with care.">_w</a>(); 206 <a name="l00180"></a>00180 <span class="keyword">const</span> Array<vec>&S = <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>.<a class="code" href="classbdm_1_1eEmp.html#c24966b0aaeb767bc8a6b4fd60931be2" title="access function">_samples</a>();206 <a name="l00180"></a>00180 <span class="keyword">const</span> <a class="code" href="classitpp_1_1Array.html">Array<vec></a> &S = <a class="code" href="classbdm_1_1merger.html#522d43f7aa13fe6701e93fba174dec94" title="Projection to empirical density.">eSmp</a>.<a class="code" href="classbdm_1_1eEmp.html#c24966b0aaeb767bc8a6b4fd60931be2" title="access function">_samples</a>(); 207 207 <a name="l00181"></a>00181 208 <a name="l00182"></a>00182 vec tmp= zeros( dim );208 <a name="l00182"></a>00182 vec tmp=<a class="code" href="group__specmat.html#g10723ecada06221cbe64fe2736a59de1" title="A Double (rows,cols)-matrix of zeros.">zeros</a> ( dim ); 209 209 <a name="l00183"></a>00183 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i<Ns; i++ ) 210 210 <a name="l00184"></a>00184 { 211 <a name="l00185"></a>00185 tmp+=w ( i ) * pow( S ( i ),2 );211 <a name="l00185"></a>00185 tmp+=w ( i ) *<a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">pow</a> ( S ( i ),2 ); 212 212 <a name="l00186"></a>00186 } 213 <a name="l00187"></a>00187 <span class="keywordflow">return</span> tmp- pow( <a class="code" href="classbdm_1_1merger.html#82c5ad7677315fde8e9fc9381c17ece5" title="return expected value">mean</a>(),2 );213 <a name="l00187"></a>00187 <span class="keywordflow">return</span> tmp-<a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">pow</a> ( <a class="code" href="classbdm_1_1merger.html#82c5ad7677315fde8e9fc9381c17ece5" title="return expected value">mean</a>(),2 ); 214 214 <a name="l00188"></a>00188 } 215 215 <a name="l00190"></a><a class="code" href="classbdm_1_1merger.html#febef179bb5e074ae6e34d15b4596273">00190</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1merger.html#febef179bb5e074ae6e34d15b4596273" title="for future use">~merger</a>() … … 232 232 <a name="l00210"></a>00210 <span class="preprocessor">#endif // MER_H</span> 233 233 </pre></div></div> 234 <hr size="1"><address style="text-align: right;"><small>Generated on T hu Apr 23 21:06:42 2009 for mixpp by 234 <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:12 2009 for mixpp by 235 235 <a href="http://www.doxygen.org/index.html"> 236 236 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>