Re: [Rcpp-devel] Best Practice for Optimize Functions in RCPP

2015-01-02 Thread Mark Clements
Alternatively, one could use the code for Brent_fmin() from the stats library (e.g. https://github.com/lgautier/R-3-0-branch-alt/blob/master/src/library/stats/src/optimize.c). I have done this for the rstpm2 library (https://github.com/mclements/rstpm2/blob/develop/src/c_optim.cpp). This does use

Re: [Rcpp-devel] Parallel random numbers using Rcpp and OpenMP

2014-04-30 Thread Mark Clements
My two cents worth: For the microsimulation package, we needed uniform random number streams and sub-streams at the C++ level, while supporting R's non-uniform random number distributions[*]. For this, we used the C++ RngStreams library and provided "double *user_unif_rand ()" for user-defined RNG

Re: [Rcpp-devel] Please help! A list containing dataframe

2013-09-27 Thread Mark Clements
This can be done more generally. Following an earlier suggestion from Romain, we can use boost::tuple from the BH package - for a row of fixed size with general types. Then we can use a template to read in the data-frame and work with the set of rows. Variadic templates would be nice here, rat

[Rcpp-devel] Using data-frames as sets of rows (e.g. using R data-frames as lookup tables in C++)

2013-09-06 Thread Mark Clements
By my understanding, Rcpp is better suited to working with data-frames as columns rather than working with data-frames as a set of rows. However, occasionally it may be useful to work with the set of rows. How have others considered this use case? [As a motivating example based on simulations i