<?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_8cpp" kind="file">
    <compoundname>libPF.cpp</compoundname>
    <includes refid="libPF_8h" local="yes">libPF.h</includes>
    <incdepgraph>
      <node id="247">
        <label>work/git/mixpp/bdm/estim/libPF.cpp</label>
        <link refid="libPF.cpp"/>
        <childnode refid="248" relation="include">
        </childnode>
      </node>
      <node id="252">
        <label>libBM.h</label>
        <link refid="libBM_8h"/>
        <childnode refid="249" relation="include">
        </childnode>
      </node>
      <node id="253">
        <label>../itpp_ext.h</label>
        <link refid="itpp__ext_8h-source"/>
        <childnode refid="249" relation="include">
        </childnode>
      </node>
      <node id="250">
        <label>../stat/libEF.h</label>
        <link refid="libEF_8h"/>
        <childnode refid="249" relation="include">
        </childnode>
        <childnode refid="251" relation="include">
        </childnode>
        <childnode refid="252" relation="include">
        </childnode>
        <childnode refid="253" relation="include">
        </childnode>
      </node>
      <node id="248">
        <label>libPF.h</label>
        <link refid="libPF_8h"/>
        <childnode refid="249" relation="include">
        </childnode>
        <childnode refid="250" relation="include">
        </childnode>
        <childnode refid="251" relation="include">
        </childnode>
      </node>
      <node id="249">
        <label>itpp/itbase.h</label>
      </node>
      <node id="251">
        <label>../math/libDC.h</label>
        <link refid="libDC_8h"/>
        <childnode refid="249" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="preprocessor">#include<sp/>&quot;<ref refid="libPF_8h" kindref="compound" tooltip="Bayesian Filtering using stochastic sampling (Particle Filters).">libPF.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline>
<codeline lineno="4"><highlight class="normal"></highlight></codeline>
<codeline lineno="5"><highlight class="normal"></highlight><highlight class="keyword">using</highlight><highlight class="normal"><sp/>std::endl;</highlight></codeline>
<codeline lineno="6"><highlight class="normal"></highlight></codeline>
<codeline lineno="7" refid="classPF_164f636bbd63bea9efd778214e6b631d3" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classPF_164f636bbd63bea9efd778214e6b631d3" kindref="member" tooltip="Incremental Bayes rule.">PF::bayes</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&amp;dt<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="8"><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="9"><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="10"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ivec<sp/>ind;</highlight></codeline>
<codeline lineno="11"><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(),<sp/>sum=0.0;</highlight></codeline>
<codeline lineno="12"><highlight class="normal"></highlight></codeline>
<codeline lineno="13"><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/>{</highlight></codeline>
<codeline lineno="14"><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="15"><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/>lls<sp/>(<sp/>i<sp/>)<sp/>);</highlight></codeline>
<codeline lineno="16"><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/><ref refid="classPF_1dd0a687a4515333d6809147335854e77" kindref="member" tooltip="Observation model.">obs</ref>.<ref refid="classmpdf_180b738ece5bd4f8c4edaee4b38906f91" kindref="member" tooltip="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evalcond</ref><sp/>(<sp/>dt,<ref refid="classPF_1cf7dad75e31215780a746c30e71ad9c5" kindref="member" tooltip="pointer into eEmp ">_samples</ref><sp/>(<sp/>i<sp/>)<sp/>);</highlight></codeline>
<codeline lineno="17"><highlight class="normal"></highlight></codeline>
<codeline lineno="18"><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</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="19"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="20"><highlight class="normal"></highlight></codeline>
<codeline lineno="21"><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="22"><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="23"><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="24"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="25"><highlight class="normal"></highlight></codeline>
<codeline lineno="26"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//renormalize</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="27"><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/>{sum+=<ref refid="classPF_15c87aba508df321ff26536ced64dbb3a" kindref="member" tooltip="pointer into eEmp ">_w</ref><sp/>(<sp/>i<sp/>);};</highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight></codeline>
<codeline lineno="29"><highlight class="normal"><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/>/=sum;<sp/></highlight><highlight class="comment">//?</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="30"><highlight class="normal"></highlight></codeline>
<codeline lineno="31"><highlight class="normal"><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="32"><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal">}</highlight></codeline>
<codeline lineno="34"><highlight class="normal"></highlight></codeline>
<codeline lineno="35" refid="classPF_104d38fbcc0348b558212f530d9ec183e" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classPF_104d38fbcc0348b558212f530d9ec183e" kindref="member" tooltip="Set posterior density by sampling from epdf0.">PF::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/>)<sp/>{</highlight></codeline>
<codeline lineno="36"><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="37"><highlight class="normal"></highlight></codeline>
<codeline lineno="38"><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/>{</highlight></codeline>
<codeline lineno="39"><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/>epdf0.<ref refid="classepdf_18019654e494bf5e458f6fb947e11b262" kindref="member" tooltip="Returns the required moment of the epdf.">sample</ref>();</highlight></codeline>
<codeline lineno="40"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="41"><highlight class="normal">}</highlight></codeline>
<codeline lineno="42"><highlight class="normal"></highlight></codeline>
<codeline lineno="43"><highlight class="normal"></highlight><highlight class="comment">//MPF::MPF:{}</highlight><highlight class="normal"></highlight></codeline>
    </programlisting>
    <location file="/home/smidl/work/git/mixpp/bdm/estim/libPF.cpp"/>
  </compounddef>
</doxygen>
