Re: [Rcpp-devel] Distribution functions threadsafe in RcppParallel?

2018-04-16 Thread Murray Efford
Thanks for all these good suggestions. StatsLib as suggested by Yixuan seems especially straightforward. I may yet find that dpois and dbinom from R are threadsafe. Murray On Tue, Apr 17, 2018 at 5:34 AM, Balamuta, James Joseph < balam...@illinois.edu> wrote: > Greetings and Salutations, > > > >

Re: [Rcpp-devel] using an unloaded package's lazy-load data in Rcpp function

2018-04-16 Thread Kevin Ushey
Sorry, you're correct -- lazy-loaded data gets extracted not from the package namespace but from the 'lazydata' portion of the namespace info. Ultimately, I think you'll just want to call back to R to get what you want, e.g. getExportedValue("nycflights13", "flights") On Mon, Apr 16, 2018 at

Re: [Rcpp-devel] using an unloaded package's lazy-load data in Rcpp function

2018-04-16 Thread Jack Wasey
Thanks for the reply. The solution of requiring the namespace from within Rcpp hadn't occurred to me. I had used Environment::namespace_env("pkg_name") before, but I think the problem here is that lazy-loaded (and maybe other elements we expect in R) are not available if this is done from Rcpp.

Re: [Rcpp-devel] Distribution functions threadsafe in RcppParallel?

2018-04-16 Thread Balamuta, James Joseph
Greetings and Salutations, There is also the boost header libraries that you can use: https://www.boost.org/doc/libs/1_67_0/doc/html/boost_random.html Gallery example: http://gallery.rcpp.org/articles/timing-normal-rngs/ If you need parallel draws, see the sitmo engine: https://github.com/coa

Re: [Rcpp-devel] Distribution functions threadsafe in RcppParallel?

2018-04-16 Thread Yixuan Qiu
For your information, here is a header-only library for distribution functions: https://github.com/kthohr/stats The API seems to be designed to mimic the R API. Best, Yixuan 2018-04-15 23:56 GMT-04:00 Murray Efford : > Thanks. This is all happening inside a package for CRAN, so I would rather

Re: [Rcpp-devel] Distribution functions threadsafe in RcppParallel?

2018-04-16 Thread JJ Allaire
Here it's recommended that you simply read the source code to figure out if memory allocations or stack checking are done: https://rcppcore.github.io/RcppParallel/#api_restrictions On Sun, Apr 15, 2018 at 11:56 PM, Murray Efford wrote: > Thanks. This is all happening inside a package for CRAN, s