Re: [Rcpp-devel] Const correctness of NumericVector iterators

2014-11-26 Thread Dirk Eddelbuettel
Hi Martyn, On 26 November 2014 at 17:31, Martyn Plummer wrote: | I got that. It is an unusual use case, but not crazy. We have a complex | likelihood function that we want to expose to R's optimization methods | for maximum likelihood, but we also want to drop the same code into JAGS | for Bayesi

Re: [Rcpp-devel] Const correctness of NumericVector iterators

2014-11-26 Thread Martyn Plummer
On Wed, 2014-11-26 at 11:20 -0600, Dirk Eddelbuettel wrote: > On 26 November 2014 at 10:15, Dirk Eddelbuettel wrote: > | > | Hi Martyn, > | > | On 26 November 2014 at 13:20, Martyn Plummer wrote: > | | This is related to David Shih's thread about modifying input arguments > | | but I think it nee

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

2014-11-26 Thread William Dunlap
> The `mode()` function was pretty useless for determining a matrix object's type Use the storage.mode() function. Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Nov 26, 2014 at 9:06 AM, David Shih wrote: > Hi Yixuan, > > > You're right! > > > Whether the input matrix can be modified

Re: [Rcpp-devel] Const correctness of NumericVector iterators

2014-11-26 Thread Dirk Eddelbuettel
On 26 November 2014 at 10:15, Dirk Eddelbuettel wrote: | | Hi Martyn, | | On 26 November 2014 at 13:20, Martyn Plummer wrote: | | This is related to David Shih's thread about modifying input arguments | | but I think it needs its own thread. | | | | I found a problem when I tried porting some R

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

2014-11-26 Thread David Shih
Hi Yixuan, You're right! Whether the input matrix can be modified by a function that takes NumericMatrix is determined by whether the input matrix is a NumericMatrix or an IntegerMatrix (the latter needs to be copied and converted). The `mode()` function was pretty useless for determining a

Re: [Rcpp-devel] Const correctness of NumericVector iterators

2014-11-26 Thread Dirk Eddelbuettel
Hi Martyn, On 26 November 2014 at 13:20, Martyn Plummer wrote: | This is related to David Shih's thread about modifying input arguments | but I think it needs its own thread. | | I found a problem when I tried porting some Rcpp code to run outside of | Rcpp by providing my own NumericVector impl

Re: [Rcpp-devel] RcppProgress RcppArmadillo

2014-11-26 Thread Karl Forner - Quartz Bio
A bit late, but I've made some changes to RcppProgress to deal with the RcppArmadillo header compatibility problem. Please check https://github.com/kforner/rcpp_progress. I added a note about RcppArmadillo in the package documentation. Any feedback appreciated before CRAN resubmission. Cheers, Ka

[Rcpp-devel] Const correctness of NumericVector iterators

2014-11-26 Thread Martyn Plummer
This is related to David Shih's thread about modifying input arguments but I think it needs its own thread. I found a problem when I tried porting some Rcpp code to run outside of Rcpp by providing my own NumericVector implementation based on STL vectors. In Rcpp it is possible to obtain a non-con

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,