| 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="emix_8cpp" kind="file"> |
|---|
| 4 | <compoundname>emix.cpp</compoundname> |
|---|
| 5 | <includes refid="emix_8h" local="yes">emix.h</includes> |
|---|
| 6 | <incdepgraph> |
|---|
| 7 | <node id="335"> |
|---|
| 8 | <label>libBM.h</label> |
|---|
| 9 | <link refid="libBM_8h"/> |
|---|
| 10 | <childnode refid="336" relation="include"> |
|---|
| 11 | </childnode> |
|---|
| 12 | </node> |
|---|
| 13 | <node id="334"> |
|---|
| 14 | <label>emix.h</label> |
|---|
| 15 | <link refid="emix_8h"/> |
|---|
| 16 | <childnode refid="335" relation="include"> |
|---|
| 17 | </childnode> |
|---|
| 18 | <childnode refid="337" relation="include"> |
|---|
| 19 | </childnode> |
|---|
| 20 | </node> |
|---|
| 21 | <node id="339"> |
|---|
| 22 | <label>../itpp_ext.h</label> |
|---|
| 23 | <link refid="itpp__ext_8h-source"/> |
|---|
| 24 | <childnode refid="336" relation="include"> |
|---|
| 25 | </childnode> |
|---|
| 26 | </node> |
|---|
| 27 | <node id="337"> |
|---|
| 28 | <label>libEF.h</label> |
|---|
| 29 | <link refid="libEF_8h"/> |
|---|
| 30 | <childnode refid="336" relation="include"> |
|---|
| 31 | </childnode> |
|---|
| 32 | <childnode refid="338" relation="include"> |
|---|
| 33 | </childnode> |
|---|
| 34 | <childnode refid="335" relation="include"> |
|---|
| 35 | </childnode> |
|---|
| 36 | <childnode refid="339" relation="include"> |
|---|
| 37 | </childnode> |
|---|
| 38 | </node> |
|---|
| 39 | <node id="336"> |
|---|
| 40 | <label>itpp/itbase.h</label> |
|---|
| 41 | </node> |
|---|
| 42 | <node id="338"> |
|---|
| 43 | <label>../math/libDC.h</label> |
|---|
| 44 | <link refid="libDC_8h"/> |
|---|
| 45 | <childnode refid="336" relation="include"> |
|---|
| 46 | </childnode> |
|---|
| 47 | </node> |
|---|
| 48 | <node id="333"> |
|---|
| 49 | <label>work/git/mixpp/bdm/stat/emix.cpp</label> |
|---|
| 50 | <link refid="emix.cpp"/> |
|---|
| 51 | <childnode refid="334" relation="include"> |
|---|
| 52 | </childnode> |
|---|
| 53 | </node> |
|---|
| 54 | </incdepgraph> |
|---|
| 55 | <briefdescription> |
|---|
| 56 | </briefdescription> |
|---|
| 57 | <detaileddescription> |
|---|
| 58 | </detaileddescription> |
|---|
| 59 | <programlisting> |
|---|
| 60 | <codeline lineno="1"><highlight class="preprocessor">#include<sp/>"<ref refid="emix_8h" kindref="compound" tooltip="Probability distributions for Mixtures of pdfs.">emix.h</ref>"</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 61 | <codeline lineno="2"><highlight class="normal"></highlight></codeline> |
|---|
| 62 | <codeline lineno="3"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline> |
|---|
| 63 | <codeline lineno="4"><highlight class="normal"></highlight></codeline> |
|---|
| 64 | <codeline lineno="5" refid="classemix_16ce82b24d7fe540ddbf44b472a005555" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classemix_16ce82b24d7fe540ddbf44b472a005555" kindref="member" tooltip="Set weights w and components R.">emix::set_parameters</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&w0,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Array<epdf*><sp/>&Coms0<sp/>)<sp/>{</highlight></codeline> |
|---|
| 65 | <codeline lineno="6"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classemix_1cdc8f4e2a5e43595ac5450d8a7f9d1ab" kindref="member" tooltip="weights of the components">w</ref><sp/>=<sp/>w0;</highlight></codeline> |
|---|
| 66 | <codeline lineno="7"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline> |
|---|
| 67 | <codeline lineno="8"><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<<ref refid="classemix_1cdc8f4e2a5e43595ac5450d8a7f9d1ab" kindref="member" tooltip="weights of the components">w</ref>.length();i++<sp/>)<sp/>{</highlight></codeline> |
|---|
| 68 | <codeline lineno="9"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug<sp/>(<sp/><ref refid="classepdf_174da992e3f5d598da8850b646b79b9d9" kindref="member" tooltip="Identified of the random variable.">rv</ref>.<ref refid="classRV_182cc7fa22ce91cf461a522ad62014c65" kindref="member" tooltip="Compare if rv2 is identical to this RV.">equal</ref><sp/>(<sp/>Coms0<sp/>(<sp/>i<sp/>)-><ref refid="classepdf_14778ea61ef400813e47750e024e9fc2f" kindref="member" tooltip="access function, possibly dangerous!">_rv</ref>()<sp/>),</highlight><highlight class="stringliteral">"RVs<sp/>do<sp/>not<sp/>match!"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
|---|
| 69 | <codeline lineno="10"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
|---|
| 70 | <codeline lineno="11"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classemix_17155d827417b53fb6aa5cff1459e6eb4" kindref="member" tooltip="Component (epdfs).">Coms</ref><sp/>=<sp/>Coms0;</highlight></codeline> |
|---|
| 71 | <codeline lineno="12"><highlight class="normal">}</highlight></codeline> |
|---|
| 72 | <codeline lineno="13"><highlight class="normal"></highlight></codeline> |
|---|
| 73 | <codeline lineno="14" refid="classemix_10650601f24e633e0ab09aa1e46c14483" refkind="member"><highlight class="normal">vec<sp/><ref refid="classemix_10650601f24e633e0ab09aa1e46c14483" kindref="member" tooltip="Returns the required moment of the epdf.">emix::sample</ref>()</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline> |
|---|
| 74 | <codeline lineno="15"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//Sample<sp/>which<sp/>component</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 75 | <codeline lineno="16"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>cumDist<sp/>=<sp/>cumsum<sp/>(<sp/><ref refid="classemix_1cdc8f4e2a5e43595ac5450d8a7f9d1ab" kindref="member" tooltip="weights of the components">w</ref><sp/>);</highlight></codeline> |
|---|
| 76 | <codeline lineno="17"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>u0<sp/>=<sp/>UniRNG.sample();</highlight></codeline> |
|---|
| 77 | <codeline lineno="18"><highlight class="normal"></highlight></codeline> |
|---|
| 78 | <codeline lineno="19"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=0;</highlight></codeline> |
|---|
| 79 | <codeline lineno="20"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(<sp/>(<sp/>cumDist<sp/>(<sp/>i<sp/>)<sp/><u0<sp/>)<sp/>&&<sp/>(<sp/>i<<sp/>(<sp/><ref refid="classemix_1cdc8f4e2a5e43595ac5450d8a7f9d1ab" kindref="member" tooltip="weights of the components">w</ref>.length()-1<sp/>)<sp/>)<sp/>)<sp/>{i++;}</highlight></codeline> |
|---|
| 80 | <codeline lineno="21"><highlight class="normal"></highlight></codeline> |
|---|
| 81 | <codeline lineno="22"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classemix_17155d827417b53fb6aa5cff1459e6eb4" kindref="member" tooltip="Component (epdfs).">Coms</ref><sp/>(<sp/>i<sp/>)->sample();</highlight></codeline> |
|---|
| 82 | <codeline lineno="23"><highlight class="normal">}</highlight></codeline> |
|---|
| 83 | </programlisting> |
|---|
| 84 | <location file="/home/smidl/work/git/mixpp/bdm/stat/emix.cpp"/> |
|---|
| 85 | </compounddef> |
|---|
| 86 | </doxygen> |
|---|