Amina and I continued the conversation off list, but for closure purposes, the "multiple" version was tweaked a bit as there was comparison between signed and unsigned ints which did not throw an error for me, but did for Amina. Final multiple version posted below.
Thanks, Avi #include <RcppArmadillo.h> using namespace Rcpp; using namespace RcppArmadillo; using namespace arma; //[[Rcpp::depends(RcppArmadillo)]] //[[Rcpp::export]] vec Sample_Exp_Multi(size_t n, vec alpha, vec beta) { size_t m = alpha.size(); vec answers(n); uvec2 S; for (size_t i = 0; i < n; ++i){ do { S = randi<uvec>(2, distr_param(0, m - 1)); } while (S(0) == S(1)); answers(i) = exp(alpha(S(0)) + beta(S(1))); } return(answers); }
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel