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_8h" kind="file"> |
---|
4 | <compoundname>emix.h</compoundname> |
---|
5 | <includes refid="libBM_8h" local="yes">libBM.h</includes> |
---|
6 | <includes refid="libEF_8h" local="yes">libEF.h</includes> |
---|
7 | <includedby refid="emix_8cpp" local="yes">work/git/mixpp/bdm/stat/emix.cpp</includedby> |
---|
8 | <includedby refid="merger_8h" local="yes">work/git/mixpp/bdm/stat/merger.h</includedby> |
---|
9 | <includedby refid="pmsm__mix_8cpp" local="no">work/git/mixpp/pmsm/pmsm_mix.cpp</includedby> |
---|
10 | <includedby refid="testSmp_8cpp" local="no">work/git/mixpp/tests/testSmp.cpp</includedby> |
---|
11 | <incdepgraph> |
---|
12 | <node id="342"> |
---|
13 | <label>libBM.h</label> |
---|
14 | <link refid="libBM_8h"/> |
---|
15 | <childnode refid="343" relation="include"> |
---|
16 | </childnode> |
---|
17 | </node> |
---|
18 | <node id="341"> |
---|
19 | <label>work/git/mixpp/bdm/stat/emix.h</label> |
---|
20 | <link refid="emix.h"/> |
---|
21 | <childnode refid="342" relation="include"> |
---|
22 | </childnode> |
---|
23 | <childnode refid="344" relation="include"> |
---|
24 | </childnode> |
---|
25 | </node> |
---|
26 | <node id="346"> |
---|
27 | <label>../itpp_ext.h</label> |
---|
28 | <link refid="itpp__ext_8h-source"/> |
---|
29 | <childnode refid="343" relation="include"> |
---|
30 | </childnode> |
---|
31 | </node> |
---|
32 | <node id="344"> |
---|
33 | <label>libEF.h</label> |
---|
34 | <link refid="libEF_8h"/> |
---|
35 | <childnode refid="343" relation="include"> |
---|
36 | </childnode> |
---|
37 | <childnode refid="345" relation="include"> |
---|
38 | </childnode> |
---|
39 | <childnode refid="342" relation="include"> |
---|
40 | </childnode> |
---|
41 | <childnode refid="346" relation="include"> |
---|
42 | </childnode> |
---|
43 | </node> |
---|
44 | <node id="343"> |
---|
45 | <label>itpp/itbase.h</label> |
---|
46 | </node> |
---|
47 | <node id="345"> |
---|
48 | <label>../math/libDC.h</label> |
---|
49 | <link refid="libDC_8h"/> |
---|
50 | <childnode refid="343" relation="include"> |
---|
51 | </childnode> |
---|
52 | </node> |
---|
53 | </incdepgraph> |
---|
54 | <invincdepgraph> |
---|
55 | <node id="348"> |
---|
56 | <label>work/git/mixpp/bdm/stat/merger.h</label> |
---|
57 | <link refid="merger_8h"/> |
---|
58 | </node> |
---|
59 | <node id="347"> |
---|
60 | <label>work/git/mixpp/bdm/stat/emix.h</label> |
---|
61 | <link refid="emix.h"/> |
---|
62 | <childnode refid="348" relation="include"> |
---|
63 | </childnode> |
---|
64 | <childnode refid="349" relation="include"> |
---|
65 | </childnode> |
---|
66 | </node> |
---|
67 | <node id="349"> |
---|
68 | <label>work/git/mixpp/pmsm/pmsm_mix.cpp</label> |
---|
69 | <link refid="pmsm__mix_8cpp"/> |
---|
70 | </node> |
---|
71 | </invincdepgraph> |
---|
72 | <innerclass refid="classemix" prot="public">emix</innerclass> |
---|
73 | <innerclass refid="classmprod" prot="public">mprod</innerclass> |
---|
74 | <innerclass refid="classmmix" prot="public">mmix</innerclass> |
---|
75 | <briefdescription> |
---|
76 | <para>Probability distributions for Mixtures of pdfs. </para> </briefdescription> |
---|
77 | <detaileddescription> |
---|
78 | <para><simplesect kind="author"><para>Vaclav Smidl.</para></simplesect> |
---|
79 | ----------------------------------- BDM++ - C++ library for Bayesian Decision Making under Uncertainty</para><para>Using IT++ for numerical operations ----------------------------------- </para> </detaileddescription> |
---|
80 | <programlisting> |
---|
81 | <codeline lineno="1"></codeline> |
---|
82 | <codeline lineno="13"><highlight class="preprocessor">#ifndef<sp/>MX_H</highlight></codeline> |
---|
83 | <codeline lineno="14"><highlight class="preprocessor"></highlight><highlight class="preprocessor">#define<sp/>MX_H</highlight></codeline> |
---|
84 | <codeline lineno="15"><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline> |
---|
85 | <codeline lineno="16"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="libBM_8h" kindref="compound" tooltip="Bayesian Models (bm) that use Bayes rule to learn from observations.">libBM.h</ref>"</highlight><highlight class="normal"></highlight></codeline> |
---|
86 | <codeline lineno="17"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="libEF_8h" kindref="compound" tooltip="Probability distributions for Exponential Family models.">libEF.h</ref>"</highlight><highlight class="normal"></highlight></codeline> |
---|
87 | <codeline lineno="18"><highlight class="normal"></highlight><highlight class="comment">//#include<sp/><std></highlight><highlight class="normal"></highlight></codeline> |
---|
88 | <codeline lineno="19"><highlight class="normal"></highlight></codeline> |
---|
89 | <codeline lineno="20"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline> |
---|
90 | <codeline lineno="21"><highlight class="normal"></highlight></codeline> |
---|
91 | <codeline lineno="32" refid="classemix" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classemix" kindref="compound" tooltip="Mixture of epdfs.">emix</ref><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/>{</highlight></codeline> |
---|
92 | <codeline lineno="33"><highlight class="normal"></highlight><highlight class="keyword">protected</highlight><highlight class="normal">:</highlight></codeline> |
---|
93 | <codeline lineno="35" refid="classemix_1cdc8f4e2a5e43595ac5450d8a7f9d1ab" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/><ref refid="classemix_1cdc8f4e2a5e43595ac5450d8a7f9d1ab" kindref="member" tooltip="weights of the components">w</ref>;</highlight></codeline> |
---|
94 | <codeline lineno="37" refid="classemix_17155d827417b53fb6aa5cff1459e6eb4" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array<epdf*><sp/><ref refid="classemix_17155d827417b53fb6aa5cff1459e6eb4" kindref="member" tooltip="Component (epdfs).">Coms</ref>;</highlight></codeline> |
---|
95 | <codeline lineno="38"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
---|
96 | <codeline lineno="40" refid="classemix_13a10c8481115a5460877272ddb6532a6" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classemix_13a10c8481115a5460877272ddb6532a6" kindref="member" tooltip="Default constructor.">emix</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>&<ref refid="classepdf_174da992e3f5d598da8850b646b79b9d9" kindref="member" tooltip="Identified of the random variable.">rv</ref><sp/>)<sp/>:<sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref><sp/>(<sp/>rv<sp/>)<sp/>{};</highlight></codeline> |
---|
97 | <codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classemix_16ce82b24d7fe540ddbf44b472a005555" kindref="member" tooltip="Set weights w and components R.">set_parameters</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&<ref refid="classemix_1cdc8f4e2a5e43595ac5450d8a7f9d1ab" kindref="member" tooltip="weights of the components">w</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Array<epdf*><sp/>&<ref refid="classemix_17155d827417b53fb6aa5cff1459e6eb4" kindref="member" tooltip="Component (epdfs).">Coms</ref><sp/>);</highlight></codeline> |
---|
98 | <codeline lineno="43"><highlight class="normal"></highlight></codeline> |
---|
99 | <codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/><ref refid="classemix_10650601f24e633e0ab09aa1e46c14483" kindref="member" tooltip="Returns the required moment of the epdf.">sample</ref>()<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal">;</highlight></codeline> |
---|
100 | <codeline lineno="45" refid="classemix_1b662a51d042b062020460e64bff4e9e8" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/><ref refid="classemix_1b662a51d042b062020460e64bff4e9e8" kindref="member" tooltip="return expected value">mean</ref>()</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline> |
---|
101 | <codeline lineno="46"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;<sp/>vec<sp/>mu<sp/>=<sp/>zeros<sp/>(<sp/><ref refid="classepdf_174da992e3f5d598da8850b646b79b9d9" kindref="member" tooltip="Identified of the random variable.">rv</ref>.<ref refid="classRV_1f5c7b8bd589eef09ccdf3329a0addea0" kindref="member" tooltip="Return number of scalars in the RV.">count</ref>()<sp/>);</highlight></codeline> |
---|
102 | <codeline lineno="47"><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<sp/>=<sp/>0;i<sp/><<sp/><ref refid="classemix_1cdc8f4e2a5e43595ac5450d8a7f9d1ab" kindref="member" tooltip="weights of the components">w</ref>.length();i++<sp/>)<sp/>{mu<sp/>+=<sp/><ref refid="classemix_1cdc8f4e2a5e43595ac5450d8a7f9d1ab" kindref="member" tooltip="weights of the components">w</ref><sp/>(<sp/>i<sp/>)<sp/>*<sp/><ref refid="classemix_17155d827417b53fb6aa5cff1459e6eb4" kindref="member" tooltip="Component (epdfs).">Coms</ref><sp/>(<sp/>i<sp/>)->mean();<sp/>}</highlight></codeline> |
---|
103 | <codeline lineno="48"><highlight class="normal"><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/>mu;</highlight></codeline> |
---|
104 | <codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
105 | <codeline lineno="50" refid="classemix_1469e910479b3402589104ef3bb1b5741" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="classemix_1469e910479b3402589104ef3bb1b5741" kindref="member" tooltip="Compute log-probability of argument val.">evalpdflog</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&val<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline> |
---|
106 | <codeline lineno="51"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline> |
---|
107 | <codeline lineno="52"><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/>sum<sp/>=<sp/>0.0;</highlight></codeline> |
---|
108 | <codeline lineno="53"><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<sp/>=<sp/>0;i<sp/><<sp/><ref refid="classemix_1cdc8f4e2a5e43595ac5450d8a7f9d1ab" kindref="member" tooltip="weights of the components">w</ref>.length();i++<sp/>)<sp/>{sum<sp/>+=<sp/><ref refid="classemix_1cdc8f4e2a5e43595ac5450d8a7f9d1ab" kindref="member" tooltip="weights of the components">w</ref><sp/>(<sp/>i<sp/>)<sp/>*<sp/><ref refid="classemix_17155d827417b53fb6aa5cff1459e6eb4" kindref="member" tooltip="Component (epdfs).">Coms</ref><sp/>(<sp/>i<sp/>)->evalpdflog<sp/>(<sp/>val<sp/>);}</highlight></codeline> |
---|
109 | <codeline lineno="54"><highlight class="normal"><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/>log<sp/>(<sp/>sum<sp/>);</highlight></codeline> |
---|
110 | <codeline lineno="55"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
111 | <codeline lineno="56"><highlight class="normal"></highlight></codeline> |
---|
112 | <codeline lineno="57"><highlight class="normal"></highlight><highlight class="comment">//Access<sp/>methods</highlight></codeline> |
---|
113 | <codeline lineno="59" refid="classemix_135baf0f62307455cebfbf462144b4dd8" refkind="member"><highlight class="comment"></highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec&<sp/><ref refid="classemix_135baf0f62307455cebfbf462144b4dd8" kindref="member" tooltip="returns a pointer to the internal mean value. Use with Care!">_w</ref>()<sp/>{</highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classemix_1cdc8f4e2a5e43595ac5450d8a7f9d1ab" kindref="member" tooltip="weights of the components">w</ref>;}</highlight></codeline> |
---|
114 | <codeline lineno="60"><highlight class="normal">};</highlight></codeline> |
---|
115 | <codeline lineno="61"><highlight class="normal"></highlight></codeline> |
---|
116 | <codeline lineno="70" refid="classmprod" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classmprod" kindref="compound" tooltip="Chain rule decomposition of epdf.">mprod</ref>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classmpdf" kindref="compound" tooltip="Conditional probability density, e.g. modeling some dependencies.">mpdf</ref><sp/>{</highlight></codeline> |
---|
117 | <codeline lineno="71"><highlight class="normal"></highlight><highlight class="keyword">protected</highlight><highlight class="normal">:</highlight></codeline> |
---|
118 | <codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//</highlight><highlight class="normal"></highlight></codeline> |
---|
119 | <codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>n;</highlight></codeline> |
---|
120 | <codeline lineno="74"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>pointers<sp/>to<sp/>epdfs</highlight><highlight class="normal"></highlight></codeline> |
---|
121 | <codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array<epdf*><sp/>epdfs;</highlight></codeline> |
---|
122 | <codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array<mpdf*><sp/>mpdfs;</highlight></codeline> |
---|
123 | <codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//</highlight></codeline> |
---|
124 | <codeline lineno="79" refid="classmprod_1c8f78fbcdb4e38ecd3197d2958082497" refkind="member"><highlight class="comment"></highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array<ivec><sp/><ref refid="classmprod_1c8f78fbcdb4e38ecd3197d2958082497" kindref="member" tooltip="Indeces of rvs in common rv.">rvinds</ref>;</highlight></codeline> |
---|
125 | <codeline lineno="81" refid="classmprod_11725c7b497a27ab3c4889b846666b516" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array<ivec><sp/><ref refid="classmprod_11725c7b497a27ab3c4889b846666b516" kindref="member" tooltip="Indeces of rvc in common rv.">rvcinrv</ref>;</highlight></codeline> |
---|
126 | <codeline lineno="83" refid="classmprod_1cc85192d8abc01832937ed8b62e363a6" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array<ivec><sp/><ref refid="classmprod_1cc85192d8abc01832937ed8b62e363a6" kindref="member" tooltip="Indeces of rvc in common rvc.">rvcinds</ref>;</highlight></codeline> |
---|
127 | <codeline lineno="85" refid="classmprod_15f6431dc5f5ce8a817e0b2049f2a9eda" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"><sp/><ref refid="classmprod_15f6431dc5f5ce8a817e0b2049f2a9eda" kindref="member" tooltip="Indicate independence of its factors.">independent</ref>;</highlight></codeline> |
---|
128 | <codeline lineno="86"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/>//!<sp/>Indicate<sp/>internal<sp/>creation<sp/>of<sp/>mpdfs<sp/>which<sp/>must<sp/>be<sp/>destroyed</highlight><highlight class="normal"></highlight></codeline> |
---|
129 | <codeline lineno="87"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/>bool<sp/>intermpdfs;</highlight><highlight class="normal"></highlight></codeline> |
---|
130 | <codeline lineno="88"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
---|
131 | <codeline lineno="90" refid="classmprod_1419b303581a91ad85200bdcb4b3186f4" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmprod_1419b303581a91ad85200bdcb4b3186f4" kindref="member" tooltip="Constructor from list of eFacs or list of mFacs.">mprod</ref><sp/>(<sp/>Array<mpdf*><sp/>mFacs<sp/>)<sp/>:<sp/><ref refid="classmpdf" kindref="compound" tooltip="Conditional probability density, e.g. modeling some dependencies.">mpdf</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref>(),<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref>()<sp/>),<sp/>n<sp/>(<sp/>mFacs.length()<sp/>),<sp/>epdfs<sp/>(<sp/>n<sp/>),<sp/>mpdfs<sp/>(<sp/>mFacs<sp/>),<sp/><ref refid="classmprod_1c8f78fbcdb4e38ecd3197d2958082497" kindref="member" tooltip="Indeces of rvs in common rv.">rvinds</ref><sp/>(<sp/>n<sp/>),<sp/><ref refid="classmprod_11725c7b497a27ab3c4889b846666b516" kindref="member" tooltip="Indeces of rvc in common rv.">rvcinrv</ref><sp/>(<sp/>n<sp/>),<sp/><ref refid="classmprod_1cc85192d8abc01832937ed8b62e363a6" kindref="member" tooltip="Indeces of rvc in common rvc.">rvcinds</ref><sp/>(<sp/>n<sp/>)<sp/>{</highlight></codeline> |
---|
132 | <codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline> |
---|
133 | <codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Create<sp/>rv</highlight><highlight class="normal"></highlight></codeline> |
---|
134 | <codeline lineno="93"><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<sp/>=<sp/>0;i<sp/><<sp/>n;i++<sp/>)<sp/>{</highlight></codeline> |
---|
135 | <codeline lineno="94"><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="classmpdf_1f6687c07ff07d47812dd565368ca59eb" kindref="member" tooltip="modeled random variable">rv</ref>.<ref refid="classRV_1935790526b630dec4ffefa9ec0c2b6fb" kindref="member" tooltip="Add (concat) another variable to the current one,.">add</ref><sp/>(<sp/>mpdfs<sp/>(<sp/>i<sp/>)-><ref refid="classmpdf_11e71ad4c66d5884c82d4a3b06b42fe32" kindref="member" tooltip="access function">_rv</ref>()<sp/>);<sp/></highlight><highlight class="comment">//add<sp/>rv<sp/>to<sp/>common<sp/>rvs.</highlight><highlight class="normal"></highlight></codeline> |
---|
136 | <codeline lineno="95"><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/>epdfs<sp/>(<sp/>i<sp/>)<sp/>=<sp/>&<sp/>(<sp/>mpdfs<sp/>(<sp/>i<sp/>)->_epdf()<sp/>);<sp/></highlight><highlight class="comment">//<sp/>add<sp/>pointer<sp/>to<sp/>epdf</highlight><highlight class="normal"></highlight></codeline> |
---|
137 | <codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
138 | <codeline lineno="97"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Create<sp/>rvc</highlight><highlight class="normal"></highlight></codeline> |
---|
139 | <codeline lineno="98"><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<sp/>=<sp/>0;i<sp/><<sp/>n;i++<sp/>)<sp/>{</highlight></codeline> |
---|
140 | <codeline lineno="99"><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="classmpdf_1acb7dda792b3cd5576f39fa3129abbab" kindref="member" tooltip="random variable in condition">rvc</ref>.<ref refid="classRV_1935790526b630dec4ffefa9ec0c2b6fb" kindref="member" tooltip="Add (concat) another variable to the current one,.">add</ref><sp/>(<sp/>mpdfs<sp/>(<sp/>i<sp/>)-><ref refid="classmpdf_11e71ad4c66d5884c82d4a3b06b42fe32" kindref="member" tooltip="access function">_rv</ref>().subt<sp/>(<sp/><ref refid="classmpdf_1f6687c07ff07d47812dd565368ca59eb" kindref="member" tooltip="modeled random variable">rv</ref><sp/>)<sp/>);<sp/></highlight><highlight class="comment">//add<sp/>rv<sp/>to<sp/>common<sp/>rvs.</highlight><highlight class="normal"></highlight></codeline> |
---|
141 | <codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
142 | <codeline lineno="101"><highlight class="normal"></highlight></codeline> |
---|
143 | <codeline lineno="102"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmprod_15f6431dc5f5ce8a817e0b2049f2a9eda" kindref="member" tooltip="Indicate independence of its factors.">independent</ref><sp/>=<sp/></highlight><highlight class="keyword">true</highlight><highlight class="normal">;</highlight></codeline> |
---|
144 | <codeline lineno="103"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//test<sp/>rvc<sp/>of<sp/>mpdfs<sp/>and<sp/>fill<sp/>rvinds</highlight><highlight class="normal"></highlight></codeline> |
---|
145 | <codeline lineno="104"><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<sp/>=<sp/>0;i<sp/><<sp/>n;i++<sp/>)<sp/>{</highlight></codeline> |
---|
146 | <codeline lineno="105"><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/>find<sp/>ith<sp/>rv<sp/>in<sp/>common<sp/>rv</highlight><highlight class="normal"></highlight></codeline> |
---|
147 | <codeline lineno="106"><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="classmprod_1c8f78fbcdb4e38ecd3197d2958082497" kindref="member" tooltip="Indeces of rvs in common rv.">rvinds</ref><sp/>(<sp/>i<sp/>)<sp/>=<sp/>mpdfs<sp/>(<sp/>i<sp/>)->_rv().dataind<sp/>(<sp/><ref refid="classmpdf_1f6687c07ff07d47812dd565368ca59eb" kindref="member" tooltip="modeled random variable">rv</ref><sp/>);</highlight></codeline> |
---|
148 | <codeline lineno="107"><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/>find<sp/>ith<sp/>rvc<sp/>in<sp/>common<sp/>rv</highlight><highlight class="normal"></highlight></codeline> |
---|
149 | <codeline lineno="108"><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="classmprod_11725c7b497a27ab3c4889b846666b516" kindref="member" tooltip="Indeces of rvc in common rv.">rvcinrv</ref><sp/>(<sp/>i<sp/>)<sp/>=<sp/>mpdfs<sp/>(<sp/>i<sp/>)->_rvc().dataind<sp/>(<sp/><ref refid="classmpdf_1f6687c07ff07d47812dd565368ca59eb" kindref="member" tooltip="modeled random variable">rv</ref><sp/>);</highlight></codeline> |
---|
150 | <codeline lineno="109"><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/>find<sp/>ith<sp/>rvc<sp/>in<sp/>common<sp/>rv</highlight><highlight class="normal"></highlight></codeline> |
---|
151 | <codeline lineno="110"><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="classmprod_1cc85192d8abc01832937ed8b62e363a6" kindref="member" tooltip="Indeces of rvc in common rvc.">rvcinds</ref><sp/>(<sp/>i<sp/>)<sp/>=<sp/>mpdfs<sp/>(<sp/>i<sp/>)->_rvc().dataind<sp/>(<sp/><ref refid="classmpdf_1acb7dda792b3cd5576f39fa3129abbab" kindref="member" tooltip="random variable in condition">rvc</ref><sp/>);</highlight></codeline> |
---|
152 | <codeline lineno="111"><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">//</highlight><highlight class="normal"></highlight></codeline> |
---|
153 | <codeline lineno="112"><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/><ref refid="classmprod_1cc85192d8abc01832937ed8b62e363a6" kindref="member" tooltip="Indeces of rvc in common rvc.">rvcinds</ref><sp/>(<sp/>i<sp/>).length()<sp/>>0<sp/>)<sp/>{<ref refid="classmprod_15f6431dc5f5ce8a817e0b2049f2a9eda" kindref="member" tooltip="Indicate independence of its factors.">independent</ref><sp/>=<sp/></highlight><highlight class="keyword">false</highlight><highlight class="normal">;}</highlight></codeline> |
---|
154 | <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/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/><ref refid="classmprod_1cc85192d8abc01832937ed8b62e363a6" kindref="member" tooltip="Indeces of rvc in common rvc.">rvcinds</ref><sp/>(<sp/>i<sp/>).length()<sp/>>0<sp/>)<sp/>{<ref refid="classmprod_15f6431dc5f5ce8a817e0b2049f2a9eda" kindref="member" tooltip="Indicate independence of its factors.">independent</ref><sp/>=<sp/></highlight><highlight class="keyword">false</highlight><highlight class="normal">;}</highlight></codeline> |
---|
155 | <codeline lineno="114"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
156 | <codeline lineno="115"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
157 | <codeline lineno="116"><highlight class="normal"></highlight></codeline> |
---|
158 | <codeline lineno="117"><highlight class="normal"><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/>&val<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline> |
---|
159 | <codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline> |
---|
160 | <codeline lineno="119"><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/>res<sp/>=<sp/>0.0;</highlight></codeline> |
---|
161 | <codeline lineno="120"><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<sp/>=<sp/>n<sp/>-<sp/>1;i<sp/>><sp/>0;i++<sp/>)<sp/>{</highlight></codeline> |
---|
162 | <codeline lineno="121"><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/><ref refid="classmprod_1cc85192d8abc01832937ed8b62e363a6" kindref="member" tooltip="Indeces of rvc in common rvc.">rvcinds</ref><sp/>(<sp/>i<sp/>).length()<sp/>><sp/>0<sp/>)</highlight></codeline> |
---|
163 | <codeline lineno="122"><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/>{mpdfs<sp/>(<sp/>i<sp/>)->condition<sp/>(<sp/>val<sp/>(<sp/><ref refid="classmprod_1cc85192d8abc01832937ed8b62e363a6" kindref="member" tooltip="Indeces of rvc in common rvc.">rvcinds</ref><sp/>(<sp/>i<sp/>)<sp/>)<sp/>);}</highlight></codeline> |
---|
164 | <codeline lineno="123"><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/>add<sp/>logarithms</highlight><highlight class="normal"></highlight></codeline> |
---|
165 | <codeline lineno="124"><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/>res<sp/>+=<sp/>epdfs<sp/>(<sp/>i<sp/>)->evalpdflog<sp/>(<sp/>val<sp/>(<sp/><ref refid="classmprod_1c8f78fbcdb4e38ecd3197d2958082497" kindref="member" tooltip="Indeces of rvs in common rv.">rvinds</ref><sp/>(<sp/>i<sp/>)<sp/>)<sp/>);</highlight></codeline> |
---|
166 | <codeline lineno="125"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
167 | <codeline lineno="126"><highlight class="normal"><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/>res;</highlight></codeline> |
---|
168 | <codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
169 | <codeline lineno="128"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>samplecond<sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&cond,<sp/>vec<sp/>&ll<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline> |
---|
170 | <codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>smp=zeros<sp/>(<sp/><ref refid="classmpdf_1f6687c07ff07d47812dd565368ca59eb" kindref="member" tooltip="modeled random variable">rv</ref>.<ref refid="classRV_1f5c7b8bd589eef09ccdf3329a0addea0" kindref="member" tooltip="Return number of scalars in the RV.">count</ref>()<sp/>);</highlight></codeline> |
---|
171 | <codeline lineno="130"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>condi;</highlight></codeline> |
---|
172 | <codeline lineno="131"><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<sp/>=<sp/>(<sp/>n<sp/>-<sp/>1<sp/>);i<sp/>>=<sp/>0;i--<sp/>)<sp/>{</highlight></codeline> |
---|
173 | <codeline lineno="132"><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/><ref refid="classmprod_1cc85192d8abc01832937ed8b62e363a6" kindref="member" tooltip="Indeces of rvc in common rvc.">rvcinds</ref><sp/>(<sp/>i<sp/>).length()<sp/>><sp/>0<sp/>)<sp/>{</highlight></codeline> |
---|
174 | <codeline lineno="133"><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/>condi<sp/>=<sp/>zeros<sp/>(<sp/><ref refid="classmprod_11725c7b497a27ab3c4889b846666b516" kindref="member" tooltip="Indeces of rvc in common rv.">rvcinrv</ref>.length()<sp/>+<sp/><ref refid="classmprod_1cc85192d8abc01832937ed8b62e363a6" kindref="member" tooltip="Indeces of rvc in common rvc.">rvcinds</ref>.length()<sp/>);</highlight></codeline> |
---|
175 | <codeline lineno="134"><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/>copy<sp/>data<sp/>in<sp/>condition</highlight><highlight class="normal"></highlight></codeline> |
---|
176 | <codeline lineno="135"><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/>set_subvector<sp/>(<sp/>condi,<ref refid="classmprod_1cc85192d8abc01832937ed8b62e363a6" kindref="member" tooltip="Indeces of rvc in common rvc.">rvcinds</ref><sp/>(<sp/>i<sp/>),<sp/>cond<sp/>);</highlight></codeline> |
---|
177 | <codeline lineno="136"><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/>copy<sp/>data<sp/>in<sp/>already<sp/>generated<sp/>sample</highlight><highlight class="normal"></highlight></codeline> |
---|
178 | <codeline lineno="137"><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/>set_subvector<sp/>(<sp/>condi,<ref refid="classmprod_11725c7b497a27ab3c4889b846666b516" kindref="member" tooltip="Indeces of rvc in common rv.">rvcinrv</ref><sp/>(<sp/>i<sp/>),<sp/>smp<sp/>);</highlight></codeline> |
---|
179 | <codeline lineno="138"><highlight class="normal"></highlight></codeline> |
---|
180 | <codeline lineno="139"><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/>mpdfs<sp/>(<sp/>i<sp/>)->condition<sp/>(<sp/>condi<sp/>);</highlight></codeline> |
---|
181 | <codeline lineno="140"><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> |
---|
182 | <codeline lineno="141"><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/>copy<sp/>contribution<sp/>of<sp/>this<sp/>pdf<sp/>into<sp/>smp</highlight><highlight class="normal"></highlight></codeline> |
---|
183 | <codeline lineno="142"><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/>set_subvector<sp/>(<sp/>smp,<ref refid="classmprod_1c8f78fbcdb4e38ecd3197d2958082497" kindref="member" tooltip="Indeces of rvs in common rv.">rvinds</ref><sp/>(<sp/>i<sp/>),<sp/>epdfs<sp/>(<sp/>i<sp/>)->sample()<sp/>);</highlight></codeline> |
---|
184 | <codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
185 | <codeline lineno="144"><highlight class="normal"><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/>smp;</highlight></codeline> |
---|
186 | <codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
187 | <codeline lineno="146"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>mean()<sp/>const<sp/>{</highlight><highlight class="normal"></highlight></codeline> |
---|
188 | <codeline lineno="147"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>tmp<sp/>(<sp/>rv.count()<sp/>);</highlight><highlight class="normal"></highlight></codeline> |
---|
189 | <codeline lineno="148"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>if<sp/>(<sp/>independent<sp/>)<sp/>{</highlight><highlight class="normal"></highlight></codeline> |
---|
190 | <codeline lineno="149"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>for<sp/>(<sp/>int<sp/>i=0;i<n;i++<sp/>)<sp/>{</highlight><highlight class="normal"></highlight></codeline> |
---|
191 | <codeline lineno="150"><highlight class="normal"></highlight><highlight class="comment">//<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/>vec<sp/>pom<sp/>=<sp/>epdfs<sp/>(<sp/>i<sp/>)->mean();</highlight><highlight class="normal"></highlight></codeline> |
---|
192 | <codeline lineno="151"><highlight class="normal"></highlight><highlight class="comment">//<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/>set_subvector<sp/>(<sp/>tmp,rvinds<sp/>(<sp/>i<sp/>),<sp/>pom<sp/>);</highlight><highlight class="normal"></highlight></codeline> |
---|
193 | <codeline lineno="152"><highlight class="normal"></highlight><highlight class="comment">//<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="normal"></highlight></codeline> |
---|
194 | <codeline lineno="153"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight><highlight class="normal"></highlight></codeline> |
---|
195 | <codeline lineno="154"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>else<sp/>{</highlight><highlight class="normal"></highlight></codeline> |
---|
196 | <codeline lineno="155"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>int<sp/>N=50*rv.count();</highlight><highlight class="normal"></highlight></codeline> |
---|
197 | <codeline lineno="156"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_warning<sp/>(<sp/>"eprod.mean()<sp/>computed<sp/>by<sp/>sampling"<sp/>);</highlight><highlight class="normal"></highlight></codeline> |
---|
198 | <codeline lineno="157"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp<sp/>=<sp/>zeros<sp/>(<sp/>rv.count()<sp/>);</highlight><highlight class="normal"></highlight></codeline> |
---|
199 | <codeline lineno="158"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>for<sp/>(<sp/>int<sp/>i=0;i<N;i++<sp/>)<sp/>{<sp/>tmp<sp/>+=<sp/>sample();}</highlight><highlight class="normal"></highlight></codeline> |
---|
200 | <codeline lineno="159"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>tmp<sp/>/=N;</highlight><highlight class="normal"></highlight></codeline> |
---|
201 | <codeline lineno="160"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight><highlight class="normal"></highlight></codeline> |
---|
202 | <codeline lineno="161"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>return<sp/>tmp;</highlight><highlight class="normal"></highlight></codeline> |
---|
203 | <codeline lineno="162"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/>}</highlight><highlight class="normal"></highlight></codeline> |
---|
204 | <codeline lineno="163"><highlight class="normal"></highlight></codeline> |
---|
205 | <codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>~<ref refid="classmprod" kindref="compound" tooltip="Chain rule decomposition of epdf.">mprod</ref>()<sp/>{};</highlight></codeline> |
---|
206 | <codeline lineno="165"><highlight class="normal">};</highlight></codeline> |
---|
207 | <codeline lineno="166"><highlight class="normal"></highlight></codeline> |
---|
208 | <codeline lineno="170" refid="classmmix" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classmmix" kindref="compound" tooltip="Mixture of mpdfs with constant weights, all mpdfs are of equal type.">mmix</ref><sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classmpdf" kindref="compound" tooltip="Conditional probability density, e.g. modeling some dependencies.">mpdf</ref><sp/>{</highlight></codeline> |
---|
209 | <codeline lineno="171"><highlight class="normal"></highlight><highlight class="keyword">protected</highlight><highlight class="normal">:</highlight></codeline> |
---|
210 | <codeline lineno="173" refid="classmmix_1460632c7a0afd41b7840902181a7d85f" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array<mpdf*><sp/><ref refid="classmmix_1460632c7a0afd41b7840902181a7d85f" kindref="member" tooltip="Component (epdfs).">Coms</ref>;</highlight></codeline> |
---|
211 | <codeline lineno="175" refid="classmmix_1507a5e6df53e6e9a6a330f1271cf0914" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classemix" kindref="compound" tooltip="Mixture of epdfs.">emix</ref><sp/><ref refid="classmmix_1507a5e6df53e6e9a6a330f1271cf0914" kindref="member" tooltip="Internal epdf.">Epdf</ref>;</highlight></codeline> |
---|
212 | <codeline lineno="176"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
---|
213 | <codeline lineno="178" refid="classmmix_16769a962f1f4d0ecc5b903b5f7d26ad3" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmmix_16769a962f1f4d0ecc5b903b5f7d26ad3" kindref="member" tooltip="Default constructor.">mmix</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>&<ref refid="classmpdf_1f6687c07ff07d47812dd565368ca59eb" kindref="member" tooltip="modeled random variable">rv</ref>,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>&<ref refid="classmpdf_1acb7dda792b3cd5576f39fa3129abbab" kindref="member" tooltip="random variable in condition">rvc</ref><sp/>)<sp/>:<sp/><ref refid="classmpdf" kindref="compound" tooltip="Conditional probability density, e.g. modeling some dependencies.">mpdf</ref><sp/>(<sp/>rv,<sp/>rvc<sp/>),<sp/><ref refid="classmmix_1507a5e6df53e6e9a6a330f1271cf0914" kindref="member" tooltip="Internal epdf.">Epdf</ref><sp/>(<sp/>rv<sp/>)<sp/>{<ref refid="classmpdf_17aa894208a32f3487827df6d5054424c" kindref="member" tooltip="pointer to internal epdf">ep</ref><sp/>=<sp/>&<ref refid="classmmix_1507a5e6df53e6e9a6a330f1271cf0914" kindref="member" tooltip="Internal epdf.">Epdf</ref>;};</highlight></codeline> |
---|
214 | <codeline lineno="180" refid="classmmix_1e7681490a5c5b2d0a43f4e5842e10a9d" 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="classmmix_1e7681490a5c5b2d0a43f4e5842e10a9d" kindref="member" tooltip="Set weights w and components R.">set_parameters</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&w,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Array<mpdf*><sp/>&<ref refid="classmmix_1460632c7a0afd41b7840902181a7d85f" kindref="member" tooltip="Component (epdfs).">Coms</ref><sp/>)<sp/>{</highlight></codeline> |
---|
215 | <codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array<epdf*><sp/>Eps<sp/>(<sp/>Coms.length()<sp/>);</highlight></codeline> |
---|
216 | <codeline lineno="182"><highlight class="normal"></highlight></codeline> |
---|
217 | <codeline lineno="183"><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<sp/>=<sp/>0;i<sp/><<sp/>Coms.length();i++<sp/>)<sp/>{</highlight></codeline> |
---|
218 | <codeline lineno="184"><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/>Eps<sp/>(<sp/>i<sp/>)<sp/>=<sp/>&<sp/>(<sp/><ref refid="classmmix_1460632c7a0afd41b7840902181a7d85f" kindref="member" tooltip="Component (epdfs).">Coms</ref><sp/>(<sp/>i<sp/>)->_epdf()<sp/>);</highlight></codeline> |
---|
219 | <codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
220 | <codeline lineno="186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmmix_1507a5e6df53e6e9a6a330f1271cf0914" kindref="member" tooltip="Internal epdf.">Epdf</ref>.<ref refid="classemix_16ce82b24d7fe540ddbf44b472a005555" kindref="member" tooltip="Set weights w and components R.">set_parameters</ref><sp/>(<sp/>w,<sp/>Eps<sp/>);</highlight></codeline> |
---|
221 | <codeline lineno="187"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
222 | <codeline lineno="188"><highlight class="normal"></highlight></codeline> |
---|
223 | <codeline lineno="189" refid="classmmix_11a66629ec5c2b6f4740606cf737f0193" 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="classmmix_11a66629ec5c2b6f4740606cf737f0193" kindref="member" tooltip="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&cond<sp/>)<sp/>{</highlight></codeline> |
---|
224 | <codeline lineno="190"><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<sp/>=<sp/>0;i<sp/><<sp/><ref refid="classmmix_1460632c7a0afd41b7840902181a7d85f" kindref="member" tooltip="Component (epdfs).">Coms</ref>.length();i++<sp/>)<sp/>{<ref refid="classmmix_1460632c7a0afd41b7840902181a7d85f" kindref="member" tooltip="Component (epdfs).">Coms</ref><sp/>(<sp/>i<sp/>)->condition<sp/>(<sp/>cond<sp/>);}</highlight></codeline> |
---|
225 | <codeline lineno="191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
226 | <codeline lineno="192"><highlight class="normal">};</highlight></codeline> |
---|
227 | <codeline lineno="193"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/>//MX_H</highlight></codeline> |
---|
228 | </programlisting> |
---|
229 | <location file="/home/smidl/work/git/mixpp/bdm/stat/emix.h"/> |
---|
230 | </compounddef> |
---|
231 | </doxygen> |
---|