Re: [Rcpp-devel] Filling a big.matrix in Rcpp

2013-03-14 Thread Shraddha Pai
Hi all, Thanks for all the responses and for clarifying what big matrices are. I had actually looked through the rcpp-devel site before attempting to use big.matrix with Rcpp. I probably misunderstood this thread about bigmemory; it sounded like bigmemory objects worked "out-of-the-box" with Rcpp

Re: [Rcpp-devel] Filling a big.matrix in Rcpp

2013-03-14 Thread Dirk Eddelbuettel
On 15 March 2013 at 00:51, Romain Francois wrote: | Why do you use wrap here ? Reflex, because I returned an atomistic type. | Wrap will create a SEXP, not a bool ! Quite right but was in a rush while doing other things too. "Forgot" that I was using sourceCpp() which give one additional layer

Re: [Rcpp-devel] Filling a big.matrix in Rcpp

2013-03-14 Thread Romain Francois
Le 14 mars 2013 à 19:33, Dirk Eddelbuettel a écrit : > > On 14 March 2013 at 12:24, Smith, Dale wrote: > | Write it up for Rcpp Gallery. > > Yup. Our thoughts too. Here is a slightly modified version which works as a > single cpp file thanks to the wonders of sourceCpp() --- bigmemory header

Re: [Rcpp-devel] Filling a big.matrix in Rcpp

2013-03-14 Thread Dirk Eddelbuettel
On 14 March 2013 at 12:24, Smith, Dale wrote: | Write it up for Rcpp Gallery. Yup. Our thoughts too. Here is a slightly modified version which works as a single cpp file thanks to the wonders of sourceCpp() --- bigmemory headers are found automagically, and the example is executed too. Dirk

Re: [Rcpp-devel] Filling a big.matrix in Rcpp

2013-03-14 Thread Smith, Dale
Behalf Of Michael Kane Sent: Thursday, March 14, 2013 1:19 PM To: Dirk Eddelbuettel Cc: [email protected] Subject: Re: [Rcpp-devel] Filling a big.matrix in Rcpp OK, I've got it working. You need to add the bigmemory inst directory to the PKG_CPPFLAGS, include MatrixAc

Re: [Rcpp-devel] Filling a big.matrix in Rcpp

2013-03-14 Thread Michael Kane
OK, I've got it working. You need to add the bigmemory inst directory to the PKG_CPPFLAGS, include MatrixAccessor.hpp, and pass the pointer to the BigMatrix object to your function. The following code should do the trick but note that it does not create a new big.matrix object it simply modifies t

Re: [Rcpp-devel] Filling a big.matrix in Rcpp

2013-03-14 Thread Dirk Eddelbuettel
I do not think we have support for bigmemory's big.matrix objects. So you can't just assum it works. Contributions welcome. This is both 'an obvious one' as it would make sense at the C++ and R levels, and something that should not be so hard as we support XPtr. Dirk -- Dirk Eddelbuettel | e

Re: [Rcpp-devel] Filling a big.matrix in Rcpp

2013-03-14 Thread Michael Kane
Shradda, A big.matrix is not a regular R matrix. It is a completely separate type. The definition can be found in BigMatrix.h. I've rewritten your C++ code but there is still a problem. To build the function the compiler needs to know where the bigmemory header files are. Basically, you need to #i