70 | | <a name="l00085"></a>00085 |
71 | | <a name="l00086"></a>00086 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
72 | | <a name="l00087"></a>00087 <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<sq_T>::enorm</a>( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv, vec &mu0, sq_T &R0 ) { |
73 | | <a name="l00088"></a>00088 dim = rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>(); |
74 | | <a name="l00089"></a>00089 mu = mu0; |
75 | | <a name="l00090"></a>00090 R = R0; |
76 | | <a name="l00091"></a>00091 }; |
77 | | <a name="l00092"></a>00092 |
78 | | <a name="l00093"></a>00093 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
79 | | <a name="l00094"></a>00094 <span class="keywordtype">void</span> <a class="code" href="classenorm.html#d1b0faf61260de09cf63bf823add5b32" title="dupdate used in KF">enorm<sq_T>::dupdate</a>( mat &v, <span class="keywordtype">double</span> nu ) { |
80 | | <a name="l00095"></a>00095 <span class="comment">//</span> |
81 | | <a name="l00096"></a>00096 }; |
82 | | <a name="l00097"></a>00097 |
83 | | <a name="l00098"></a>00098 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
84 | | <a name="l00099"></a><a class="code" href="classenorm.html#5b5fd142b6b17ea334597960e3fe126a">00099</a> <span class="keywordtype">void</span> <a class="code" href="classenorm.html#2a1a522504c7788dfd7fb733157ee39e" title="tupdate used in KF">enorm<sq_T>::tupdate</a>( <span class="keywordtype">double</span> phi, mat &vbar, <span class="keywordtype">double</span> nubar ) { |
85 | | <a name="l00100"></a>00100 <span class="comment">//</span> |
86 | | <a name="l00101"></a>00101 }; |
87 | | <a name="l00102"></a>00102 |
88 | | <a name="l00103"></a>00103 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
89 | | <a name="l00104"></a><a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023">00104</a> vec <a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023" title="Returns the required moment of the epdf.">enorm<sq_T>::sample</a>() { |
90 | | <a name="l00105"></a>00105 vec x( dim ); |
91 | | <a name="l00106"></a>00106 RNG.sample_vector( dim,x ); |
92 | | <a name="l00107"></a>00107 vec smp = R.sqrt_mult( x ); |
93 | | <a name="l00108"></a>00108 |
94 | | <a name="l00109"></a>00109 smp += mu; |
95 | | <a name="l00110"></a>00110 <span class="keywordflow">return</span> smp; |
96 | | <a name="l00111"></a>00111 }; |
97 | | <a name="l00112"></a>00112 |
98 | | <a name="l00113"></a>00113 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
99 | | <a name="l00114"></a>00114 mat <a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023" title="Returns the required moment of the epdf.">enorm<sq_T>::sample</a>( <span class="keywordtype">int</span> N ) { |
100 | | <a name="l00115"></a>00115 mat X( dim,N ); |
101 | | <a name="l00116"></a>00116 vec x( dim ); |
102 | | <a name="l00117"></a>00117 vec pom; |
103 | | <a name="l00118"></a>00118 <span class="keywordtype">int</span> i; |
104 | | <a name="l00119"></a>00119 <span class="keywordflow">for</span> ( i=0;i<N;i++ ) { |
105 | | <a name="l00120"></a>00120 RNG.sample_vector( dim,x ); |
106 | | <a name="l00121"></a>00121 pom = R.sqrt_mult( x ); |
107 | | <a name="l00122"></a>00122 pom +=mu; |
108 | | <a name="l00123"></a>00123 X.set_col( i, pom); |
109 | | <a name="l00124"></a>00124 } |
110 | | <a name="l00125"></a>00125 <span class="keywordflow">return</span> X; |
111 | | <a name="l00126"></a>00126 }; |
112 | | <a name="l00127"></a>00127 |
113 | | <a name="l00128"></a>00128 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
114 | | <a name="l00129"></a><a class="code" href="classenorm.html#93107f05a8e9b34b64853767200121a4">00129</a> <span class="keywordtype">double</span> <a class="code" href="classenorm.html#93107f05a8e9b34b64853767200121a4" title="Compute probability of argument val.">enorm<sq_T>::eval</a>( <span class="keyword">const</span> vec &val ) { |
115 | | <a name="l00130"></a>00130 <span class="comment">//</span> |
116 | | <a name="l00131"></a>00131 }; |
117 | | <a name="l00132"></a>00132 |
118 | | <a name="l00133"></a>00133 |
119 | | <a name="l00134"></a>00134 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
120 | | <a name="l00135"></a>00135 <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<sq_T>::enorm</a>() {}; |
121 | | <a name="l00136"></a>00136 |
122 | | <a name="l00137"></a>00137 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
123 | | <a name="l00138"></a>00138 mlnorm<sq_T>::mlnorm( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv,<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc, mat &A, sq_T &R ) { |
124 | | <a name="l00139"></a>00139 <span class="keywordtype">int</span> dim = rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>(); |
125 | | <a name="l00140"></a>00140 vec mu( dim ); |
126 | | <a name="l00141"></a>00141 |
127 | | <a name="l00142"></a>00142 <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> = <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<sq_T></a>( rv,mu,R ); |
128 | | <a name="l00143"></a>00143 } |
129 | | <a name="l00144"></a>00144 |
130 | | <a name="l00145"></a>00145 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
131 | | <a name="l00146"></a>00146 vec mlnorm<sq_T>::samplecond( vec &cond, <span class="keywordtype">double</span> &lik ) { |
132 | | <a name="l00147"></a>00147 this->condition( cond ); |
133 | | <a name="l00148"></a>00148 vec smp = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.sample(); |
134 | | <a name="l00149"></a>00149 lik = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.eval( smp ); |
135 | | <a name="l00150"></a>00150 <span class="keywordflow">return</span> smp; |
136 | | <a name="l00151"></a>00151 } |
137 | | <a name="l00152"></a>00152 |
138 | | <a name="l00153"></a>00153 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
139 | | <a name="l00154"></a>00154 mat mlnorm<sq_T>::samplecond( vec &cond, vec &lik, <span class="keywordtype">int</span> n ) { |
140 | | <a name="l00155"></a>00155 <span class="keywordtype">int</span> i; |
141 | | <a name="l00156"></a>00156 <span class="keywordtype">int</span> dim = rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>(); |
142 | | <a name="l00157"></a>00157 mat Smp( dim,n ); |
143 | | <a name="l00158"></a>00158 vec smp( dim ); |
144 | | <a name="l00159"></a>00159 this->condition( cond ); |
145 | | <a name="l00160"></a>00160 <span class="keywordflow">for</span> ( i=0; i<dim; i++ ) { |
146 | | <a name="l00161"></a>00161 smp = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.sample(); |
147 | | <a name="l00162"></a>00162 lik( i ) = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.eval( smp ); |
148 | | <a name="l00163"></a>00163 Smp.set_col( i ,smp ); |
149 | | <a name="l00164"></a>00164 } |
150 | | <a name="l00165"></a>00165 <span class="keywordflow">return</span> Smp; |
151 | | <a name="l00166"></a>00166 } |
152 | | <a name="l00167"></a>00167 |
153 | | <a name="l00168"></a>00168 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
154 | | <a name="l00169"></a>00169 <span class="keywordtype">void</span> mlnorm<sq_T>::condition( vec &cond ) { |
155 | | <a name="l00170"></a>00170 <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.mu = A*cond; |
156 | | <a name="l00171"></a>00171 <span class="comment">//R is already assigned;</span> |
157 | | <a name="l00172"></a>00172 } |
158 | | <a name="l00173"></a>00173 |
159 | | <a name="l00174"></a>00174 <span class="preprocessor">#endif //EF_H</span> |
160 | | </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Mon Feb 18 21:48:39 2008 for mixpp by |
| 69 | <a name="l00084"></a>00084 vec <a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023" title="Returns the required moment of the epdf.">sample</a>(); |
| 70 | <a name="l00085"></a>00085 mat <a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023" title="Returns the required moment of the epdf.">sample</a> ( <span class="keywordtype">int</span> N ); |
| 71 | <a name="l00086"></a>00086 <span class="keywordtype">double</span> <a class="code" href="classenorm.html#93107f05a8e9b34b64853767200121a4" title="Compute probability of argument val.">eval</a> ( <span class="keyword">const</span> vec &val ); |
| 72 | <a name="l00087"></a>00087 <span class="keywordtype">double</span> <a class="code" href="classenorm.html#9517594915e897584eaebbb057ed8881" title="Compute log-probability of argument val.">evalpdflog</a> ( <span class="keyword">const</span> vec &val ); |
| 73 | <a name="l00088"></a><a class="code" href="classenorm.html#191c1220c3ddd0c5f54e78f19b57ebd5">00088</a> vec <a class="code" href="classenorm.html#191c1220c3ddd0c5f54e78f19b57ebd5" title="return expected value">mean</a>(){<span class="keywordflow">return</span> <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a>;} |
| 74 | <a name="l00089"></a>00089 |
| 75 | <a name="l00090"></a>00090 <span class="comment">//Access methods</span> |
| 76 | <a name="l00092"></a><a class="code" href="classenorm.html#3be0cb541ec9b88e5aa3f60307bbc753">00092</a> <span class="comment"></span> vec* <a class="code" href="classenorm.html#3be0cb541ec9b88e5aa3f60307bbc753" title="returns a pointer to the internal mean value. Use with Care!">_mu</a>() {<span class="keywordflow">return</span> &<a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a>;} |
| 77 | <a name="l00093"></a>00093 |
| 78 | <a name="l00095"></a><a class="code" href="classenorm.html#8725c534863c4fc2bddef0edfb95a740">00095</a> <span class="keywordtype">void</span> <a class="code" href="classenorm.html#8725c534863c4fc2bddef0edfb95a740" title="returns pointers to the internal variance and its inverse. Use with Care!">_R</a> ( sq_T* &pR, sq_T* &piR ) { |
| 79 | <a name="l00096"></a>00096 pR=&<a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>; |
| 80 | <a name="l00097"></a>00097 piR=&<a class="code" href="classenorm.html#82f39ac49911d7097f4bfe385deba355" title="Cache: _iR = inv(R);.">_iR</a>; |
| 81 | <a name="l00098"></a>00098 } |
| 82 | <a name="l00099"></a>00099 |
| 83 | <a name="l00101"></a><a class="code" href="classenorm.html#c9ca4f2ca42568e40ca146168e7f3247">00101</a> <span class="keywordtype">void</span> <a class="code" href="classenorm.html#c9ca4f2ca42568e40ca146168e7f3247" title="set cache as inconsistent">_cached</a> ( <span class="keywordtype">bool</span> what ) {<a class="code" href="classenorm.html#ae12db77283a96e0f14a3eae93dc3bf1" title="indicator if _iR is chached">cached</a>=what;} |
| 84 | <a name="l00102"></a>00102 }; |
| 85 | <a name="l00103"></a>00103 |
| 86 | <a name="l00113"></a><a class="code" href="classegamma.html">00113</a> <span class="keyword">class </span><a class="code" href="classegamma.html" title="Gamma posterior density.">egamma</a> : <span class="keyword">public</span> <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> { |
| 87 | <a name="l00114"></a>00114 <span class="keyword">protected</span>: |
| 88 | <a name="l00115"></a>00115 vec alpha; |
| 89 | <a name="l00116"></a>00116 vec beta; |
| 90 | <a name="l00117"></a>00117 <span class="keyword">public</span> : |
| 91 | <a name="l00119"></a><a class="code" href="classegamma.html#4b1d34f3b244ea51a58ec10c468788c1">00119</a> <a class="code" href="classegamma.html#4b1d34f3b244ea51a58ec10c468788c1" title="Default constructor.">egamma</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv ) :<a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( rv ) {}; |
| 92 | <a name="l00121"></a><a class="code" href="classegamma.html#8e348b89be82b70471fe8c5630f61339">00121</a> <span class="keywordtype">void</span> <a class="code" href="classegamma.html#8e348b89be82b70471fe8c5630f61339" title="Sets parameters.">set_parameters</a> ( <span class="keyword">const</span> vec &a, <span class="keyword">const</span> vec &b ) {alpha=a,beta=b;}; |
| 93 | <a name="l00122"></a>00122 vec <a class="code" href="classegamma.html#0a2186a586432c2c3f22d09c5341890f" title="Returns the required moment of the epdf.">sample</a>(); |
| 94 | <a name="l00123"></a>00123 mat <a class="code" href="classegamma.html#0a2186a586432c2c3f22d09c5341890f" title="Returns the required moment of the epdf.">sample</a> ( <span class="keywordtype">int</span> N ); |
| 95 | <a name="l00124"></a>00124 <span class="keywordtype">double</span> evalpdflog ( <span class="keyword">const</span> vec val ); |
| 96 | <a name="l00126"></a><a class="code" href="classegamma.html#44445c56e60b91b377f207f8d5089790">00126</a> <span class="keywordtype">void</span> <a class="code" href="classegamma.html#44445c56e60b91b377f207f8d5089790" title="Returns poiter to alpha and beta. Potentially dengerous: use with care!">_param</a> ( vec* &a, vec* &b ) {a=&alpha;b=&beta;}; |
| 97 | <a name="l00127"></a><a class="code" href="classegamma.html#6617890ffa40767fc196876534d4119d">00127</a> vec <a class="code" href="classegamma.html#6617890ffa40767fc196876534d4119d" title="return expected value">mean</a>(){vec pom(alpha); pom/=beta; <span class="keywordflow">return</span> pom;} |
| 98 | <a name="l00128"></a>00128 }; |
| 99 | <a name="l00129"></a>00129 |
| 100 | <a name="l00131"></a><a class="code" href="classemix.html">00131</a> <span class="keyword">class </span><a class="code" href="classemix.html" title="Weighted mixture of epdfs with external owned components.">emix</a> : <span class="keyword">public</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> { |
| 101 | <a name="l00132"></a>00132 <span class="keyword">protected</span>: |
| 102 | <a name="l00133"></a>00133 <span class="keywordtype">int</span> n; |
| 103 | <a name="l00134"></a>00134 vec &w; |
| 104 | <a name="l00135"></a>00135 Array<epdf*> Coms; |
| 105 | <a name="l00136"></a>00136 <span class="keyword">public</span>: |
| 106 | <a name="l00138"></a><a class="code" href="classemix.html#b0ac204af8919c22bce72816ed82019e">00138</a> <a class="code" href="classemix.html#b0ac204af8919c22bce72816ed82019e" title="Default constructor.">emix</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv, vec &w0): <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>(rv), n(w0.length()), w(w0), Coms(n) {}; |
| 107 | <a name="l00139"></a>00139 <span class="keywordtype">void</span> set_parameters( <span class="keywordtype">int</span> &i, <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* ep){Coms(i)=ep;} |
| 108 | <a name="l00140"></a><a class="code" href="classemix.html#dcb3f927bf061eac6229850158ca1558">00140</a> vec <a class="code" href="classemix.html#dcb3f927bf061eac6229850158ca1558" title="return expected value">mean</a>(){vec pom; <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i<n;i++){pom+=Coms(i)->mean()*w(i);} <span class="keywordflow">return</span> pom;}; |
| 109 | <a name="l00141"></a><a class="code" href="classemix.html#3eb9a8e12ce1c5c8a3ddb245354b6941">00141</a> vec <a class="code" href="classemix.html#3eb9a8e12ce1c5c8a3ddb245354b6941" title="Returns the required moment of the epdf.">sample</a>() {it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0;} |
| 110 | <a name="l00142"></a>00142 }; |
| 111 | <a name="l00143"></a>00143 |
| 112 | <a name="l00145"></a>00145 |
| 113 | <a name="l00146"></a><a class="code" href="classeuni.html">00146</a> <span class="keyword">class </span><a class="code" href="classeuni.html" title="Uniform distributed density on a rectangular support.">euni</a>: <span class="keyword">public</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> { |
| 114 | <a name="l00147"></a>00147 <span class="keyword">protected</span>: |
| 115 | <a name="l00149"></a><a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1">00149</a> vec <a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1" title="lower bound on support">low</a>; |
| 116 | <a name="l00151"></a><a class="code" href="classeuni.html#71b6d6b41aeb61a7f76f682b72119231">00151</a> vec <a class="code" href="classeuni.html#71b6d6b41aeb61a7f76f682b72119231" title="upper bound on support">high</a>; |
| 117 | <a name="l00153"></a><a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4">00153</a> vec <a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a>; |
| 118 | <a name="l00155"></a><a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda">00155</a> <span class="keywordtype">double</span> <a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda" title="normalizing coefficients">nk</a>,lnk; |
| 119 | <a name="l00156"></a>00156 <span class="keyword">public</span>: |
| 120 | <a name="l00157"></a>00157 <a class="code" href="classeuni.html" title="Uniform distributed density on a rectangular support.">euni</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv ) :<a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( rv ) {} |
| 121 | <a name="l00158"></a><a class="code" href="classeuni.html#95f29237feb32fcadf570a181d5a0918">00158</a> <span class="keywordtype">double</span> <a class="code" href="classeuni.html#95f29237feb32fcadf570a181d5a0918" title="Compute probability of argument val.">eval</a> ( <span class="keyword">const</span> vec &val ) {<span class="keywordflow">return</span> <a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda" title="normalizing coefficients">nk</a>;} |
| 122 | <a name="l00159"></a><a class="code" href="classeuni.html#830fca2ffb6786530529c57eabc81666">00159</a> <span class="keywordtype">double</span> <a class="code" href="classeuni.html#830fca2ffb6786530529c57eabc81666" title="Compute log-probability of argument val.">evalpdflog</a> ( <span class="keyword">const</span> vec &val ) {<span class="keywordflow">return</span> lnk;} |
| 123 | <a name="l00160"></a><a class="code" href="classeuni.html#0f71562e3e919aba823cb7d9d420ad4c">00160</a> vec <a class="code" href="classeuni.html#0f71562e3e919aba823cb7d9d420ad4c" title="Returns the required moment of the epdf.">sample</a>() { |
| 124 | <a name="l00161"></a>00161 vec smp ( rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>() ); UniRNG.sample_vector ( rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return length (number of scalars) of the RV.">count</a>(),smp ); |
| 125 | <a name="l00162"></a>00162 <span class="keywordflow">return</span> <a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1" title="lower bound on support">low</a>+<a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a>*smp; |
| 126 | <a name="l00163"></a>00163 } |
| 127 | <a name="l00164"></a>00164 <span class="keywordtype">void</span> set_parameters ( <span class="keyword">const</span> vec &low0, <span class="keyword">const</span> vec &high0 ) { |
| 128 | <a name="l00165"></a>00165 <a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a> = high0-low0; |
| 129 | <a name="l00166"></a>00166 it_assert_debug ( min ( <a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a> ) >0.0,<span class="stringliteral">"bad support"</span> ); |
| 130 | <a name="l00167"></a>00167 <a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1" title="lower bound on support">low</a> = low0; |
| 131 | <a name="l00168"></a>00168 <a class="code" href="classeuni.html#71b6d6b41aeb61a7f76f682b72119231" title="upper bound on support">high</a> = high0; |
| 132 | <a name="l00169"></a>00169 <a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda" title="normalizing coefficients">nk</a> = prod ( 1.0/<a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a> ); |
| 133 | <a name="l00170"></a>00170 lnk = log ( <a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda" title="normalizing coefficients">nk</a> ); |
| 134 | <a name="l00171"></a>00171 } |
| 135 | <a name="l00172"></a><a class="code" href="classeuni.html#34a2f2d23158c40b97b44dfe551a1b3d">00172</a> vec <a class="code" href="classeuni.html#34a2f2d23158c40b97b44dfe551a1b3d" title="return expected value">mean</a>(){vec pom=<a class="code" href="classeuni.html#71b6d6b41aeb61a7f76f682b72119231" title="upper bound on support">high</a>; pom-=<a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1" title="lower bound on support">low</a>; pom/=2.0; <span class="keywordflow">return</span> pom;} |
| 136 | <a name="l00173"></a>00173 }; |
| 137 | <a name="l00174"></a>00174 |
| 138 | <a name="l00175"></a>00175 |
| 139 | <a name="l00181"></a>00181 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 140 | <a name="l00182"></a><a class="code" href="classmlnorm.html">00182</a> <span class="keyword">class </span><a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm</a> : <span class="keyword">public</span> mEF { |
| 141 | <a name="l00183"></a>00183 <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<sq_T></a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>; |
| 142 | <a name="l00184"></a>00184 vec* _mu; <span class="comment">//cached epdf.mu;</span> |
| 143 | <a name="l00185"></a>00185 mat A; |
| 144 | <a name="l00186"></a>00186 <span class="keyword">public</span>: |
| 145 | <a name="l00188"></a>00188 <a class="code" href="classmlnorm.html#f927203b3f31171c5c10ffc7caa797f5" title="Constructor.">mlnorm</a> ( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv,<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc ); |
| 146 | <a name="l00189"></a>00189 <span class="keywordtype">void</span> set_parameters ( <span class="keyword">const</span> mat &A, <span class="keyword">const</span> sq_T &R ); |
| 147 | <a name="l00191"></a>00191 vec <a class="code" href="classmlnorm.html#decf3e3b5c8e0812e5b4dbe94fa2ae18" title="Generate one sample of the posterior.">samplecond</a> ( vec &cond, <span class="keywordtype">double</span> &lik ); |
| 148 | <a name="l00193"></a>00193 mat <a class="code" href="classmlnorm.html#decf3e3b5c8e0812e5b4dbe94fa2ae18" title="Generate one sample of the posterior.">samplecond</a> ( vec &cond, vec &lik, <span class="keywordtype">int</span> n ); |
| 149 | <a name="l00194"></a>00194 <span class="keywordtype">void</span> condition ( vec &cond ); |
| 150 | <a name="l00195"></a>00195 }; |
| 151 | <a name="l00196"></a>00196 |
| 152 | <a name="l00206"></a><a class="code" href="classmgamma.html">00206</a> <span class="keyword">class </span><a class="code" href="classmgamma.html" title="Gamma random walk.">mgamma</a> : <span class="keyword">public</span> mEF { |
| 153 | <a name="l00207"></a>00207 <a class="code" href="classegamma.html" title="Gamma posterior density.">egamma</a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>; |
| 154 | <a name="l00208"></a>00208 <span class="keywordtype">double</span> k; |
| 155 | <a name="l00209"></a>00209 vec* _beta; |
| 156 | <a name="l00210"></a>00210 |
| 157 | <a name="l00211"></a>00211 <span class="keyword">public</span>: |
| 158 | <a name="l00213"></a>00213 <a class="code" href="classmgamma.html#af43e61b86900c0398d5c0ffc83b94e6" title="Constructor.">mgamma</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv,<span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc ); |
| 159 | <a name="l00214"></a>00214 <span class="keywordtype">void</span> set_parameters ( <span class="keywordtype">double</span> k ); |
| 160 | <a name="l00216"></a>00216 vec <a class="code" href="classmgamma.html#9f40dc43885085fad8e3d6652b79e139" title="Generate one sample of the posterior.">samplecond</a> ( vec &cond, <span class="keywordtype">double</span> &lik ); |
| 161 | <a name="l00218"></a>00218 mat <a class="code" href="classmgamma.html#9f40dc43885085fad8e3d6652b79e139" title="Generate one sample of the posterior.">samplecond</a> ( vec &cond, vec &lik, <span class="keywordtype">int</span> n ); |
| 162 | <a name="l00219"></a>00219 <span class="keywordtype">void</span> condition ( <span class="keyword">const</span> vec &val ) {*_beta=k/val;}; |
| 163 | <a name="l00220"></a>00220 }; |
| 164 | <a name="l00221"></a>00221 |
| 165 | <a name="l00223"></a><a class="code" href="libEF_8h.html#99497a3ff630f761cf6bff7babd23212">00223</a> <span class="keyword">enum</span> <a class="code" href="libEF_8h.html#99497a3ff630f761cf6bff7babd23212" title="Switch between various resampling methods.">RESAMPLING_METHOD</a> { MULTINOMIAL = 0, STRATIFIED = 1, SYSTEMATIC = 3 }; |
| 166 | <a name="l00229"></a><a class="code" href="classeEmp.html">00229</a> <span class="keyword">class </span><a class="code" href="classeEmp.html" title="Weighted empirical density.">eEmp</a>: <span class="keyword">public</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> { |
| 167 | <a name="l00230"></a>00230 <span class="keyword">protected</span> : |
| 168 | <a name="l00232"></a><a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd">00232</a> <span class="keywordtype">int</span> <a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd" title="Number of particles.">n</a>; |
| 169 | <a name="l00233"></a>00233 vec w; |
| 170 | <a name="l00234"></a>00234 Array<vec> samples; |
| 171 | <a name="l00235"></a>00235 <span class="keyword">public</span>: |
| 172 | <a name="l00236"></a>00236 <a class="code" href="classeEmp.html" title="Weighted empirical density.">eEmp</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv0 ) :<a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( rv0 ) {}; |
| 173 | <a name="l00237"></a>00237 <span class="keywordtype">void</span> set_parameters ( <span class="keyword">const</span> vec &w0, <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* pdf0 ); |
| 174 | <a name="l00239"></a><a class="code" href="classeEmp.html#31b2bfb73b72486a5c89f2ab850c7a9b">00239</a> vec& <a class="code" href="classeEmp.html#31b2bfb73b72486a5c89f2ab850c7a9b" title="Potentially dangerous, use with care.">_w</a>() {<span class="keywordflow">return</span> w;}; |
| 175 | <a name="l00240"></a>00240 Array<vec>& _samples() {<span class="keywordflow">return</span> samples;}; |
| 176 | <a name="l00242"></a>00242 ivec <a class="code" href="classeEmp.html#77268292fc4465cb73ddbfb1f2932a59" title="Function performs resampling, i.e. removal of low-weight samples and duplication...">resample</a> ( <a class="code" href="libEF_8h.html#99497a3ff630f761cf6bff7babd23212" title="Switch between various resampling methods.">RESAMPLING_METHOD</a> method = SYSTEMATIC ); |
| 177 | <a name="l00243"></a><a class="code" href="classeEmp.html#c9b44099a400579b88aff9f5afaf9c13">00243</a> vec <a class="code" href="classeEmp.html#c9b44099a400579b88aff9f5afaf9c13" title="Returns the required moment of the epdf.">sample</a>() {it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0;} |
| 178 | <a name="l00244"></a><a class="code" href="classeEmp.html#de42454cb65a17fd8662d207dd59aacf">00244</a> vec <a class="code" href="classeEmp.html#de42454cb65a17fd8662d207dd59aacf" title="return expected value">mean</a>(){vec pom; |
| 179 | <a name="l00245"></a>00245 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0;i<<a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd" title="Number of particles.">n</a>;i++){pom+=samples(i)*w(i);} |
| 180 | <a name="l00246"></a>00246 <span class="keywordflow">return</span> pom; |
| 181 | <a name="l00247"></a>00247 } |
| 182 | <a name="l00248"></a>00248 }; |
| 183 | <a name="l00249"></a>00249 |
| 184 | <a name="l00250"></a>00250 |
| 185 | <a name="l00252"></a>00252 |
| 186 | <a name="l00253"></a>00253 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 187 | <a name="l00254"></a>00254 <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<sq_T>::enorm</a> ( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv ) :<a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a>(), mu ( rv.count() ),R ( rv.count() ),_iR ( rv.count() ),cached ( false ),dim ( rv.count() ) {}; |
| 188 | <a name="l00255"></a>00255 |
| 189 | <a name="l00256"></a>00256 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 190 | <a name="l00257"></a>00257 <span class="keywordtype">void</span> <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<sq_T>::set_parameters</a> ( <span class="keyword">const</span> vec &mu0, <span class="keyword">const</span> sq_T &R0 ) { |
| 191 | <a name="l00258"></a>00258 <span class="comment">//Fixme test dimensions of mu0 and R0;</span> |
| 192 | <a name="l00259"></a>00259 mu = mu0; |
| 193 | <a name="l00260"></a>00260 R = R0; |
| 194 | <a name="l00261"></a>00261 <span class="keywordflow">if</span> ( _iR.rows() !=R.rows() ) _iR=R; <span class="comment">// memory allocation!</span> |
| 195 | <a name="l00262"></a>00262 R.inv ( _iR ); <span class="comment">//update cache</span> |
| 196 | <a name="l00263"></a>00263 cached=<span class="keyword">true</span>; |
| 197 | <a name="l00264"></a>00264 }; |
| 198 | <a name="l00265"></a>00265 |
| 199 | <a name="l00266"></a>00266 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 200 | <a name="l00267"></a>00267 <span class="keywordtype">void</span> <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<sq_T>::dupdate</a> ( mat &v, <span class="keywordtype">double</span> nu ) { |
| 201 | <a name="l00268"></a>00268 <span class="comment">//</span> |
| 202 | <a name="l00269"></a>00269 }; |
| 203 | <a name="l00270"></a>00270 |
| 204 | <a name="l00271"></a>00271 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 205 | <a name="l00272"></a><a class="code" href="classenorm.html#5b5fd142b6b17ea334597960e3fe126a">00272</a> <span class="keywordtype">void</span> <a class="code" href="classenorm.html#5b5fd142b6b17ea334597960e3fe126a" title="tupdate in exponential form (not really handy)">enorm<sq_T>::tupdate</a> ( <span class="keywordtype">double</span> phi, mat &vbar, <span class="keywordtype">double</span> nubar ) { |
| 206 | <a name="l00273"></a>00273 <span class="comment">//</span> |
| 207 | <a name="l00274"></a>00274 }; |
| 208 | <a name="l00275"></a>00275 |
| 209 | <a name="l00276"></a>00276 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 210 | <a name="l00277"></a><a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023">00277</a> vec <a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023" title="Returns the required moment of the epdf.">enorm<sq_T>::sample</a>() { |
| 211 | <a name="l00278"></a>00278 vec x ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a> ); |
| 212 | <a name="l00279"></a>00279 NorRNG.sample_vector ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a>,x ); |
| 213 | <a name="l00280"></a>00280 vec smp = <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.sqrt_mult ( x ); |
| 214 | <a name="l00281"></a>00281 |
| 215 | <a name="l00282"></a>00282 smp += <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a>; |
| 216 | <a name="l00283"></a>00283 <span class="keywordflow">return</span> smp; |
| 217 | <a name="l00284"></a>00284 }; |
| 218 | <a name="l00285"></a>00285 |
| 219 | <a name="l00286"></a>00286 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 220 | <a name="l00287"></a>00287 mat <a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023" title="Returns the required moment of the epdf.">enorm<sq_T>::sample</a> ( <span class="keywordtype">int</span> N ) { |
| 221 | <a name="l00288"></a>00288 mat X ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a>,N ); |
| 222 | <a name="l00289"></a>00289 vec x ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a> ); |
| 223 | <a name="l00290"></a>00290 vec pom; |
| 224 | <a name="l00291"></a>00291 <span class="keywordtype">int</span> i; |
| 225 | <a name="l00292"></a>00292 |
| 226 | <a name="l00293"></a>00293 <span class="keywordflow">for</span> ( i=0;i<N;i++ ) { |
| 227 | <a name="l00294"></a>00294 NorRNG.sample_vector ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a>,x ); |
| 228 | <a name="l00295"></a>00295 pom = <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.sqrt_mult ( x ); |
| 229 | <a name="l00296"></a>00296 pom +=<a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a>; |
| 230 | <a name="l00297"></a>00297 X.set_col ( i, pom ); |
| 231 | <a name="l00298"></a>00298 } |
| 232 | <a name="l00299"></a>00299 |
| 233 | <a name="l00300"></a>00300 <span class="keywordflow">return</span> X; |
| 234 | <a name="l00301"></a>00301 }; |
| 235 | <a name="l00302"></a>00302 |
| 236 | <a name="l00303"></a>00303 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 237 | <a name="l00304"></a><a class="code" href="classenorm.html#93107f05a8e9b34b64853767200121a4">00304</a> <span class="keywordtype">double</span> <a class="code" href="classenorm.html#93107f05a8e9b34b64853767200121a4" title="Compute probability of argument val.">enorm<sq_T>::eval</a> ( <span class="keyword">const</span> vec &val ) { |
| 238 | <a name="l00305"></a>00305 <span class="keywordtype">double</span> pdfl,e; |
| 239 | <a name="l00306"></a>00306 pdfl = <a class="code" href="classenorm.html#9517594915e897584eaebbb057ed8881" title="Compute log-probability of argument val.">evalpdflog</a> ( val ); |
| 240 | <a name="l00307"></a>00307 e = exp ( pdfl ); |
| 241 | <a name="l00308"></a>00308 <span class="keywordflow">return</span> e; |
| 242 | <a name="l00309"></a>00309 }; |
| 243 | <a name="l00310"></a>00310 |
| 244 | <a name="l00311"></a>00311 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 245 | <a name="l00312"></a><a class="code" href="classenorm.html#9517594915e897584eaebbb057ed8881">00312</a> <span class="keywordtype">double</span> <a class="code" href="classenorm.html#9517594915e897584eaebbb057ed8881" title="Compute log-probability of argument val.">enorm<sq_T>::evalpdflog</a> ( <span class="keyword">const</span> vec &val ) { |
| 246 | <a name="l00313"></a>00313 <span class="keywordflow">if</span> ( !<a class="code" href="classenorm.html#ae12db77283a96e0f14a3eae93dc3bf1" title="indicator if _iR is chached">cached</a> ) {<a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.inv ( <a class="code" href="classenorm.html#82f39ac49911d7097f4bfe385deba355" title="Cache: _iR = inv(R);.">_iR</a> );<a class="code" href="classenorm.html#ae12db77283a96e0f14a3eae93dc3bf1" title="indicator if _iR is chached">cached</a>=<span class="keyword">true</span>;} |
| 247 | <a name="l00314"></a>00314 |
| 248 | <a name="l00315"></a>00315 <span class="keywordflow">return</span> -0.5* ( <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.cols() *0.79817986835811504957 +<a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.logdet() +<a class="code" href="classenorm.html#82f39ac49911d7097f4bfe385deba355" title="Cache: _iR = inv(R);.">_iR</a>.qform ( <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a>-val ) ); |
| 249 | <a name="l00316"></a>00316 }; |
| 250 | <a name="l00317"></a>00317 |
| 251 | <a name="l00318"></a>00318 |
| 252 | <a name="l00319"></a>00319 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 253 | <a name="l00320"></a><a class="code" href="classmlnorm.html#f927203b3f31171c5c10ffc7caa797f5">00320</a> <a class="code" href="classmlnorm.html#f927203b3f31171c5c10ffc7caa797f5" title="Constructor.">mlnorm<sq_T>::mlnorm</a> ( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rv0,<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &rvc0 ) :mEF ( rv0,rvc0 ),<a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( rv ),A ( rv0.count(),rv0.count() ) { |
| 254 | <a name="l00321"></a>00321 _mu = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>._mu(); |
| 255 | <a name="l00322"></a>00322 } |
| 256 | <a name="l00323"></a>00323 |
| 257 | <a name="l00324"></a>00324 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 258 | <a name="l00325"></a>00325 <span class="keywordtype">void</span> <a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm<sq_T>::set_parameters</a> ( <span class="keyword">const</span> mat &A0, <span class="keyword">const</span> sq_T &R0 ) { |
| 259 | <a name="l00326"></a>00326 <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.set_parameters ( zeros ( rv.count() ),R0 ); |
| 260 | <a name="l00327"></a>00327 A = A0; |
| 261 | <a name="l00328"></a>00328 } |
| 262 | <a name="l00329"></a>00329 |
| 263 | <a name="l00330"></a>00330 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 264 | <a name="l00331"></a><a class="code" href="classmlnorm.html#decf3e3b5c8e0812e5b4dbe94fa2ae18">00331</a> vec <a class="code" href="classmlnorm.html#decf3e3b5c8e0812e5b4dbe94fa2ae18" title="Generate one sample of the posterior.">mlnorm<sq_T>::samplecond</a> ( vec &cond, <span class="keywordtype">double</span> &lik ) { |
| 265 | <a name="l00332"></a>00332 this->condition ( cond ); |
| 266 | <a name="l00333"></a>00333 vec smp = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.sample(); |
| 267 | <a name="l00334"></a>00334 lik = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.eval ( smp ); |
| 268 | <a name="l00335"></a>00335 <span class="keywordflow">return</span> smp; |
| 269 | <a name="l00336"></a>00336 } |
| 270 | <a name="l00337"></a>00337 |
| 271 | <a name="l00338"></a>00338 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 272 | <a name="l00339"></a><a class="code" href="classmlnorm.html#215fb88cc8b95d64cdefd6849abdd1e8">00339</a> mat <a class="code" href="classmlnorm.html#decf3e3b5c8e0812e5b4dbe94fa2ae18" title="Generate one sample of the posterior.">mlnorm<sq_T>::samplecond</a> ( vec &cond, vec &lik, <span class="keywordtype">int</span> n ) { |
| 273 | <a name="l00340"></a>00340 <span class="keywordtype">int</span> i; |
| 274 | <a name="l00341"></a>00341 <span class="keywordtype">int</span> dim = rv.count(); |
| 275 | <a name="l00342"></a>00342 mat Smp ( dim,n ); |
| 276 | <a name="l00343"></a>00343 vec smp ( dim ); |
| 277 | <a name="l00344"></a>00344 this->condition ( cond ); |
| 278 | <a name="l00345"></a>00345 |
| 279 | <a name="l00346"></a>00346 <span class="keywordflow">for</span> ( i=0; i<n; i++ ) { |
| 280 | <a name="l00347"></a>00347 smp = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.sample(); |
| 281 | <a name="l00348"></a>00348 lik ( i ) = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.eval ( smp ); |
| 282 | <a name="l00349"></a>00349 Smp.set_col ( i ,smp ); |
| 283 | <a name="l00350"></a>00350 } |
| 284 | <a name="l00351"></a>00351 |
| 285 | <a name="l00352"></a>00352 <span class="keywordflow">return</span> Smp; |
| 286 | <a name="l00353"></a>00353 } |
| 287 | <a name="l00354"></a>00354 |
| 288 | <a name="l00355"></a>00355 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 289 | <a name="l00356"></a>00356 <span class="keywordtype">void</span> <a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm<sq_T>::condition</a> ( vec &cond ) { |
| 290 | <a name="l00357"></a>00357 *_mu = A*cond; |
| 291 | <a name="l00358"></a>00358 <span class="comment">//R is already assigned;</span> |
| 292 | <a name="l00359"></a>00359 } |
| 293 | <a name="l00360"></a>00360 |
| 294 | <a name="l00362"></a>00362 |
| 295 | <a name="l00363"></a>00363 |
| 296 | <a name="l00364"></a>00364 <span class="preprocessor">#endif //EF_H</span> |
| 297 | </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Thu Feb 28 16:54:40 2008 for mixpp by |