OK, I've got it working.<br><br>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 the big.matrix object that is passed to your function.<br>

<br>require(Rcpp)<br>require(inline)<br>require(bigmemory)<br><br>Sys.setenv(PKG_CPPFLAGS=paste(<br>  paste("-I", system.file(package="bigmemory"), "/include/bigmemory", sep=""),<br>

  Sys.getenv("PKG_CPPFLAGS")))<br><br>matFn <- '<br>Rcpp::XPtr<BigMatrix> bigMat(A);<br>MatrixAccessor<int> Am(*bigMat);<br><br>int nrows = bigMat->nrow();<br>int ncolumns = bigMat->ncol();<br>

for (int j = 0; j < ncolumns; j++){<br>        for (int i = 1; i < nrows; i++){<br>                Am[j][i] = Am[j][i] + Am[j][i-1];<br>        }<br>}<br>';<br># same function declaration as in example 2.<br>funx <- cxxfunction(signature(A="externalptr"), body=matFn,   plugin = "Rcpp", includes='#include "MatrixAccessor.hpp"')<br>

<br># set up big.matrix<br>nrows <- 10000<br>bkFile <- "bigmat.bk"<br>descFile <- "bigmatk.desc"<br>suppressMessages(library(bigmemory))<br>bigmat <- filebacked.big.matrix(nrow=nrows, ncol=3,type="integer", init=1,<br>

        backingfile=bkFile, backingpath=".",descriptorfile=descFile,<br>        dimnames=c(NULL,NULL))<br>matDesc <- bigmemory::describe(bigmat)<br><br>funx(bigmat@address)<br><br><br><div class="gmail_quote">

On Thu, Mar 14, 2013 at 12:40 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
I do not think we have support for bigmemory's big.matrix objects. So you<br>
can't just assum it works.<br>
<br>
Contributions welcome.  This is both 'an obvious one' as it would make sense<br>
at the C++ and R levels, and something that should not be so hard as we<br>
support XPtr.<br>
<span class="HOEnZb"><font color="#888888"><br>
Dirk<br>
<br>
--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
</div></div></blockquote></div><br>