Re: [Rcpp-devel] (no subject)

2013-07-09 Thread Dirk Eddelbuettel
Hi Jules, On 9 July 2013 at 22:16, Jules Archer wrote: | Hi, | | I've been trying to integrate the mathGL plotting library into R with Rcpp, | with the ultimate goal of rendering in the browser. So far, I've been | successful with creating simple plotting test functions, compile with sourceCpp

[Rcpp-devel] (no subject)

2013-07-09 Thread Jules Archer
Hi, I've been trying to integrate the mathGL plotting library into R with Rcpp, with the ultimate goal of rendering in the browser.  So far, I've been successful with creating simple plotting test functions, compile with sourceCpp("myplotter.cpp") and output *.png and *.json files for browser 3

Re: [Rcpp-devel] simple Rcpp function produces: "AddressSanitizer: attempting free on address which was not malloc"

2013-07-09 Thread Smith, Dale (Norcross)
Sorry, my bad, the method to use is reserve, not resize. Resize will only extend a vector. The Code Project article on the vector container does use function pointers, however, there are better ways to do this, particularly if you avoid the MFC stuff as if it were the plague bacillus and use st

Re: [Rcpp-devel] simple Rcpp function produces: "AddressSanitizer: attempting free on address which was not malloc"

2013-07-09 Thread Smith, Dale (Norcross)
My $0.02. Dirk is right - pick something and stick with it, but avoid the raw pointers, especially if your experience is limited. It's much easier to learn the smart pointers std::shared_ptr and std::unique_ptr, or their boost equivalents, rather than deal with raw pointers in new code. htt

Re: [Rcpp-devel] Getting the exact arithmetic as in R when Rcpp is used?

2013-07-09 Thread Wray, Christopher
This has already been answered by Dirk and Bill. Although the OPs example can, of course, be reproduced in R, sans Rcpp. I use rep(0.1,9) in place of rep(0.1,10). We can use Rcpp to see various differences explicitly: > options(digits=22) > vx=rep(0.1,9) > vx[1]+vx[2]+vx[3]+vx[4]+vx[5]+vx[6]+v