[Rcpp-devel] Rolling ADF test

2014-02-12 Thread Hideyoshi Maeda
Dear Rcpp-devel list, Wasn’t sure if this got sent last time as I didn’t get a response. I am looking to carry out a fixed window length rolling ADF test (with no intercept), over some time series data currently in xts format. To do this I need to first fit a regression to the data, then use th

Re: [Rcpp-devel] Segfault, is it because of iterators/pointers?

2014-02-12 Thread Alessandro Mammana
Ok I was able to find the code causing the bug. So it looks like the pointers you get from an Rcpp::Vector using .begin() become invalid after that the Rcpp::Vector goes out of scope (and this makes sense), what I do not understand is that this Rcpp::Vector was allocated in R and should still be "l

Re: [Rcpp-devel] Segfault, is it because of iterators/pointers?

2014-02-12 Thread Dirk Eddelbuettel
On 12 February 2014 at 11:47, Alessandro Mammana wrote: | Ok I was able to find the code causing the bug. So it looks like the Thanks for the added detail. | pointers you get from an Rcpp::Vector using .begin() become invalid | after that the Rcpp::Vector goes out of scope (and this makes sense)

Re: [Rcpp-devel] Segfault, is it because of iterators/pointers?

2014-02-12 Thread Alessandro Mammana
Ah wait, my bad (as always T.T), I found a much simpler explanation: colset <- sample(3e7-nr, 1e7) storage.mode(colset) [1] "integer" storage.mode(colset-1) [1] "double" So when I was unwrapping colset I allocated new memory in Rcpp to convert from double to integer, which was no longer valid whe

Re: [Rcpp-devel] Segfault, is it because of iterators/pointers?

2014-02-12 Thread Dirk Eddelbuettel
On 12 February 2014 at 13:36, Alessandro Mammana wrote: | Ah wait, my bad (as always T.T), I found a much simpler explanation: Isn't it lovely when persistence pays off? ;-) | colset <- sample(3e7-nr, 1e7) | storage.mode(colset) | [1] "integer" | storage.mode(colset-1) | [1] "double" | | So w

Re: [Rcpp-devel] Segfault, is it because of iterators/pointers?

2014-02-12 Thread Romain Francois
Le 12 févr. 2014 à 13:36, Alessandro Mammana a écrit : > Ah wait, my bad (as always T.T), I found a much simpler explanation: > > colset <- sample(3e7-nr, 1e7) > storage.mode(colset) > [1] "integer" > storage.mode(colset-1) > [1] "double" > > So when I was unwrapping colset I allocated new mem

Re: [Rcpp-devel] Array into C++ with cppFunction

