Simon,

On 3 March 2013 at 11:52, Simon Zehnder wrote:
| Hi Dirk,
| 
| I recognized the function rnorm in Rcpp. But as I work most times with 
RcppArmadillo and Armadillo objects I wanted to avoid constructing 
NumericMatrix objects, fill them and convert them to arma::mat objects. Instead 
I decided to immediately generate arma::mat objects and fill them - which was 
impossible without a loop when using a controlled random number generation (for 
instance with the possibility to set the seed).

You need just two lines (one to call rnorm, and one use the result to
instantiate an arma mat using the constructor using the same memory). No
loop. One call to the RNG.
 
| I would like to ask something connected to the new feature:
| The C++ standard library (random) uses specific functions for random number 
generation (for example std::gamma_distribution) , that are only available when 
using a compiler supporting the C++11 standard. As far as I know R uses C++99. 
So in a package these functions would be useless when redistribution should be 
made possible. Do you know about some comments by the R core team regarding the 
C++11 standard? Does it come soon?
 
R being a C project, there aren't any strong C++ advocates on the R Core
team though some (like Duncan Murdoch) use it.  The main blocker is CRAN
which is not very forthcoming in communications, and it seems to be one (very
prominent) CRAN maintainer and R Core member in particular...

Dirk

-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com  
_______________________________________________
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

Reply via email to