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="testSmp_8cpp" kind="file"> |
---|
4 | <compoundname>testSmp.cpp</compoundname> |
---|
5 | <includes local="no">itpp/itbase.h</includes> |
---|
6 | <includes refid="libEF_8h" local="no">stat/libEF.h</includes> |
---|
7 | <includes refid="emix_8h" local="no">stat/emix.h</includes> |
---|
8 | <incdepgraph> |
---|
9 | <node id="920"> |
---|
10 | <label>libBM.h</label> |
---|
11 | <link refid="libBM_8h"/> |
---|
12 | <childnode refid="917" relation="include"> |
---|
13 | </childnode> |
---|
14 | </node> |
---|
15 | <node id="922"> |
---|
16 | <label>stat/emix.h</label> |
---|
17 | <link refid="emix_8h"/> |
---|
18 | <childnode refid="920" relation="include"> |
---|
19 | </childnode> |
---|
20 | <childnode refid="918" relation="include"> |
---|
21 | </childnode> |
---|
22 | </node> |
---|
23 | <node id="921"> |
---|
24 | <label>../itpp_ext.h</label> |
---|
25 | <link refid="itpp__ext_8h-source"/> |
---|
26 | <childnode refid="917" relation="include"> |
---|
27 | </childnode> |
---|
28 | </node> |
---|
29 | <node id="918"> |
---|
30 | <label>stat/libEF.h</label> |
---|
31 | <link refid="libEF_8h"/> |
---|
32 | <childnode refid="917" relation="include"> |
---|
33 | </childnode> |
---|
34 | <childnode refid="919" relation="include"> |
---|
35 | </childnode> |
---|
36 | <childnode refid="920" relation="include"> |
---|
37 | </childnode> |
---|
38 | <childnode refid="921" relation="include"> |
---|
39 | </childnode> |
---|
40 | </node> |
---|
41 | <node id="917"> |
---|
42 | <label>itpp/itbase.h</label> |
---|
43 | </node> |
---|
44 | <node id="916"> |
---|
45 | <label>work/git/mixpp/tests/testSmp.cpp</label> |
---|
46 | <link refid="testSmp.cpp"/> |
---|
47 | <childnode refid="917" relation="include"> |
---|
48 | </childnode> |
---|
49 | <childnode refid="918" relation="include"> |
---|
50 | </childnode> |
---|
51 | <childnode refid="922" relation="include"> |
---|
52 | </childnode> |
---|
53 | </node> |
---|
54 | <node id="919"> |
---|
55 | <label>../math/libDC.h</label> |
---|
56 | <link refid="libDC_8h"/> |
---|
57 | <childnode refid="917" relation="include"> |
---|
58 | </childnode> |
---|
59 | </node> |
---|
60 | </incdepgraph> |
---|
61 | <sectiondef kind="func"> |
---|
62 | <memberdef kind="function" id="testSmp_8cpp_1e3186ff19d9ad2c3984dbd12c10bd9ad" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
63 | <type>void</type> |
---|
64 | <definition>void disp</definition> |
---|
65 | <argsstring>(const vec &tmu, const mat &tR, const mat &Smp)</argsstring> |
---|
66 | <name>disp</name> |
---|
67 | <param> |
---|
68 | <type>const vec &</type> |
---|
69 | <declname>tmu</declname> |
---|
70 | </param> |
---|
71 | <param> |
---|
72 | <type>const mat &</type> |
---|
73 | <declname>tR</declname> |
---|
74 | </param> |
---|
75 | <param> |
---|
76 | <type>const mat &</type> |
---|
77 | <declname>Smp</declname> |
---|
78 | </param> |
---|
79 | <briefdescription> |
---|
80 | </briefdescription> |
---|
81 | <detaileddescription> |
---|
82 | </detaileddescription> |
---|
83 | <inbodydescription> |
---|
84 | </inbodydescription> |
---|
85 | <location file="/home/smidl/work/git/mixpp/tests/testSmp.cpp" line="11" bodyfile="/home/smidl/work/git/mixpp/tests/testSmp.cpp" bodystart="11" bodyend="20"/> |
---|
86 | </memberdef> |
---|
87 | <memberdef kind="function" id="testSmp_8cpp_1e66f6b31b5ad750f1fe042a706a4e3d4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
88 | <type>int</type> |
---|
89 | <definition>int main</definition> |
---|
90 | <argsstring>()</argsstring> |
---|
91 | <name>main</name> |
---|
92 | <briefdescription> |
---|
93 | </briefdescription> |
---|
94 | <detaileddescription> |
---|
95 | </detaileddescription> |
---|
96 | <inbodydescription> |
---|
97 | </inbodydescription> |
---|
98 | <location file="/home/smidl/work/git/mixpp/tests/testSmp.cpp" line="22" bodyfile="/home/smidl/work/git/mixpp/tests/testSmp.cpp" bodystart="22" bodyend="120"/> |
---|
99 | </memberdef> |
---|
100 | </sectiondef> |
---|
101 | <briefdescription> |
---|
102 | </briefdescription> |
---|
103 | <detaileddescription> |
---|
104 | </detaileddescription> |
---|
105 | <programlisting> |
---|
106 | <codeline lineno="1"><highlight class="preprocessor">#include<sp/><itpp/itbase.h></highlight><highlight class="normal"></highlight></codeline> |
---|
107 | <codeline lineno="2"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="libEF_8h" kindref="compound" tooltip="Probability distributions for Exponential Family models.">stat/libEF.h</ref>></highlight><highlight class="normal"></highlight></codeline> |
---|
108 | <codeline lineno="3"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><<ref refid="emix_8h" kindref="compound" tooltip="Probability distributions for Mixtures of pdfs.">stat/emix.h</ref>></highlight><highlight class="normal"></highlight></codeline> |
---|
109 | <codeline lineno="4"><highlight class="normal"></highlight></codeline> |
---|
110 | <codeline lineno="5"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline> |
---|
111 | <codeline lineno="6"><highlight class="normal"></highlight></codeline> |
---|
112 | <codeline lineno="7"><highlight class="normal"></highlight><highlight class="comment">//These<sp/>lines<sp/>are<sp/>needed<sp/>for<sp/>use<sp/>of<sp/>cout<sp/>and<sp/>endl</highlight><highlight class="normal"></highlight></codeline> |
---|
113 | <codeline lineno="8"><highlight class="normal"></highlight><highlight class="keyword">using</highlight><highlight class="normal"><sp/>std::cout;</highlight></codeline> |
---|
114 | <codeline lineno="9"><highlight class="normal"></highlight><highlight class="keyword">using</highlight><highlight class="normal"><sp/>std::endl;</highlight></codeline> |
---|
115 | <codeline lineno="10"><highlight class="normal"></highlight></codeline> |
---|
116 | <codeline lineno="11"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>disp(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&tmu,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&tR,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&Smp){</highlight></codeline> |
---|
117 | <codeline lineno="12"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>N<sp/>=<sp/>Smp.cols();</highlight></codeline> |
---|
118 | <codeline lineno="13"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>Emu<sp/>=<sp/>Smp*ones(N)<sp/>/N<sp/>;</highlight></codeline> |
---|
119 | <codeline lineno="14"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Er<sp/>=<sp/>(Smp*Smp.transpose())/N<sp/>-<sp/>outer_product(Emu,Emu);</highlight></codeline> |
---|
120 | <codeline lineno="15"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"True<sp/>mu:"</highlight><highlight class="normal"><sp/><<<sp/>tmu<sp/><<endl;</highlight></codeline> |
---|
121 | <codeline lineno="16"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"Emp<sp/><sp/>mu:"</highlight><highlight class="normal"><sp/><<<sp/>Emu<sp/><<endl;</highlight></codeline> |
---|
122 | <codeline lineno="17"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
123 | <codeline lineno="18"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"True<sp/>R:"</highlight><highlight class="normal"><sp/><<<sp/>tR<sp/><<endl;</highlight></codeline> |
---|
124 | <codeline lineno="19"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"Emp<sp/><sp/>R:"</highlight><highlight class="normal"><sp/><<<sp/>Er<sp/><<endl;</highlight></codeline> |
---|
125 | <codeline lineno="20"><highlight class="normal">}</highlight></codeline> |
---|
126 | <codeline lineno="21"><highlight class="normal"></highlight></codeline> |
---|
127 | <codeline lineno="22"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="sim__var_8cpp_1e66f6b31b5ad750f1fe042a706a4e3d4" kindref="member" tooltip="Extended Kalman filter with unknown Q.">main</ref>()<sp/>{</highlight></codeline> |
---|
128 | <codeline lineno="23"><highlight class="normal"></highlight></codeline> |
---|
129 | <codeline lineno="24"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>RNG_randomize();</highlight></codeline> |
---|
130 | <codeline lineno="25"><highlight class="normal"></highlight></codeline> |
---|
131 | <codeline lineno="26"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>x(</highlight><highlight class="stringliteral">"{x<sp/>}"</highlight><highlight class="normal">,</highlight><highlight class="stringliteral">"2"</highlight><highlight class="normal">);</highlight></codeline> |
---|
132 | <codeline lineno="27"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>y(</highlight><highlight class="stringliteral">"{y<sp/>}"</highlight><highlight class="normal">,</highlight><highlight class="stringliteral">"2"</highlight><highlight class="normal">);</highlight></codeline> |
---|
133 | <codeline lineno="28"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>N<sp/>=<sp/>10000;<sp/></highlight><highlight class="comment">//number<sp/>of<sp/>samples</highlight><highlight class="normal"></highlight></codeline> |
---|
134 | <codeline lineno="29"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>mu0<sp/>=<sp/></highlight><highlight class="stringliteral">"1.5<sp/>1.7"</highlight><highlight class="normal">;</highlight></codeline> |
---|
135 | <codeline lineno="30"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>V0(</highlight><highlight class="stringliteral">"1.2<sp/>0.3;<sp/>0.3<sp/>5"</highlight><highlight class="normal">);</highlight></codeline> |
---|
136 | <codeline lineno="31"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat" kindref="compound" tooltip="Matrix stored in LD form, (typically known as UD).">ldmat</ref><sp/>R<sp/>=<sp/><ref refid="classldmat" kindref="compound" tooltip="Matrix stored in LD form, (typically known as UD).">ldmat</ref>(V0);</highlight></codeline> |
---|
137 | <codeline lineno="32"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
138 | <codeline lineno="33"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"======<sp/>ENorm<sp/>======<sp/>"</highlight><highlight class="normal"><sp/><<endl;</highlight></codeline> |
---|
139 | <codeline lineno="34"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classenorm" kindref="compound" tooltip="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<ldmat></ref><sp/>eN(x);</highlight></codeline> |
---|
140 | <codeline lineno="35"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>eN.set_parameters(mu0,R);</highlight></codeline> |
---|
141 | <codeline lineno="36"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Smp<sp/>=<sp/>eN.sample(N);</highlight></codeline> |
---|
142 | <codeline lineno="37"><highlight class="normal"></highlight></codeline> |
---|
143 | <codeline lineno="38"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>disp(mu0,R.<ref refid="classldmat_15b0515da8dc2293d9e4360b74cc26c9e" kindref="member" tooltip="Conversion to full matrix.">to_mat</ref>(),Smp);</highlight></codeline> |
---|
144 | <codeline lineno="39"><highlight class="normal"></highlight></codeline> |
---|
145 | <codeline lineno="40"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"======<sp/>MlNorm<sp/>======<sp/>"</highlight><highlight class="normal"><sp/><<endl;</highlight></codeline> |
---|
146 | <codeline lineno="41"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>I<sp/>=<sp/>eye(2);</highlight></codeline> |
---|
147 | <codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>lik(N);</highlight></codeline> |
---|
148 | <codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmlnorm" kindref="compound" tooltip="Normal distributed linear function with linear function of mean value;.">mlnorm<ldmat></ref><sp/>ML(x,x);</highlight></codeline> |
---|
149 | <codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ML.set_parameters(I,R);</highlight></codeline> |
---|
150 | <codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Smp<sp/>=<sp/>ML.samplecond(mu0,lik,N);</highlight></codeline> |
---|
151 | <codeline lineno="46"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
152 | <codeline lineno="47"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>disp(mu0,R.<ref refid="classldmat_15b0515da8dc2293d9e4360b74cc26c9e" kindref="member" tooltip="Conversion to full matrix.">to_mat</ref>(),Smp);</highlight></codeline> |
---|
153 | <codeline lineno="48"><highlight class="normal"></highlight></codeline> |
---|
154 | <codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"======<sp/>EGamma<sp/>======<sp/>"</highlight><highlight class="normal"><sp/><<endl;<sp/></highlight></codeline> |
---|
155 | <codeline lineno="50"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>a<sp/>=<sp/></highlight><highlight class="stringliteral">"100000,10000"</highlight><highlight class="normal">;</highlight></codeline> |
---|
156 | <codeline lineno="51"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>b<sp/>=<sp/>a/10.0;</highlight></codeline> |
---|
157 | <codeline lineno="52"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classegamma" kindref="compound" tooltip="Gamma posterior density.">egamma</ref><sp/>eG(x);</highlight></codeline> |
---|
158 | <codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>eG.set_parameters(a,b);</highlight></codeline> |
---|
159 | <codeline lineno="54"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
160 | <codeline lineno="55"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/>eG.eval(a)<<endl;</highlight></codeline> |
---|
161 | <codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Smp<sp/>=<sp/>eG.sampleN(N);</highlight></codeline> |
---|
162 | <codeline lineno="57"><highlight class="normal"></highlight></codeline> |
---|
163 | <codeline lineno="58"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>g_mu<sp/>=<sp/>elem_div(a,b);</highlight></codeline> |
---|
164 | <codeline lineno="59"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>g_var<sp/>=<sp/>elem_div(a,pow(b,2.0));</highlight></codeline> |
---|
165 | <codeline lineno="60"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>disp(g_mu,diag(g_var),Smp);</highlight></codeline> |
---|
166 | <codeline lineno="61"><highlight class="normal"></highlight></codeline> |
---|
167 | <codeline lineno="62"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"======<sp/>MGamma<sp/>======<sp/>"</highlight><highlight class="normal"><sp/><<endl;<sp/></highlight></codeline> |
---|
168 | <codeline lineno="63"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmgamma" kindref="compound" tooltip="Gamma random walk.">mgamma</ref><sp/>mG(x,x);</highlight></codeline> |
---|
169 | <codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>k<sp/>=<sp/>10.0;</highlight></codeline> |
---|
170 | <codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mG.set_parameters(k);</highlight></codeline> |
---|
171 | <codeline lineno="66"><highlight class="normal"></highlight></codeline> |
---|
172 | <codeline lineno="67"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Smp=mG.samplecond(mu0,lik,N);</highlight></codeline> |
---|
173 | <codeline lineno="68"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>disp(mu0,pow(mu0,2.0)/k,Smp);</highlight></codeline> |
---|
174 | <codeline lineno="69"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
175 | <codeline lineno="70"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"=======<sp/>EMix<sp/>========<sp/>"</highlight><highlight class="normal"><sp/><<<sp/>endl;</highlight></codeline> |
---|
176 | <codeline lineno="71"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classemix" kindref="compound" tooltip="Mixture of epdfs.">emix</ref><sp/>eMix(x);</highlight></codeline> |
---|
177 | <codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array<epdf*><sp/>Coms(2);</highlight></codeline> |
---|
178 | <codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Coms(0)<sp/>=<sp/>&eG;</highlight></codeline> |
---|
179 | <codeline lineno="74"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Coms(1)<sp/>=<sp/>&eN;</highlight></codeline> |
---|
180 | <codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
181 | <codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>eMix.set_parameters(vec_2(0.5,0.5),<sp/>Coms);</highlight></codeline> |
---|
182 | <codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>smp<sp/>=<sp/>eMix.sample();</highlight></codeline> |
---|
183 | <codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Smp<sp/>=<sp/>eMix.sampleN(N);</highlight></codeline> |
---|
184 | <codeline lineno="79"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>disp(eMix.mean(),zeros(2),Smp);</highlight></codeline> |
---|
185 | <codeline lineno="80"><highlight class="normal"></highlight></codeline> |
---|
186 | <codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"=======<sp/>MEpdf<sp/>========<sp/>"</highlight><highlight class="normal"><sp/><<<sp/>endl;</highlight></codeline> |
---|
187 | <codeline lineno="82"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmepdf" kindref="compound" tooltip="Unconditional mpdf, allows using epdf in the role of mpdf.">mepdf</ref><sp/>meMix(eMix);</highlight></codeline> |
---|
188 | <codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
189 | <codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Smp<sp/>=<sp/>meMix.samplecond(mu0,lik,N);</highlight></codeline> |
---|
190 | <codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>disp(eMix.mean(),zeros(2),Smp);</highlight></codeline> |
---|
191 | <codeline lineno="86"><highlight class="normal"></highlight></codeline> |
---|
192 | <codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"=======<sp/>MMix<sp/>========<sp/>"</highlight><highlight class="normal"><sp/><<<sp/>endl;</highlight></codeline> |
---|
193 | <codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmmix" kindref="compound" tooltip="Mixture of mpdfs with constant weights, all mpdfs are of equal type.">mmix</ref><sp/>mMix(x,x);</highlight></codeline> |
---|
194 | <codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array<mpdf*><sp/>mComs(2);</highlight></codeline> |
---|
195 | <codeline lineno="90"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mComs(0)<sp/>=<sp/>&mG;</highlight></codeline> |
---|
196 | <codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>eN.set_mu(vec_2(0.0,0.0));</highlight></codeline> |
---|
197 | <codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmepdf" kindref="compound" tooltip="Unconditional mpdf, allows using epdf in the role of mpdf.">mepdf</ref><sp/>mEnorm(eN);</highlight></codeline> |
---|
198 | <codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mComs(1)<sp/>=<sp/>&mEnorm;</highlight></codeline> |
---|
199 | <codeline lineno="94"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mMix.set_parameters(vec_2(0.5,0.5),mComs);</highlight></codeline> |
---|
200 | <codeline lineno="95"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
201 | <codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Smp<sp/>=<sp/>mMix.samplecond(mu0,lik,N);</highlight></codeline> |
---|
202 | <codeline lineno="97"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>disp(mMix._epdf().mean(),zeros(2),Smp);</highlight></codeline> |
---|
203 | <codeline lineno="98"><highlight class="normal"></highlight></codeline> |
---|
204 | <codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cout<sp/><<<sp/></highlight><highlight class="stringliteral">"=======<sp/>EProd<sp/>========<sp/>"</highlight><highlight class="normal"><sp/><<<sp/>endl;</highlight></codeline> |
---|
205 | <codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>we<sp/>have<sp/>to<sp/>change<sp/>eG.rv<sp/>to<sp/>y</highlight><highlight class="normal"></highlight></codeline> |
---|
206 | <codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>eG._rv()=<sp/>y;<sp/></highlight></codeline> |
---|
207 | <codeline lineno="102"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//create<sp/>array<sp/></highlight><highlight class="normal"></highlight></codeline> |
---|
208 | <codeline lineno="103"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Array<mpdf*><sp/>A(2);</highlight></codeline> |
---|
209 | <codeline lineno="104"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmepdf" kindref="compound" tooltip="Unconditional mpdf, allows using epdf in the role of mpdf.">mepdf</ref><sp/>meN(eN);</highlight></codeline> |
---|
210 | <codeline lineno="105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classmepdf" kindref="compound" tooltip="Unconditional mpdf, allows using epdf in the role of mpdf.">mepdf</ref><sp/>meG(eG);</highlight></codeline> |
---|
211 | <codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>A(0)<sp/>=<sp/>&meN;</highlight></codeline> |
---|
212 | <codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>A(1)<sp/>=<sp/>&meG;</highlight></codeline> |
---|
213 | <codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
214 | <codeline lineno="109"><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/>eP(A);</highlight></codeline> |
---|
215 | <codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>epV=zeros(4,4);</highlight></codeline> |
---|
216 | <codeline lineno="111"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>epV.set_submatrix(0,0,V0);</highlight></codeline> |
---|
217 | <codeline lineno="112"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>epV.set_submatrix(2,2,diag(g_var));</highlight></codeline> |
---|
218 | <codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
219 | <codeline lineno="114"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Smp<sp/>=<sp/>eP.samplecond(vec(0),lik,N);</highlight></codeline> |
---|
220 | <codeline lineno="115"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>disp(eP.mean(),<sp/>epV,Smp);</highlight></codeline> |
---|
221 | <codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
222 | <codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//Exit<sp/>program:</highlight><highlight class="normal"></highlight></codeline> |
---|
223 | <codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline> |
---|
224 | <codeline lineno="119"><highlight class="normal"></highlight></codeline> |
---|
225 | <codeline lineno="120"><highlight class="normal">}</highlight></codeline> |
---|
226 | <codeline lineno="121"><highlight class="normal"></highlight></codeline> |
---|
227 | </programlisting> |
---|
228 | <location file="/home/smidl/work/git/mixpp/tests/testSmp.cpp"/> |
---|
229 | </compounddef> |
---|
230 | </doxygen> |
---|