2014-02-12 Thread Nick Menzies
Hi Dirk, thanks for pointing me in the right direction. My solution below for a 3D array (documenting for rubes like myself). N library(Rcpp) library(RcppArmadillo) cppFunction(' double NewFunc( NumericVector ArrayR ) { IntegerVector DimsA = ArrayR.attr("dim"); arma::cube

Re: [Rcpp-devel] Array into C++ with cppFunction

2014-02-12 Thread Dirk Eddelbuettel
hi nick, On 12 February 2014 at 09:23, Nick Menzies wrote: | Hi Dirk, thanks for pointing me in the right direction.  | | My solution below for a 3D array (documenting for rubes like myself).   N | | library(Rcpp) | library(RcppArmadillo) | |     cppFunction(' |     double  NewFunc( NumericVec

Re: [Rcpp-devel] Array into C++ with cppFunction

2014-02-12 Thread Romain Francois
FYI, there is a Array template in Rcpp11. https://github.com/romainfrancois/Rcpp11/blob/master/inst/include/Rcpp/Array.h With which you could use code like this: #include using namespace Rcpp ; // [[Rcpp::export]] double NewFunc( NumericArray<3> x){ return x(1,2,3) + x(2,3,4) ; } Romain L

Re: [Rcpp-devel] Rolling ADF test

2014-02-12 Thread Sameer D'Costa
On Wed, Feb 12, 2014 at 2:58 AM, Hideyoshi Maeda wrote: > Dear Rcpp-devel list, > > Wasn't sure if this got sent last time as I didn't get a response. > For next time, you can check the archives if you are not sure if your message was sent to the list. http://lists.r-forge.r-project.org/pipermail

Re: [Rcpp-devel] Segfault, is it because of iterators/pointers?

2014-02-12 Thread Alessandro Mammana
I like the "Strict mode" idea, I will use it, thanks! On Wed, Feb 12, 2014 at 2:34 PM, Romain Francois wrote: > > Le 12 févr. 2014 à 13:36, Alessandro Mammana a écrit : > >> Ah wait, my bad (as always T.T), I found a much simpler explanation: >> >> colset <- sample(3e7-nr, 1e7) >> storage.mode(

[Rcpp-devel] Wrapper generation, keep source untouched

2014-02-12 Thread Gábor Csárdi
Hi All, I knew I wouldn't be able avoid Rcpp forever. :) I am about create R wrappers to a C++ library, old style, not templating. Rcpp attributes, and custom as<> and wrap() seem to be the way to go, and they are indeed very appealing. (If only they would have existed when I started with igraph!)

Re: [Rcpp-devel] Wrapper generation, keep source untouched

2014-02-12 Thread Dirk Eddelbuettel
On 12 February 2014 at 10:57, Gábor Csárdi wrote: | Hi All, I knew I wouldn't be able avoid Rcpp forever. :) We're happy to have you now :) I'm sure good things will come of this. | I am about create R wrappers to a C++ library, old style, not templating. Rcpp | attributes, and custom as<> and

Re: [Rcpp-devel] Wrapper generation, keep source untouched

2014-02-12 Thread Gábor Csárdi
On Wed, Feb 12, 2014 at 11:41 AM, Dirk Eddelbuettel wrote: [...] > | My question is, is there a way you keep the original sources of the > wrapped > | library intact? I would be updating the sources regularly, and I figured > the > | best would be not to touch them at all. > > Did you see the 'Rc

Re: [Rcpp-devel] Wrapper generation, keep source untouched

2014-02-12 Thread Gábor Csárdi
OK, actually there is a simple way to achieve this, with minimal modifications to the Rcpp codebase: https://github.com/gaborcsardi/Rcpp/commit/8b160547d50d668099dff3802c01001baaf415b6 With this, I can put the functions I want to wrap to a separate file, that is essentially a header file, with con

[Rcpp-devel] CRAN package does not build with Rcpp 0.11.1 and g++ 4.2.1

2014-02-12 Thread Dan Tenenbaum
Hi, The CRAN package ConConPiWiFun does not compile under g++ 4.2.1 which is the default compiler on the CRAN build machine (see http://cran.us.r-project.org/web/checks/check_flavors.html, the row r-release-macosx-x86_64). This has not been a problem so far because the package has not been reb

Re: [Rcpp-devel] CRAN package does not build with Rcpp 0.11.1 and g++ 4.2.1

2014-02-12 Thread Dirk Eddelbuettel
Dan, [ Impossible Subject:, there is no Rcpp 0.11.1 amywhere yet. ] On 12 February 2014 at 17:19, Dan Tenenbaum wrote: | The CRAN package ConConPiWiFun does not compile under g++ 4.2.1 which is the default compiler on the CRAN build machine (see http://cran.us.r-project.org/web/checks/check_fl

Re: [Rcpp-devel] CRAN package does not build with Rcpp 0.11.1 and g++ 4.2.1

2014-02-12 Thread Dan Tenenbaum
Hi Dirk, Sorry for the typo in my subject. Very briefly: There are three CRAN packages (probably more) that can't be run from binaries and they can't be recompiled (with CRAN's default compiler for the platform). Therefore anyone who wants to use these 3 packages on a Mac is SOL. They could

Re: [Rcpp-devel] CRAN package does not build with Rcpp 0.11.1 and g++ 4.2.1

2014-02-12 Thread Kevin Ushey
Yes, the patch is trivial. Dan, we can try installing the latest version of Rcpp on GitHub on the BioC Mac build machine and confirm that these packages do build on Mac with llvm-g++4.2. And I agree that either 1. CRAN needs to rebuild the binaries for packages linking to Rcpp, or 2. these package

Re: [Rcpp-devel] CRAN package does not build with Rcpp 0.11.1 and g++ 4.2.1

2014-02-12 Thread Dirk Eddelbuettel
On 12 February 2014 at 18:44, Dan Tenenbaum wrote: | Hi Dirk, | | Sorry for the typo in my subject. | | Very briefly: | | There are three CRAN packages (probably more) that can't be run from binaries and they can't be recompiled (with CRAN's default compiler for the platform). | | Therefore

Re: [Rcpp-devel] CRAN package does not build with Rcpp 0.11.1 and g++ 4.2.1

2014-02-12 Thread Dan Tenenbaum
- Original Message - > From: "Kevin Ushey" > To: "Dan Tenenbaum" > Cc: "Dirk Eddelbuettel" , "rcpp-devel" > > Sent: Wednesday, February 12, 2014 6:53:01 PM > Subject: Re: [Rcpp-devel] CRAN package does not build with Rcpp 0.11.1 and > g++ 4.2.1 > > > Yes, the patch is trivial. Dan,