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

2014-11-26 Thread William Dunlap
uan Qiu > *Sent:* November 26, 2014 2:13 AM > *To:* David Shih > *Cc:* rcpp-devel@lists.r-forge.r-project.org > *Subject:* Re: [Rcpp-devel] Rcpp: Modification of input argument: > Undefined behaviour > > > Hello David, > The general answer to your question is, if the type

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

2014-11-26 Thread David Shih
2:13 AM To: David Shih Cc: rcpp-devel@lists.r-forge.r-project.org Subject: Re: [Rcpp-devel] Rcpp: Modification of input argument: Undefined behaviour 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,

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

2014-11-26 Thread Dirk Eddelbuettel
On 26 November 2014 at 02:13, Yixuan Qiu wrote: | 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. Precisely. | For example,

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