Hi rcpp-devel!<br>First of all thank you for this awesome tool!<br><br>I started a few days ago coding with Rcpp to try to reduce the computing time of a MCMC model.<br>However, I don&#39;t have experience with C/C++ and I can&#39;t figure out how to reaffect a new content to a variable.<br>
This seems probably very simple to you but I can&#39;t figure it out, and this is the last step preventing my code to work out I think...<br>The objects all_ui, all_ui2, all_ui3, all_rd and all_corMat are list objects containing matrix<br>
But once a matrice extracted from one of those lists is affected, to let say the object ui I can&#39;t affect the next matrix to ui at the next iteration.<br>I tried to find a way to eliminate the object at each iteration or to empty it using .reset but without success.<br>
<br>So any help would be very much appreciated!<br>(fragment of code posted below)<br><br>arma::mat tmp;<br>arma::mat tmp2;<br>arma::mat tmp3;<br>arma::mat ui;<br>arma::mat ui2;<br>arma::mat ui3;<br>arma::mat sigma;  <br>
<br>for (int j = 0; j &lt; P-1; j++) {<br>tmp2.fill(0);<br>tmp3.fill(0);<br> for (int i = 0; i &lt; N-1; i++) {<br> ui = all_ui[i];<br>ui2 = all_ui2[i];<br> ui3 = all_ui3[i];<br>rdi = all_rd[i];<br>all_corMati = all_corMat[i];<br>
 sigma = sigma2*all_corMat[i];<br>// calculate mean and variance<br>arma::mat tmp = (solve(sig%all_corMat[i])* gen_a(i,j))*all_ui[i];<br>arma::mat tmp2 += (all_rd[i] - mu*trans(all_ui3[i])-(X(i)*alpha)*trans(all_ui2[i]) + gen_a(i,j)*a.row(j)*trans(all_ui[i]))*tmp; <br>
arma::mat tmp3 += (gen_a(i,j)*trans(all_ui[i]))*tmp; <br>}<br>}<br><br>Thank you for your help<br><br>It probably does not help much<br>but I use R2.13 with the last version of the packages on a windows XP plateform<br><br>
Nicolas <br><br>