root/doc/xml/libPF_8cpp.xml @ 266

Revision 187, 11.7 kB (checked in by smidl, 16 years ago)

doc

Line 
1<?xml version='1.0' encoding='UTF-8' standalone='no'?>
2<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.5.6">
3  <compounddef id="libPF_8cpp" kind="file">
4    <compoundname>libPF.cpp</compoundname>
5    <includes refid="libPF_8h" local="yes">libPF.h</includes>
6    <incdepgraph>
7      <node id="247">
8        <label>work/git/mixpp/bdm/estim/libPF.cpp</label>
9        <link refid="libPF.cpp"/>
10        <childnode refid="248" relation="include">
11        </childnode>
12      </node>
13      <node id="252">
14        <label>libBM.h</label>
15        <link refid="libBM_8h"/>
16        <childnode refid="249" relation="include">
17        </childnode>
18      </node>
19      <node id="253">
20        <label>../itpp_ext.h</label>
21        <link refid="itpp__ext_8h-source"/>
22        <childnode refid="249" relation="include">
23        </childnode>
24      </node>
25      <node id="250">
26        <label>../stat/libEF.h</label>
27        <link refid="libEF_8h"/>
28        <childnode refid="249" relation="include">
29        </childnode>
30        <childnode refid="251" relation="include">
31        </childnode>
32        <childnode refid="252" relation="include">
33        </childnode>
34        <childnode refid="253" relation="include">
35        </childnode>
36      </node>
37      <node id="248">
38        <label>libPF.h</label>
39        <link refid="libPF_8h"/>
40        <childnode refid="249" relation="include">
41        </childnode>
42        <childnode refid="250" relation="include">
43        </childnode>
44        <childnode refid="251" relation="include">
45        </childnode>
46      </node>
47      <node id="249">
48        <label>itpp/itbase.h</label>
49      </node>
50      <node id="251">
51        <label>../math/libDC.h</label>
52        <link refid="libDC_8h"/>
53        <childnode refid="249" relation="include">
54        </childnode>
55      </node>
56    </incdepgraph>
57    <briefdescription>
58    </briefdescription>
59    <detaileddescription>
60    </detaileddescription>
61    <programlisting>
62<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>
63<codeline lineno="2"><highlight class="normal"></highlight></codeline>
64<codeline lineno="3"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline>
65<codeline lineno="4"><highlight class="normal"></highlight></codeline>
66<codeline lineno="5"><highlight class="normal"></highlight><highlight class="keyword">using</highlight><highlight class="normal"><sp/>std::endl;</highlight></codeline>
67<codeline lineno="6"><highlight class="normal"></highlight></codeline>
68<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>
69<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>
70<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>
71<codeline lineno="10"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ivec<sp/>ind;</highlight></codeline>
72<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>
73<codeline lineno="12"><highlight class="normal"></highlight></codeline>
74<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>
75<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>
76<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>
77<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>
78<codeline lineno="17"><highlight class="normal"></highlight></codeline>
79<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>
80<codeline lineno="19"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
81<codeline lineno="20"><highlight class="normal"></highlight></codeline>
82<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>
83<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>
84<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>
85<codeline lineno="24"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
86<codeline lineno="25"><highlight class="normal"></highlight></codeline>
87<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>
88<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>
89<codeline lineno="28"><highlight class="normal"></highlight></codeline>
90<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>
91<codeline lineno="30"><highlight class="normal"></highlight></codeline>
92<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>
93<codeline lineno="32"><highlight class="normal"></highlight></codeline>
94<codeline lineno="33"><highlight class="normal">}</highlight></codeline>
95<codeline lineno="34"><highlight class="normal"></highlight></codeline>
96<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>
97<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>
98<codeline lineno="37"><highlight class="normal"></highlight></codeline>
99<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>
100<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>
101<codeline lineno="40"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
102<codeline lineno="41"><highlight class="normal">}</highlight></codeline>
103<codeline lineno="42"><highlight class="normal"></highlight></codeline>
104<codeline lineno="43"><highlight class="normal"></highlight><highlight class="comment">//MPF::MPF:{}</highlight><highlight class="normal"></highlight></codeline>
105    </programlisting>
106    <location file="/home/smidl/work/git/mixpp/bdm/estim/libPF.cpp"/>
107  </compounddef>
108</doxygen>
Note: See TracBrowser for help on using the browser.