Re: [Rcpp-devel] Rcpp: Modification of input argument: Undefined behaviour

2014-11-25 Thread Yixuan Qiu
Hello David, The general answer to your question is, if the type of your matrix (integer or numeric) in R is different from the one you declare in Rcpp, Rcpp will make a copy and cast it to the appropriate type. For example, 1:12 is of type integer, and if you pass it as a NumericMatrix, Rcpp will

[Rcpp-devel] Rcpp: Modification of input argument: Undefined behaviour

2014-11-25 Thread David Shih
Hello, There was an earlier post on this subject, but based on my experimentation, the behaviour of modifying input argument is different depending on how the matrix was initialization and other factors... I wrote a Rcpp function to modify an input matrix. After calling this function, the inpu