Re: [Rcpp-devel] Rcpp bug with rgamma

2010-10-04 Thread Romain Francois
Le 03/10/10 23:29, Dirk Eddelbuettel a écrit : Colin, Just as one last comment, the issue at hand is described in Section 6.3 of Writing R Extensions: 6.3 Random number generation The interface to R's internal random number generation routines is

Re: [Rcpp-devel] Rcpp bug with rgamma

2010-10-03 Thread Dirk Eddelbuettel
Colin, Just as one last comment, the issue at hand is described in Section 6.3 of Writing R Extensions: 6.3 Random number generation The interface to R's internal random number generation routines is double unif_rand(); double norm_ra

Re: [Rcpp-devel] Rcpp bug with rgamma

2010-10-03 Thread Dirk Eddelbuettel
Colin, The problem goes away as soon as you set the seeds to the RNGs: e...@max:/tmp$ cat colin.r library(Rcpp) library(inline) set.seed(42) # this makes all the difference foo <- "return(Rcpp::wrap(rgamma(3,1,1)));" fun <- cxxfunction(signature(), foo, plugin = "Rcpp")

Re: [Rcpp-devel] Rcpp bug with rgamma

2010-10-03 Thread Dirk Eddelbuettel
A standalone program linked against libRmath (the R stats functions compiled into their own library) works: #define MATHLIB_STANDALONE 1 #include int main(int argc, char** argv) { int i; set_seed(123, 456); for (i=0; i<10; i++) { printf(" %d rgamma(1,1) %f\n", i, rgamma(1,1)

Re: [Rcpp-devel] Rcpp bug with rgamma

2010-10-03 Thread Dirk Eddelbuettel
On 2 October 2010 at 22:17, Colin Rundel wrote: | I am working on a project using RcppArmadillo and I've run into an issue with the rgamma function in Rcpp. When calling rgamma the function pegs R's cpu utilization and the process continues to churn forcing me to kill it. I've let things run fo