<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.5.6">
  <compounddef id="libPF_8h" kind="file">
    <compoundname>libPF.h</compoundname>
    <includes local="no">itpp/itbase.h</includes>
    <includes refid="libEF_8h" local="yes">../stat/libEF.h</includes>
    <includes refid="libDC_8h" local="yes">../math/libDC.h</includes>
    <includedby refid="libPF_8cpp" local="yes">work/git/mixpp/bdm/estim/libPF.cpp</includedby>
    <includedby refid="pmsm__mix_8cpp" local="no">work/git/mixpp/pmsm/pmsm_mix.cpp</includedby>
    <includedby refid="pmsm__sim_8cpp" local="no">work/git/mixpp/pmsm/pmsm_sim.cpp</includedby>
    <includedby refid="pmsm__sim2_8cpp" local="no">work/git/mixpp/pmsm/pmsm_sim2.cpp</includedby>
    <includedby refid="pmsm__sim3_8cpp" local="no">work/git/mixpp/pmsm/pmsm_sim3.cpp</includedby>
    <includedby refid="pmsm__unkQ_8cpp" local="no">work/git/mixpp/pmsm/pmsm_unkQ.cpp</includedby>
    <includedby refid="pmsm__unkQpf_8cpp" local="no">work/git/mixpp/pmsm/pmsm_unkQpf.cpp</includedby>
    <includedby refid="testKF__QR_8cpp" local="no">work/git/mixpp/tests/testKF_QR.cpp</includedby>
    <includedby refid="testKF__QRexh_8cpp" local="no">work/git/mixpp/tests/testKF_QRexh.cpp</includedby>
    <includedby refid="testPF_8cpp" local="no">work/git/mixpp/tests/testPF.cpp</includedby>
    <includedby refid="testResample_8cpp" local="no">work/git/mixpp/tests/testResample.cpp</includedby>
    <incdepgraph>
      <node id="259">
        <label>libBM.h</label>
        <link refid="libBM_8h"/>
        <childnode refid="256" relation="include">
        </childnode>
      </node>
      <node id="260">
        <label>../itpp_ext.h</label>
        <link refid="itpp__ext_8h-source"/>
        <childnode refid="256" relation="include">
        </childnode>
      </node>
      <node id="257">
        <label>../stat/libEF.h</label>
        <link refid="libEF_8h"/>
        <childnode refid="256" relation="include">
        </childnode>
        <childnode refid="258" relation="include">
        </childnode>
        <childnode refid="259" relation="include">
        </childnode>
        <childnode refid="260" relation="include">
        </childnode>
      </node>
      <node id="255">
        <label>work/git/mixpp/bdm/estim/libPF.h</label>
        <link refid="libPF.h"/>
        <childnode refid="256" relation="include">
        </childnode>
        <childnode refid="257" relation="include">
        </childnode>
        <childnode refid="258" relation="include">
        </childnode>
      </node>
      <node id="256">
        <label>itpp/itbase.h</label>
      </node>
      <node id="258">
        <label>../math/libDC.h</label>
        <link refid="libDC_8h"/>
        <childnode refid="256" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <invincdepgraph>
      <node id="261">
        <label>work/git/mixpp/bdm/estim/libPF.h</label>
        <link refid="libPF.h"/>
        <childnode refid="262" relation="include">
        </childnode>
      </node>
      <node id="262">
        <label>work/git/mixpp/pmsm/pmsm_mix.cpp</label>
        <link refid="pmsm__mix_8cpp"/>
      </node>
    </invincdepgraph>
    <innerclass refid="classPF" prot="public">PF</innerclass>
    <innerclass refid="classMPF" prot="public">MPF</innerclass>
    <innerclass refid="classMPF_1_1mpfepdf" prot="private">MPF::mpfepdf</innerclass>
      <sectiondef kind="var">
      <memberdef kind="variable" id="libPF_8h_1718eb6f36f33fd5898956fb950d0d8f2" prot="public" static="no" mutable="no">
        <type>double</type>
        <definition>double PF_SSAT</definition>
        <argsstring></argsstring>
        <name>PF_SSAT</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/smidl/work/git/mixpp/bdm/estim/libPF.h" line="23"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
