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

2014-01-10 Thread Sven E. Templer
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@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

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

2014-01-10 Thread Romain Francois
Hi, 

If you wrap your std::vectorRawVector 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. 

Romain

Le 10 janv. 2014 à 10:51, Sven E. Templer sven.temp...@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@lists.r-forge.r-project.org
 https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
___
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