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

Douglas Bates bates at stat.wisc.edu
Tue Aug 7 20:22:19 CEST 2012


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 Matrix.  There is
a specialization of the Rcpp::as templated function that allows for
creating an Eigen::MatrixXd or an Eigen::Map<Eigen::MatrixXd> object
directly from an SEXP, which is the R's internal representation of
data.

On Tue, Aug 7, 2012 at 12:55 PM, Stephen J. Barr <stephenjbarr at gmail.com> 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. 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 use RInside
> to create an Rcpp::NumericMatrix.
>
> My question is this: to transform a matrix from a Rcpp::NumericMatrix to an
> Eigen MatrixXd, do I use RcppEigen? Or is RcppEigen only for calling
> C++/Eigen from R and not the other way around?
>
> Thanks,
> Stephen
>
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


More information about the Rcpp-devel mailing list