Re: [Rcpp-devel] row iterators in RcppArmadillo

2016-10-12 Thread Jonathan Fintzi
Hi Sokol, Yes, that explains it. I ended up implementing the solution that you and Dirk identified, which is to simply convert the vector 'v' to an armadillo vector for the purpose of copying from it. Thanks for the help! Jon On Wed, Oct 12, 2016 at 3:27 PM, Sokol Serguei wrote: > Hi Jonathan,

Re: [Rcpp-devel] row iterators in RcppArmadillo

2016-10-12 Thread Dirk Eddelbuettel
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

Re: [Rcpp-devel] row iterators in RcppArmadillo

2016-10-12 Thread Sokol Serguei
Hi Jonathan, Jonathan Fintzi has written at Wed, 12 Oct 2016 13:43:20 -0700 Hello, I am trying to use the std::copy() function to copy elements from an Rcpp::NumericVector into rows of armadillo matrices. A simplified version of my code is as follows: cppFunction('void copyinto(Rcpp::Numer

Re: [Rcpp-devel] row iterators in RcppArmadillo

2016-10-12 Thread Jonathan Fintzi
Hi Dirk, I take your point. Given that the conversion is essentially free, temporary conversion makes the most sense. Thank you again! Jon On Wed, Oct 12, 2016 at 2:36 PM, Dirk Eddelbuettel wrote: > > Hi Jon, > > On 12 October 2016 at 14:20, Jonathan Fintzi wrote: > | Thanks for the quick resp

Re: [Rcpp-devel] row iterators in RcppArmadillo

2016-10-12 Thread Dirk Eddelbuettel
Hi Jon, On 12 October 2016 at 14:20, Jonathan Fintzi wrote: | Thanks for the quick response. In the broader project, the vector being copied | from is an Rcpp::NumericVector that contatenates vectorized versions of a | number of other objects that are integrated numerically using the boost odeint

Re: [Rcpp-devel] row iterators in RcppArmadillo

2016-10-12 Thread Jonathan Fintzi
Hi Dirk, Thanks for the quick response. In the broader project, the vector being copied from is an Rcpp::NumericVector that contatenates vectorized versions of a number of other objects that are integrated numerically using the boost odeint solvers. I couldn't quite get the numerical integrators t

Re: [Rcpp-devel] row iterators in RcppArmadillo

2016-10-12 Thread Dirk Eddelbuettel
On 12 October 2016 at 13:43, Jonathan Fintzi wrote: | Hello, | | I am trying to use the std::copy() function to copy elements from an | Rcpp::NumericVector into rows of armadillo matrices. A simplified version of my | code is as follows: | | cppFunction('void copyinto(Rcpp::NumericVector& v, ar

[Rcpp-devel] row iterators in RcppArmadillo

2016-10-12 Thread Jonathan Fintzi
Hello, I am trying to use the std::copy() function to copy elements from an Rcpp::NumericVector into rows of armadillo matrices. A simplified version of my code is as follows: cppFunction('void copyinto(Rcpp::NumericVector& v, arma::mat& d1, arma::mat& d2) { std::copy(v.begin(), v.begin()