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 for around 5 mins with no end in sight.
|
| I can replicate the problem with the following code:
|
| library(Rcpp)
| library(inline)
|
| foo = "return(rgamma(1,1,1));"
| cxxfunction(signature(), foo, plugin = "Rcpp" )()
I can confirm this on Ubuntu 10.04.
The code for rgamma is pretty simple -- if all args are well we call R's
rgamma n time with argument a and scale:
return NumericVector( n, ::Rf_rgamma, a, scale ) ;
Changing your test program to
foo <- "return(Rcpp::wrap(Rf_rgamma(1,1)));"
so that it calls the function directly also goes astray. There must now be
something we define or set that sends the R engine over the edge here.
I'll try to take another peak. Thanks for the bug report!
Dirk
| Other r* functions seem to work with out issue (ie rnorm, rbeta, etc).
|
| I am using of Rcpp 0.86 on OSX with R 2.11.1. I have not taken the time to
look at the Rcpp code to see what the issue might be, but hopefully this is
something that is an easy fix.
|
| -Colin
|
|
| _______________________________________________
| Rcpp-devel mailing list
| [email protected]
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel