Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Christian Gunning
> Indeed, changing the sample size from 5 to 500 results in; For completeness, I've included an iterator example, tested over a range of sample sizes, and plotted the results with the code below. From where I sit, it looks like the relative timings flatten out (more or less) at 1e4. I'm not sure

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Darren Cook
>> benchmark(fun1(), fun2(), fun3(), fun4(), order = "relative", > replications = 1e5L) > test replications elapsed relative user.self sys.self user.child > sys.child > 4 fun4() 106.161.000 6.060 NA > NA > 3 fun3() 106.191.005 5.91

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Dirk Eddelbuettel
On 25 September 2012 at 16:19, Rodney Sparapani wrote: | Very good. Just one quick question since I have come across | this in the documentation somewhere, but I can't seem to find | it anymore. Can you pass optimization flags like so? | | f3<- cxxfunction(signature(), plugin="Rcpp", body=' |

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Rodney Sparapani
On 09/25/2012 03:41 PM, Dirk Eddelbuettel wrote: In the interest of constructive criticism, my version (and I must posted essentially the same maybe ten times already on this very list): R> f3<- cxxfunction(signature(), plugin="Rcpp", body=' +RNGScope scope; +NumericVector rn = Rcpp::rn

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Steve Lianoglou
Hi, On Tue, Sep 25, 2012 at 4:41 PM, Dirk Eddelbuettel wrote: > > On 25 September 2012 at 13:53, Rodney Sparapani wrote: > | You just need an explicit type conversion like so: > | > | funk2 <- cxxfunction(body='RNGScope scope; > |NumericVector rn(5); > |for (int i=0; i < 5

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Dirk Eddelbuettel
On 25 September 2012 at 21:08, Jeffrey Pollock wrote: | I was interested to see if there was any real speed difference between the | different methods suggested, and it looks like... there isn't... Good move -- measuring is a good idea. And yes: at the end of the days everything is just a call t

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Dirk Eddelbuettel
On 25 September 2012 at 13:53, Rodney Sparapani wrote: | You just need an explicit type conversion like so: | | funk2 <- cxxfunction(body='RNGScope scope; |NumericVector rn(5); |for (int i=0; i < 5; i++) rn[i] = as(rnorm(1,0,1)); |return wrap(rn);', |

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Jeffrey Pollock
rom:* Jonathan Olmsted [mailto:[email protected]] > *Sent:* Tuesday, September 25, 2012 4:29 PM > *To:* Jeffrey Pollock > > *Cc:* Goldfeld, Keith; [email protected] > *Subject:* Re: [Rcpp-devel] NumericVector Double mismatch when indexing > an array**

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Goldfeld, Keith
[mailto:[email protected]] Sent: Tuesday, September 25, 2012 4:29 PM To: Jeffrey Pollock Cc: Goldfeld, Keith; [email protected] Subject: Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array Jeff and List, I was interested in the same fairly recently. The full shebang

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Jonathan Olmsted
teration is really my only >> option. I won't be generating more than a few thousand records, so the >> time shouldn't be much of a factor. Of course, in R it is painfully slow - >> so that is why I am going the Rcpp route. >> >> -Original Message- >> F

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Jeffrey Pollock
- > so that is why I am going the Rcpp route. > > -Original Message- > From: [email protected] [mailto:[email protected]] On Behalf Of Douglas > Bates > Sent: Tuesday, September 25, 2012 3:13 PM > To: Rodney Sparapani > Cc: Goldfeld, Keith; [email protected]

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Goldfeld, Keith
Rcpp-devel] NumericVector Double mismatch when indexing an array On Tue, Sep 25, 2012 at 1:53 PM, Rodney Sparapani wrote: > On 09/25/2012 01:37 PM, Goldfeld, Keith wrote: > >>> code<- 'Rcpp::RNGScope scope; >> >> >> +Rcpp::NumericVector rn(5)

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Douglas Bates
On Tue, Sep 25, 2012 at 1:53 PM, Rodney Sparapani wrote: > On 09/25/2012 01:37 PM, Goldfeld, Keith wrote: > >>> code<- 'Rcpp::RNGScope scope; >> >> >> +Rcpp::NumericVector rn(5); >> >> +for (int i=0; i< 5; i++) { >> >> +rn(i) = rnor

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Goldfeld, Keith
Of course - that did the trick. Thanks so much. -Original Message- From: Rodney Sparapani [mailto:[email protected]] Sent: Tuesday, September 25, 2012 2:53 PM To: Goldfeld, Keith Cc: '[email protected]' Subject: Re: [Rcpp-devel] NumericVector Double mis

Re: [Rcpp-devel] NumericVector Double mismatch when indexing an array

2012-09-25 Thread Rodney Sparapani
On 09/25/2012 01:37 PM, Goldfeld, Keith wrote: code<- 'Rcpp::RNGScope scope; +Rcpp::NumericVector rn(5); +for (int i=0; i< 5; i++) { +rn(i) = rnorm(1,0,1); +} +return Rcpp::wrap(rn);