[Rcpp-devel] vector < RawVector > to RawMatrix [like do.call(rbind, mylist)]

Romain Francois romain at r-enthusiasts.com
Fri Jan 10 11:22:26 CET 2014


If you wrap your std::vector<RawVector> you get a list of raw vectors, and this does not do deep copies of the RawVector. 

If you want a RawMatrix, you have to make copies as all the matrix data is contiguous in memory. 

Perhaps you can change things around, first create the matrix and then fill it instead of creating a vector of RawVector. 


Le 10 janv. 2014 à 10:51, "Sven E. Templer" <sven.templer at gmail.com> a écrit :

> Hello,
> reading a matrix from a file and transforming it to raw format, I get a "std::vector< Rcpp::RawVector >", how can I wrap it to "Rcpp::RawMatrix". Right now I use "Rcpp::List::create(vector< RawVector >)" and use do.call(rbind, mylist) in R (does this do a copy to the memory?). Is there a way to wrap it in C++?
> Thank you for your help,
> Sven.
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140110/f53a4d86/attachment-0001.html>

More information about the Rcpp-devel mailing list