<para>Bayesian Filtering using stochastic sampling (Particle Filters). </para>    </briefdescription>
    <detaileddescription>
<para><simplesect kind="author"><para>Vaclav Smidl.</para></simplesect>
----------------------------------- BDM++ - C++ library for Bayesian Decision Making under Uncertainty</para><para>Using IT++ for numerical operations ----------------------------------- </para>    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="13"><highlight class="preprocessor">#ifndef<sp/>PF_H</highlight></codeline>
<codeline lineno="14"><highlight class="preprocessor"></highlight><highlight class="preprocessor">#define<sp/>PF_H</highlight></codeline>
<codeline lineno="15"><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="16"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;itpp/itbase.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="17"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;../stat/libEF.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="18"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;../math/libDC.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="19"><highlight class="normal"></highlight></codeline>
<codeline lineno="20"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline>
<codeline lineno="21"><highlight class="normal"></highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight><highlight class="comment">//UGLY<sp/>HACK</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="normal"></highlight><highlight class="keyword">extern</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>PF_SSAT;</highlight><highlight class="comment">//used<sp/>for<sp/>StrSim:06<sp/>test...<sp/>if<sp/>length&gt;0<sp/>the<sp/>value<sp/>is<sp/>written.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="24"><highlight class="normal"></highlight></codeline>
<codeline lineno="31" refid="classPF" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classPF" kindref="compound" tooltip="Trivial particle filter with proposal density equal to parameter evolution model...">PF</ref><sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classBM" kindref="compound" tooltip="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</ref><sp/>{</highlight></codeline>
<codeline lineno="32"><highlight class="normal"></highlight><highlight class="keyword">protected</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="34" refid="classPF_12c2f44ed7a4eaa42e07bdb58d503f280" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="classPF_12c2f44ed7a4eaa42e07bdb58d503f280" kindref="member" tooltip="number of particles;">n</ref>;</highlight></codeline>
<codeline lineno="36" refid="classPF_11a0a09e309da997f63ae8e30d1e9806b" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classeEmp" kindref="compound" tooltip="Weighted empirical density.">eEmp</ref><sp/><ref refid="classPF_11a0a09e309da997f63ae8e30d1e9806b" kindref="member" tooltip="posterior density">est</ref>;</highlight></codeline>
<codeline lineno="38" refid="classPF_15c87aba508df321ff26536ced64dbb3a" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>&amp;<ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref>;</highlight></codeline>
<codeline lineno="40" refid="classPF_1cf7dad75e31215780a746c30e71ad9c5" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array&lt;vec&gt;<sp/>&amp;<ref refid="classPF_1cf7dad75e31215780a746c30e71ad9c5" kindref="member" tooltip="pointer into eEmp ">_samples</ref>;</highlight></codeline>
<codeline lineno="42" refid="classPF_1d92ac103f88f8c21e197e90af5695a09" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmpdf" kindref="compound" tooltip="Conditional probability density, e.g. modeling some dependencies.">mpdf</ref><sp/>&amp;<ref refid="classPF_1d92ac103f88f8c21e197e90af5695a09" kindref="member" tooltip="Parameter evolution model.">par</ref>;</highlight></codeline>
<codeline lineno="44" refid="classPF_1dd0a687a4515333d6809147335854e77" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmpdf" kindref="compound" tooltip="Conditional probability density, e.g. modeling some dependencies.">mpdf</ref><sp/>&amp;<ref refid="classPF_1dd0a687a4515333d6809147335854e77" kindref="member" tooltip="Observation model.">obs</ref>;</highlight></codeline>
<codeline lineno="45"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="47" refid="classPF_1e99f0d866721405dd281e315ecb690aa" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classPF_1e99f0d866721405dd281e315ecb690aa" kindref="member" tooltip="Default constructor.">PF</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>&amp;rv0,<sp/><ref refid="classmpdf" kindref="compound" tooltip="Conditional probability density, e.g. modeling some dependencies.">mpdf</ref><sp/>&amp;par0,<sp/><sp/><ref refid="classmpdf" kindref="compound" tooltip="Conditional probability density, e.g. modeling some dependencies.">mpdf</ref><sp/>&amp;obs0,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>n0<sp/>)<sp/>:<ref refid="classBM" kindref="compound" tooltip="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</ref><sp/>(<sp/>rv0<sp/>),</highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classPF_12c2f44ed7a4eaa42e07bdb58d503f280" kindref="member" tooltip="number of particles;">n</ref><sp/>(<sp/>n0<sp/>),<ref refid="classPF_11a0a09e309da997f63ae8e30d1e9806b" kindref="member" tooltip="posterior density">est</ref><sp/>(<sp/>rv0,<ref refid="classPF_12c2f44ed7a4eaa42e07bdb58d503f280" kindref="member" tooltip="number of particles;">n</ref><sp/>),<ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref><sp/>(<sp/><ref refid="classPF_11a0a09e309da997f63ae8e30d1e9806b" kindref="member" tooltip="posterior density">est</ref>.<ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref>()<sp/>),<ref refid="classPF_1cf7dad75e31215780a746c30e71ad9c5" kindref="member" tooltip="pointer into eEmp ">_samples</ref><sp/>(<sp/><ref refid="classPF_11a0a09e309da997f63ae8e30d1e9806b" kindref="member" tooltip="posterior density">est</ref>.<ref refid="classPF_1cf7dad75e31215780a746c30e71ad9c5" kindref="member" tooltip="pointer into eEmp ">_samples</ref>()<sp/>),</highlight></codeline>
<codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classPF_1d92ac103f88f8c21e197e90af5695a09" kindref="member" tooltip="Parameter evolution model.">par</ref><sp/>(<sp/>par0<sp/>),<sp/><ref refid="classPF_1dd0a687a4515333d6809147335854e77" kindref="member" tooltip="Observation model.">obs</ref><sp/>(<sp/>obs0<sp/>)<sp/>{};</highlight></codeline>
<codeline lineno="50"><highlight class="normal"></highlight></codeline>
<codeline lineno="52"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classPF_104d38fbcc0348b558212f530d9ec183e" kindref="member" tooltip="Set posterior density by sampling from epdf0.">set_est</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref><sp/>&amp;epdf0<sp/>);</highlight></codeline>
<codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classPF_164f636bbd63bea9efd778214e6b631d3" kindref="member" tooltip="Incremental Bayes rule.">bayes</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&amp;dt<sp/>);</highlight></codeline>
<codeline lineno="54"><highlight class="normal">};</highlight></codeline>
<codeline lineno="55"><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="keyword">template</highlight><highlight class="normal">&lt;</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>BM_T&gt;</highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight></codeline>
<codeline lineno="64" refid="classMPF" refkind="compound"><highlight class="normal"></highlight><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classMPF" kindref="compound" tooltip="Marginalized Particle filter.">MPF</ref><sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classPF" kindref="compound" tooltip="Trivial particle filter with proposal density equal to parameter evolution model...">PF</ref><sp/>{</highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>BM_T*<sp/>Bms[10000];</highlight></codeline>
<codeline lineno="66"><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight><highlight class="keyword">class<sp/></highlight><highlight class="normal">mpfepdf<sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref><sp/><sp/>{</highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">protected</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classeEmp" kindref="compound" tooltip="Weighted empirical density.">eEmp</ref><sp/>&amp;E;</highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>&amp;<ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref>;</highlight></codeline>
<codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array&lt;epdf*&gt;<sp/>Coms;</highlight></codeline>
<codeline lineno="74"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mpfepdf<sp/>(<sp/><ref refid="classeEmp" kindref="compound" tooltip="Weighted empirical density.">eEmp</ref><sp/>&amp;E0,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>&amp;rvc<sp/>)<sp/>:</highlight></codeline>
<codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref>(<sp/>)<sp/>),<sp/>E<sp/>(<sp/>E0<sp/>),<sp/><sp/><ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref><sp/>(<sp/>E._w()<sp/>),</highlight></codeline>
<codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Coms<sp/>(<sp/><ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref>.length()<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classBM_1af00f0612fabe66241dd507188cdbf88" kindref="member" tooltip="Random variable of the posterior.">rv</ref>.<ref refid="classRV_1935790526b630dec4ffefa9ec0c2b6fb" kindref="member" tooltip="Add (concat) another variable to the current one,.">add</ref><sp/>(<sp/>E._rv()<sp/>);</highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classBM_1af00f0612fabe66241dd507188cdbf88" kindref="member" tooltip="Random variable of the posterior.">rv</ref>.<ref refid="classRV_1935790526b630dec4ffefa9ec0c2b6fb" kindref="member" tooltip="Add (concat) another variable to the current one,.">add</ref><sp/>(<sp/>rvc<sp/>);</highlight></codeline>
<codeline lineno="80"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline>
<codeline lineno="81"><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>set_elements<sp/>(<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>&amp;i,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>wi,<sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref>*<sp/>ep<sp/>)</highlight></codeline>
<codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{<ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref><sp/>(<sp/>i<sp/>)<sp/>=wi;<sp/>Coms<sp/>(<sp/>i<sp/>)<sp/>=ep;};</highlight></codeline>
<codeline lineno="84"><highlight class="normal"></highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>mean()</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>ugly</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>pom=zeros<sp/>(<sp/>(<sp/>Coms<sp/>(<sp/>0<sp/>)-&gt;<ref refid="classBM_1126bd2595c48e311fc2a7ab72876092a" kindref="member" tooltip="access function">_rv</ref>()<sp/>).count()<sp/>);</highlight></codeline>
<codeline lineno="88"><highlight class="normal"></highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=0;<sp/>i&lt;<ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref>.length();<sp/>i++<sp/>)<sp/>{pom<sp/>+=<sp/>Coms<sp/>(<sp/>i<sp/>)-&gt;mean()<sp/>*<sp/><ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref><sp/>(<sp/>i<sp/>);}</highlight></codeline>
<codeline lineno="90"><highlight class="normal"></highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>concat<sp/>(<sp/>E.mean(),pom<sp/>);</highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="93"><highlight class="normal"></highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>sample()</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{it_error<sp/>(<sp/></highlight><highlight class="stringliteral">&quot;Not<sp/>implemented&quot;</highlight><highlight class="normal"><sp/>);</highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;}</highlight></codeline>
<codeline lineno="95"><highlight class="normal"></highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>evalpdflog<sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&amp;val<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{it_error<sp/>(<sp/></highlight><highlight class="stringliteral">&quot;not<sp/>implemented&quot;</highlight><highlight class="normal"><sp/>);<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0.0;}</highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline>
<codeline lineno="98"><highlight class="normal"></highlight></codeline>
<codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mpfepdf<sp/>jest;</highlight></codeline>
<codeline lineno="101"><highlight class="normal"></highlight></codeline>
<codeline lineno="102"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="104" refid="classMPF_1fc5e11e11eec3195e3c6503937bf02bd" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classMPF_1fc5e11e11eec3195e3c6503937bf02bd" kindref="member" tooltip="Default constructor.">MPF</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>&amp;rvlin,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>&amp;rvpf,<sp/><ref refid="classmpdf" kindref="compound" tooltip="Conditional probability density, e.g. modeling some dependencies.">mpdf</ref><sp/>&amp;par0,<sp/><ref refid="classmpdf" kindref="compound" tooltip="Conditional probability density, e.g. modeling some dependencies.">mpdf</ref><sp/>&amp;obs0,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="classPF_12c2f44ed7a4eaa42e07bdb58d503f280" kindref="member" tooltip="number of particles;">n</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>BM_T<sp/>&amp;BMcond0<sp/>)<sp/>:<sp/><ref refid="classPF" kindref="compound" tooltip="Trivial particle filter with proposal density equal to parameter evolution model...">PF</ref><sp/>(<sp/>rvpf<sp/>,par0,obs0,n<sp/>),jest<sp/>(<sp/><ref refid="classPF_11a0a09e309da997f63ae8e30d1e9806b" kindref="member" tooltip="posterior density">est</ref>,rvlin<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//TODO<sp/>test<sp/>if<sp/>rv<sp/>and<sp/>BMcond.rv<sp/>are<sp/>compatible.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classBM_1af00f0612fabe66241dd507188cdbf88" kindref="member" tooltip="Random variable of the posterior.">rv</ref>.<ref refid="classRV_1935790526b630dec4ffefa9ec0c2b6fb" kindref="member" tooltip="Add (concat) another variable to the current one,.">add</ref><sp/>(<sp/>rvlin<sp/>);</highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight></codeline>
<codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>n&gt;10000<sp/>)<sp/>{it_error<sp/>(<sp/></highlight><highlight class="stringliteral">&quot;increase<sp/>10000<sp/>here!&quot;</highlight><highlight class="normal"><sp/>);}</highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight></codeline>
<codeline lineno="112"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=0;i&lt;n;i++<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Bms[i]<sp/>=<sp/></highlight><highlight class="keyword">new</highlight><highlight class="normal"><sp/>BM_T<sp/>(<sp/>BMcond0<sp/>);<sp/></highlight><highlight class="comment">//copy<sp/>constructor</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="114"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref>&amp;<sp/>pom=Bms[i]-&gt;_epdf();</highlight></codeline>
<codeline lineno="115"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>jest.set_elements<sp/>(<sp/>i,1.0/n,&amp;pom<sp/>);</highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline>
<codeline lineno="118"><highlight class="normal"></highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>~<ref refid="classMPF" kindref="compound" tooltip="Marginalized Particle filter.">MPF</ref>()<sp/>{</highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="121"><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classMPF_155daf8e4b6553dd9f47c692de7931623" kindref="member" tooltip="Incremental Bayes rule.">bayes</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&amp;dt<sp/>);</highlight></codeline>
<codeline lineno="123" refid="classMPF_1549e08268a46a250f21a33d06f19276a" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref>&amp;<sp/><ref refid="classMPF_1549e08268a46a250f21a33d06f19276a" kindref="member" tooltip="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_epdf</ref>()<sp/>{</highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>jest;}</highlight></codeline>
<codeline lineno="125" refid="classMPF_17c66e1c1c0e45fc4ae765133cb3a1553" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classMPF_17c66e1c1c0e45fc4ae765133cb3a1553" kindref="member" tooltip="Set postrior of rvc to samples from epdf0. Statistics of Bms are not re-computed!...">set_est</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref>&amp;<sp/>epdf0<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classPF_104d38fbcc0348b558212f530d9ec183e" kindref="member" tooltip="Set posterior density by sampling from epdf0.">PF::set_est</ref><sp/>(<sp/>epdf0<sp/>);<sp/><sp/></highlight><highlight class="comment">//<sp/>sample<sp/>params<sp/>in<sp/>condition</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>copy<sp/>conditions<sp/>to<sp/>BMs</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="128"><highlight class="normal"></highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=0;i&lt;<ref refid="classPF_12c2f44ed7a4eaa42e07bdb58d503f280" kindref="member" tooltip="number of particles;">n</ref>;i++<sp/>)<sp/>{Bms[i]-&gt;condition<sp/>(<sp/><ref refid="classPF_1cf7dad75e31215780a746c30e71ad9c5" kindref="member" tooltip="pointer into eEmp ">_samples</ref><sp/>(<sp/>i<sp/>)<sp/>);}</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="131"><highlight class="normal"></highlight></codeline>
<codeline lineno="132"><highlight class="normal"></highlight><highlight class="comment">//SimStr:</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>SSAT;</highlight></codeline>
<codeline lineno="134"><highlight class="normal">};</highlight></codeline>
<codeline lineno="135"><highlight class="normal"></highlight></codeline>
<codeline lineno="136"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal">&lt;</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>BM_T&gt;</highlight></codeline>
<codeline lineno="137" refid="classMPF_155daf8e4b6553dd9f47c692de7931623" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classMPF_155daf8e4b6553dd9f47c692de7931623" kindref="member" tooltip="Incremental Bayes rule.">MPF&lt;BM_T&gt;::bayes</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&amp;dt<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>lls<sp/>(<sp/><ref refid="classPF_12c2f44ed7a4eaa42e07bdb58d503f280" kindref="member" tooltip="number of particles;">n</ref><sp/>);</highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>llsP<sp/>(<sp/><ref refid="classPF_12c2f44ed7a4eaa42e07bdb58d503f280" kindref="member" tooltip="number of particles;">n</ref><sp/>);</highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ivec<sp/>ind;</highlight></codeline>
<codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>mlls=-std::numeric_limits&lt;double&gt;::infinity();</highlight></codeline>
<codeline lineno="143"><highlight class="normal"></highlight></codeline>
<codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>StrSim:06</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>sumLWL=0.0;</highlight></codeline>
<codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>sumL2WL=0.0;</highlight></codeline>
<codeline lineno="147"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>WL<sp/>=<sp/>0.0;</highlight></codeline>
<codeline lineno="148"><highlight class="normal"></highlight></codeline>
<codeline lineno="149"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>#pragma<sp/>omp<sp/>parallel<sp/>for</highlight></codeline>
<codeline lineno="150"><highlight class="preprocessor"></highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>i=0;i&lt;<ref refid="classPF_12c2f44ed7a4eaa42e07bdb58d503f280" kindref="member" tooltip="number of particles;">n</ref>;i++<sp/>)<sp/>{<sp/><sp/><sp/></highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//generate<sp/>new<sp/>samples<sp/>from<sp/>paramater<sp/>evolution<sp/>model;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classPF_1cf7dad75e31215780a746c30e71ad9c5" kindref="member" tooltip="pointer into eEmp ">_samples</ref><sp/>(<sp/>i<sp/>)<sp/>=<sp/><ref refid="classPF_1d92ac103f88f8c21e197e90af5695a09" kindref="member" tooltip="Parameter evolution model.">par</ref>.<ref refid="classmpdf_13f172b79ec4a5ebc87898a5381141f1b" kindref="member" tooltip="Returns the required moment of the epdf.">samplecond</ref><sp/>(<sp/><ref refid="classPF_1cf7dad75e31215780a746c30e71ad9c5" kindref="member" tooltip="pointer into eEmp ">_samples</ref><sp/>(<sp/>i<sp/>),<sp/>llsP<sp/>(<sp/>i<sp/>)<sp/>);</highlight></codeline>
<codeline lineno="153"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Bms[i]-&gt;condition<sp/>(<sp/><ref refid="classPF_1cf7dad75e31215780a746c30e71ad9c5" kindref="member" tooltip="pointer into eEmp ">_samples</ref><sp/>(<sp/>i<sp/>)<sp/>);</highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Bms[i]-&gt;bayes<sp/>(<sp/>dt<sp/>);</highlight></codeline>
<codeline lineno="155"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lls<sp/>(<sp/>i<sp/>)<sp/>=<sp/>Bms[i]-&gt;_ll();<sp/></highlight><highlight class="comment">//<sp/>lls<sp/>above<sp/>is<sp/>also<sp/>in<sp/>proposal<sp/>her<sp/>must<sp/>be<sp/>lls(i)<sp/>=,<sp/>not<sp/>+=!!</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="156"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>lls<sp/>(<sp/>i<sp/>)<sp/>&gt;mlls<sp/>)<sp/>mlls=lls<sp/>(<sp/>i<sp/>);<sp/></highlight><highlight class="comment">//find<sp/>maximum<sp/>likelihood<sp/>(for<sp/>numerical<sp/>stability)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="158"><highlight class="normal"></highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/></highlight><highlight class="keyword">false</highlight><highlight class="normal">)<sp/>{</highlight></codeline>
<codeline lineno="160"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>#pragma<sp/>omp<sp/>parallel<sp/>for<sp/>reduction(+:sumLWL,sumL2WL)<sp/>private(WL)</highlight></codeline>
<codeline lineno="161"><highlight class="preprocessor"></highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>i=0;i&lt;n;i++<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>WL<sp/>=<sp/><ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref><sp/>(<sp/>i<sp/>)<sp/>*exp<sp/>(<sp/>llsP<sp/>(<sp/>i<sp/>)<sp/>);<sp/></highlight><highlight class="comment">//using<sp/>old<sp/>weights!</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="163"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sumLWL<sp/>+=<sp/>exp<sp/>(<sp/>lls<sp/>(<sp/>i<sp/>)<sp/>)<sp/>*WL;</highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sumL2WL<sp/>+=<sp/>exp<sp/>(<sp/>2*lls<sp/>(<sp/>i<sp/>)<sp/>)<sp/>*WL;</highlight></codeline>
<codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="166"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>SSAT<sp/><sp/>=<sp/>sumL2WL/<sp/>(<sp/>sumLWL*sumLWL<sp/>);</highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="168"><highlight class="normal"></highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>sum_w=0.0;</highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>compute<sp/>weights</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="171"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>#pragma<sp/>omp<sp/>parallel<sp/>for</highlight></codeline>
<codeline lineno="172"><highlight class="preprocessor"></highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>i=0;i&lt;n;i++<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref><sp/>(<sp/>i<sp/>)<sp/>*=<sp/>exp<sp/>(<sp/>lls<sp/>(<sp/>i<sp/>)<sp/>-<sp/>mlls<sp/>);<sp/></highlight><highlight class="comment">//<sp/>multiply<sp/>w<sp/>by<sp/>likelihood</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sum_w+=<ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref>(i);</highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="176"><highlight class="normal"></highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>sum_w<sp/><sp/>&gt;0.0<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref><sp/>/=sum_w;<sp/></highlight><highlight class="comment">//?</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout&lt;&lt;</highlight><highlight class="stringliteral">&quot;sum(w)==0&quot;</highlight><highlight class="normal">&lt;&lt;endl;</highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="182"><highlight class="normal"></highlight></codeline>
<codeline lineno="183"><highlight class="normal"></highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>eff<sp/>=<sp/>1.0/<sp/>(<sp/><ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref>*<ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref><sp/>);</highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>eff<sp/>&lt;<sp/>(<sp/>0.3*n<sp/>)<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ind<sp/>=<sp/><ref refid="classPF_11a0a09e309da997f63ae8e30d1e9806b" kindref="member" tooltip="posterior density">est</ref>.<ref refid="classeEmp_177268292fc4465cb73ddbfb1f2932a59" kindref="member" tooltip="Function performs resampling, i.e. removal of low-weight samples and duplication...">resample</ref>();</highlight></codeline>
<codeline lineno="187"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Resample<sp/>Bms!</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="188"><highlight class="normal"></highlight></codeline>
<codeline lineno="189"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>#pragma<sp/>omp<sp/>parallel<sp/>for</highlight></codeline>
<codeline lineno="190"><highlight class="preprocessor"></highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>i=0;i&lt;n;i++<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>ind<sp/>(<sp/>i<sp/>)<sp/>!=i<sp/>)<sp/>{</highlight><highlight class="comment">//replace<sp/>the<sp/>current<sp/>Bm<sp/>by<sp/>a<sp/>new<sp/>one</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="192"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//fixme<sp/>this<sp/>would<sp/>require<sp/>new<sp/>assignment<sp/>operator</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="193"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>*Bms[i]<sp/>=<sp/>*Bms[ind<sp/>(<sp/>i<sp/>)<sp/>];</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="194"><highlight class="normal"></highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>poor-man&apos;s<sp/>solution:<sp/>replicate<sp/>constructor<sp/>here</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>copied<sp/>from<sp/>MPF::MPF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">delete</highlight><highlight class="normal"><sp/>Bms[i];</highlight></codeline>
<codeline lineno="198"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Bms[i]<sp/>=<sp/></highlight><highlight class="keyword">new</highlight><highlight class="normal"><sp/>BM_T<sp/>(<sp/>*Bms[ind<sp/>(<sp/>i<sp/>)<sp/>]<sp/>);<sp/></highlight><highlight class="comment">//copy<sp/>constructor</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="199"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref>&amp;<sp/>pom=Bms[i]-&gt;_epdf();</highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>jest.set_elements<sp/>(<sp/>i,1.0/n,&amp;pom<sp/>);</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/>&lt;&lt;<sp/></highlight><highlight class="charliteral">&apos;.&apos;</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="204"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="205"><highlight class="normal">}</highlight></codeline>
<codeline lineno="206"><highlight class="normal"></highlight></codeline>
<codeline lineno="207"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/>//<sp/>KF_H</highlight></codeline>
<codeline lineno="208"><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="209"><highlight class="normal"></highlight></codeline>
    </programlisting>
    <location file="/home/smidl/work/git/mixpp/bdm/estim/libPF.h"/>
  </compounddef>
</doxygen>
