Re: [Rcpp-devel] Trouble passing arguments to R functions that have been passed in (maybe)

2012-09-10 Thread Dirk Eddelbuettel
On 10 September 2012 at 22:42, Anthony Lee wrote: | On 10/09/12 22:05, Dirk Eddelbuettel wrote: | > | > I didn't have a lot of time for your post but I suspect your design is broken | > if you plan to call an R function in each itereation of a C++ loop. | > | > Just because you can does not mean

Re: [Rcpp-devel] Trouble passing arguments to R functions that have been passed in (maybe)

2012-09-10 Thread Anthony Lee
On 10/09/12 22:05, Dirk Eddelbuettel wrote: I didn't have a lot of time for your post but I suspect your design is broken if you plan to call an R function in each itereation of a C++ loop. Just because you can does not mean you should. Dirk In fact, there are some good reasons for doing so

Re: [Rcpp-devel] Trouble passing arguments to R functions that have been passed in (maybe)

2012-09-10 Thread Dirk Eddelbuettel
On 10 September 2012 at 21:23, Anthony Lee wrote: | It seems to be the casethat when the memory issue occurs, garbage | collection has just been called by R, at least according to gcinfo.In | particular, it is called when bar is called and cleans up the arguments | that bar is about to use, thu

Re: [Rcpp-devel] Trouble passing arguments to R functions that have been passed in (maybe)

2012-09-10 Thread Anthony Lee
It seems to be the casethat when the memory issue occurs, garbage collection has just been called by R, at least according to gcinfo.In particular, it is called when bar is called and cleans up the arguments that bar is about to use, thus causing a problem. Is there a way to ensure the safety

Re: [Rcpp-devel] Eclipse/statet IDE integration

2012-09-10 Thread Rodney Sparapani
On 04/09/2012 02:07 AM, Ian Fellows wrote: Hi All, So way back in the summer I figured out how to integrate Rcpp/RInside into Eclipses build system allowing for things like code completion / error checking work. I've been meaning to make some sort of public guide, but have not gotten around to i

[Rcpp-devel] Trouble passing arguments to R functions that have been passed in (maybe)

2012-09-10 Thread Anthony Lee
Hello, I'm quite new to Rcpp (and R in fact) and I'm having a little bit of trouble understanding what is going on in some of my code. I have written a fairly small example that exhibits the troublesome behaviour using inline (below). The code doesn't do anything interesting, but runCode() do

Re: [Rcpp-devel] pnorm/qnorm?

2012-09-10 Thread Jeffrey Pollock
Try; require(Rcpp) require(inline) check2 <- cxxfunction(signature(arg1 = "numeric", arg2 = "numeric"), ' NumericVector q(arg1); double mean = as(arg2); double sd = 1.0; return wrap(qnorm(q, mean, sd)); ', plugin = "

Re: [Rcpp-devel] pnorm/qnorm?

2012-09-10 Thread Dirk Eddelbuettel
On 10 September 2012 at 10:23, Rodney Sparapani wrote: | On 09/07/2012 12:19 PM, Dirk Eddelbuettel wrote: | > Make that Rcpp::NumericVector a = Rcpp::NumericVector(arg1); and things | > will just work. | > | > Would be nice if the compiler messahes could be more helpful... All sugar | > funct

Re: [Rcpp-devel] pnorm/qnorm?

2012-09-10 Thread Rodney Sparapani
On 09/07/2012 12:19 PM, Dirk Eddelbuettel wrote: Make that Rcpp::NumericVector a = Rcpp::NumericVector(arg1); and things will just work. Would be nice if the compiler messahes could be more helpful... All sugar functions are vectorised, so you must feed them a vector (which, as we work with

Re: [Rcpp-devel] Getting and setting array dimensions - simpler ways?

2012-09-10 Thread Douglas Bates
On Mon, Sep 10, 2012 at 8:55 AM, Søren Højsgaard wrote: > Dear list, > > I want to do some operations on an array, here exemplified by taking log (the > operations I have in mind are made using RcppArmadillo): > >> pp <- array(c(.1, .4, .4, .1), dim=c(2,2),dimnames=list(A=c("a1","a2"), >> B=c("

Re: [Rcpp-devel] Getting and setting array dimensions - simpler ways?

2012-09-10 Thread Dirk Eddelbuettel
On 10 September 2012 at 13:55, Søren Højsgaard wrote: | Dear list, | | I want to do some operations on an array, here exemplified by taking log (the operations I have in mind are made using RcppArmadillo): | | > pp <- array(c(.1, .4, .4, .1), dim=c(2,2),dimnames=list(A=c("a1","a2"), B=c("b1",

[Rcpp-devel] Getting and setting array dimensions - simpler ways?

2012-09-10 Thread Søren Højsgaard
Dear list, I want to do some operations on an array, here exemplified by taking log (the operations I have in mind are made using RcppArmadillo): > pp <- array(c(.1, .4, .4, .1), dim=c(2,2),dimnames=list(A=c("a1","a2"), > B=c("b1","b2"))) > log(pp) B Ab1 b2 a1 -2.3025