Re: [Rcpp-devel] clarification of interaction between RInside and RcppEigen

2012-08-08 Thread Dirk Eddelbuettel
On 7 August 2012 at 14:43, Stephen J. Barr wrote: | Thanks for the pointer to sugar.  | | I was just trying to think of a simple example. So my C++ code will be | essentially: | | int main() { | |     RInside R(argc, argv);          // create an embedded R instance  |     R.parseEval("X = gener

Re: [Rcpp-devel] clarification of interaction between RInside and RcppEigen

2012-08-08 Thread Dirk Eddelbuettel
Also note that "just" getting random numbers is taken care of via Rcpp sugar which wraps rnorm() etc: R> library(inline) R> R> R> f <- cxxfunction(signature(), plugin="Rcpp", body=' +Rcpp::RNGScope tmp; +return rnorm(3); + ') R> R> set.seed(42) R> rnorm(3) ## usin

Re: [Rcpp-devel] clarification of interaction between RInside and RcppEigen

2012-08-08 Thread Stephen J. Barr
Hello again, I am just trying to straighten this out. Say I want to have the exact same random matrix in C++ as I do in R using rnorm. Is what I am doing below on the right track? Thanks, Stephen // // Stephen J. Barr // - trying to combine RInside and Eigen #include #include using namesp

Re: [Rcpp-devel] clarification of interaction between RInside and RcppEigen

2012-08-08 Thread Stephen J. Barr
Ah, that made it click. Thank you so much for the help. On Tue, Aug 7, 2012 at 2:56 PM, Dirk Eddelbuettel wrote: > > On 7 August 2012 at 14:43, Stephen J. Barr wrote: > | Thanks for the pointer to sugar. > | > | I was just trying to think of a simple example. So my C++ code will be > | essential

Re: [Rcpp-devel] clarification of interaction between RInside and RcppEigen

2012-08-08 Thread Stephen J. Barr
Thanks for the pointer to sugar. I was just trying to think of a simple example. So my C++ code will be essentially: int main() { RInside R(argc, argv); // create an embedded R instance R.parseEval("X = generateSomeMatrix()"); Eigen::MatrixXd Xeigen; // this is the par

Re: [Rcpp-devel] clarification of interaction between RInside and RcppEigen

2012-08-08 Thread Stephen J. Barr
Ah, I see the error. Please disregard this. I see how Rcpp::as works now. Best, Stephen On Tue, Aug 7, 2012 at 2:08 PM, Stephen J. Barr wrote: > Hello again, > > I am just trying to straighten this out. Say I want to have the exact same > random matrix in C++ as I do in R using rnorm. Is what I

Re: [Rcpp-devel] clarification of interaction between RInside and RcppEigen

2012-08-07 Thread Stephen J. Barr
Thank you Dirk and also Douglas. This definitely helps. I think I can get this going. Thank you so much for the quick replies. Best, Stephen On Tue, Aug 7, 2012 at 11:29 AM, Dirk Eddelbuettel wrote: > > Hi Stephen, > > On 7 August 2012 at 10:55, Stephen J. Barr wrote: > | Greetings, > | > | I a

Re: [Rcpp-devel] clarification of interaction between RInside and RcppEigen

2012-08-07 Thread Dirk Eddelbuettel
Hi Stephen, On 7 August 2012 at 10:55, Stephen J. Barr wrote: | Greetings, | | I am new to Rcpp, RInside and the entire family of related packages. I am | experienced with R and also C++ using Eigen but I have never combined the two | before. You are in a good starting position. | I would like

Re: [Rcpp-devel] clarification of interaction between RInside and RcppEigen

2012-08-07 Thread Douglas Bates
Probably the best place to start with RcppEigen is the vignette that Dirk and I wrote for the RcppEigen package. I can email you a copy of the PDF file off-list if you wish. With RcppEigen you can skip the creation of an Rcpp::NumericMatrix object if you wish and go directly to a mapped Eigen Mat

[Rcpp-devel] clarification of interaction between RInside and RcppEigen

2012-08-07 Thread Stephen J. Barr
Greetings, I am new to Rcpp, RInside and the entire family of related packages. I am experienced with R and also C++ using Eigen but I have never combined the two before. I would like to create a matrix using R and then play with it using Eigen. From what I have read so far, it seems like I can us