Re: [Rcpp-devel] bizarre behavior of RcppMatrix

2010-05-25 Thread Yi-Hsin Erica Tsai
Hi Dirk and Romain, Thanks for your help. I see now that I was treating the NumericMatrix declarations as copy constructors, but rather should be thinking of them as wrapper objects, and I need to be careful to only assign one Rcpp variable to each SEXP. Also, a good catch of the difference

Re: [Rcpp-devel] bizarre behavior of RcppMatrix

2010-05-25 Thread Romain Francois
Le 25/05/10 04:38, Dirk Eddelbuettel a écrit : Hi Erica, Thanks for your interest in Rcpp, and for posting on the list! On 24 May 2010 at 20:58, Yi-Hsin Erica Tsai wrote: | Hi, | | I've just started using Rcpp with the hopes of speeding up some R loops | through replacement with C++ code. I'

Re: [Rcpp-devel] bizarre behavior of RcppMatrix

2010-05-25 Thread Romain Francois
Hello, This has nothing to do with default arguments, wrappers, etc ... on the R side. The issue is the difference between : > typeof( matrix((1:9), 3, 3) ) [1] "integer" > typeof( matrix(seq(1,9)^2, ncol=3) ) [1] "double" The constructor of NumericMatrix has no choice but to cast the input

Re: [Rcpp-devel] bizarre behavior of RcppMatrix

2010-05-24 Thread Dirk Eddelbuettel
Hi Erica, Thanks for your interest in Rcpp, and for posting on the list! On 24 May 2010 at 20:58, Yi-Hsin Erica Tsai wrote: | Hi, | | I've just started using Rcpp with the hopes of speeding up some R loops | through replacement with C++ code. I've been struggling with | understanding the beh

Re: [Rcpp-devel] bizarre behavior of RcppMatrix

2010-05-24 Thread Dirk Eddelbuettel
Hi Erica, Thanks for your interest in Rcpp, and for posting on the list! On 24 May 2010 at 20:58, Yi-Hsin Erica Tsai wrote: | Hi, | | I've just started using Rcpp with the hopes of speeding up some R loops | through replacement with C++ code. I've been struggling with | understanding the beh

Re: [Rcpp-devel] bizarre behavior of RcppMatrix

2010-05-24 Thread Yi-Hsin Erica Tsai
Sorry, I forgot to mention my installation details: I'm running R version 2.11.0, Rcpp 0.8.0, on Ubuntu Hardy Heron. Best, --Erica On 5/24/2010 8:58 PM, Yi-Hsin Erica Tsai wrote: Hi, I've just started using Rcpp with the hopes of speeding up some R loops through replacement with C++ code. I'v

[Rcpp-devel] bizarre behavior of RcppMatrix

2010-05-24 Thread Yi-Hsin Erica Tsai
Hi, I've just started using Rcpp with the hopes of speeding up some R loops through replacement with C++ code. I've been struggling with understanding the behavior of the NumericMatrix datatype and more generally how to pass matrices between R and C++. I seem to be getting bizarre behavior