I'm not giving up yet. I'll implement the distribution that is missing, and send you the example if you lay out your model w/ pseudocode.
-Whit On Wed, Jun 15, 2011 at 7:59 PM, Nicolas Heslot <[email protected]> wrote: > Hi, > > Thank you for your quick answer. > Sorry that I did not explain well enought my issue. > I did not know about cppbugs but I just checked and it does not seem that I > can use it for my model because it lacks some of the distribution I need. > The fraction of code could seems obscure but it is just the updating for a > block of parameters in the model. > My problem is rather simple I think. > Once I affect a matrix to a variable I can't manage to overwrite the content > of that variable with a different matrix. I really can't figure out how to > do it. > > Nicolas > > On Wed, Jun 15, 2011 at 7:52 PM, Dirk Eddelbuettel <[email protected]> wrote: >> >> Salut Nicolas, >> >> On 15 June 2011 at 17:03, Nicolas Heslot wrote: >> | Hi rcpp-devel! >> | First of all thank you for this awesome tool! >> >> Pleasure, and welcome. >> >> | I started a few days ago coding with Rcpp to try to reduce the computing >> time >> | of a MCMC model. >> | However, I don't have experience with C/C++ and I can't figure out how >> to >> | reaffect a new content to a variable. >> | This seems probably very simple to you but I can't figure it out, and >> this is >> | the last step preventing my code to work out I think... >> | The objects all_ui, all_ui2, all_ui3, all_rd and all_corMat are list >> objects >> | containing matrix >> | But once a matrice extracted from one of those lists is affected, to let >> say >> | the object ui I can't affect the next matrix to ui at the next >> iteration. >> | I tried to find a way to eliminate the object at each iteration or to >> empty it >> | using .reset but without success. >> | >> | So any help would be very much appreciated! >> | (fragment of code posted below) >> | >> | arma::mat tmp; >> | arma::mat tmp2; >> | arma::mat tmp3; >> | arma::mat ui; >> | arma::mat ui2; >> | arma::mat ui3; >> | arma::mat sigma; >> | >> | for (int j = 0; j < P-1; j++) { >> | tmp2.fill(0); >> | tmp3.fill(0); >> | for (int i = 0; i < N-1; i++) { >> | ui = all_ui[i]; >> | ui2 = all_ui2[i]; >> | ui3 = all_ui3[i]; >> | rdi = all_rd[i]; >> | all_corMati = all_corMat[i]; >> | sigma = sigma2*all_corMat[i]; >> | // calculate mean and variance >> | arma::mat tmp = (solve(sig%all_corMat[i])* gen_a(i,j))*all_ui[i]; >> | 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; >> | arma::mat tmp3 += (gen_a(i,j)*trans(all_ui[i]))*tmp; >> | } >> | } >> | >> | Thank you for your help >> >> I'm with Whit here and confess that I do not know your question is. If you >> show us what you tried, what you expected to happen and what actually >> happened we may help. >> >> (By the way, there is no tax on indentation in code and it does make it >> more >> readable for those of us who didn't write it ;-) >> >> Dirk >> >> | It probably does not help much >> | but I use R2.13 with the last version of the packages on a windows XP >> plateform >> | >> | Nicolas >> | >> | >> | ---------------------------------------------------------------------- >> | _______________________________________________ >> | Rcpp-devel mailing list >> | [email protected] >> | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel >> >> -- >> Gauss once played himself in a zero-sum game and won $50. >> -- #11 at http://www.gaussfacts.com > > > _______________________________________________ > Rcpp-devel mailing list > [email protected] > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > > _______________________________________________ Rcpp-devel mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
