On 12 October 2016 at 15:27, Sokol Serguei wrote: | May be the problem is that you are trying to use std::copy for writing | to non contiguous memory when you use a row pointer and the class writers | were smart enough to prevent such situation. | | The following code works as expected, may be it can do the job for you: | | cppFunction('void copy2(arma::rowvec& v, arma::mat& d1, arma::mat& d2) { | d1.row(0)=v(arma::span(0,2)); | d2.row(0)=v(arma::span(3,5)); | }', depends = "RcppArmadillo") | | v <- runif(6) | d1 <- matrix(0.0, 3,3) | d2 <- matrix(0.0, 3,3) | copy2(v, d1, d2)
Thanks for taking the time to create an example -- this os pretty much what I was advocating too. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org _______________________________________________ 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