Re: [Rcpp-devel] ivec and imat don't pass by reference

2015-09-15 Thread Serguei Sokol
Le 15/09/2015 14:09, Serguei Sokol a écrit : Le 15/09/2015 13:53, Dirk Eddelbuettel a écrit : On 15 September 2015 at 12:16, Serguei Sokol wrote: | Hi, | | If we declare the following toy function where a numeric matrix is passed by reference, | it works as expected, the matrix m is modified "

Re: [Rcpp-devel] ivec and imat don't pass by reference

2015-09-15 Thread Serguei Sokol
Le 15/09/2015 13:53, Dirk Eddelbuettel a écrit : On 15 September 2015 at 12:16, Serguei Sokol wrote: | Hi, | | If we declare the following toy function where a numeric matrix is passed by reference, | it works as expected, the matrix m is modified "in place": | | cppFunction(' | mat m2(mat& m)

Re: [Rcpp-devel] ivec and imat don't pass by reference

2015-09-15 Thread Dirk Eddelbuettel
On 15 September 2015 at 12:16, Serguei Sokol wrote: | Hi, | | If we declare the following toy function where a numeric matrix is passed by reference, | it works as expected, the matrix m is modified "in place": | | cppFunction(' | mat m2(mat& m) { | m=m*2; | return(m); | }', depends="Rc

[Rcpp-devel] ivec and imat don't pass by reference

2015-09-15 Thread Serguei Sokol
Hi, If we declare the following toy function where a numeric matrix is passed by reference, it works as expected, the matrix m is modified "in place": cppFunction(' mat m2(mat& m) { m=m*2; return(m); }', depends="RcppArmadillo", inc="using namespace arma;") m=matrix(1:4, 2)+pi m2(m)