<p dir="ltr"></p>
<p dir="ltr">Aileen Lin</p>
<p dir="ltr">View my profile: <a href="http://au.linkedin.com/in/aileen2">au.linkedin.com/in/aileen2</a></p>
<div class="gmail_quote">---------- Forwarded message ----------<br>From: "Aileen Lin" <<a href="mailto:aileenshanhong.lin@gmail.com">aileenshanhong.lin@gmail.com</a>><br>Date: 15 Mar 2013 10:44<br>Subject: Re: [Rcpp-devel] Filling a big.matrix in Rcpp<br>
To: "Dirk Eddelbuettel" <<a href="mailto:edd@debian.org">edd@debian.org</a>><br>Cc: <br><br type="attribution"><div>I tried your source code and had two warning messages:</div>
<div> </div>
<div>g++ -I"C:/R/R-215~1.2/include" -DNDEBUG -I"C:/R/R-2.15.2/library/Rcpp/include" -I"H:/R/win-library/2.15/bigmemory/include" -O2 -Wall -mtune=core2 -c rcpp_bm_test.cpp -o rcpp_bm_test.o<br>
In file included from H:/R/win-library/2.15/bigmemory/include/boost/smart_ptr/detail/spinlock_sync.hpp:18:0,<br> from H:/R/win-library/2.15/bigmemory/include/boost/smart_ptr/detail/spinlock.hpp:38,<br> from H:/R/win-library/2.15/bigmemory/include/boost/smart_ptr/detail/spinlock_pool.hpp:25,<br>
from H:/R/win-library/2.15/bigmemory/include/boost/smart_ptr/shared_ptr.hpp:37,<br> from H:/R/win-library/2.15/bigmemory/include/boost/shared_ptr.hpp:17,<br> from H:/R/win-library/2.15/bigmemory/include/bigmemory/BigMatrix.h:6,<br>
from H:/R/win-library/2.15/bigmemory/include/bigmemory/MatrixAccessor.hpp:4,<br> from rcpp_bm_test.cpp:7:<br>H:/R/win-library/2.15/bigmemory/include/boost/smart_ptr/detail/yield_k.hpp:58:48: <font color="#3333ff">warning:</font> declaration of 'void boost::detail::Sleep(unsigned int)' with C language linkage [enabled by default]<br>
H:/R/win-library/2.15/bigmemory/include/boost/interprocess/detail/win32_api.hpp:382:49: <font color="#3366ff">warning:</font> conflicts with previous declaration 'void boost::interprocess::winapi::Sleep(long unsigned int)' [enabled by default]<br>
g++ -shared -s -static-libgcc -o sourceCpp_24751.dll tmp.def rcpp_bm_test.o C:/R/R-2.15.2/library/Rcpp/lib/i386/libRcpp.a -LC:/R/R-215~1.2/bin/i386 -lR</div>
<div> </div>
<div>Do you have the same warning messages? Do you know how to get rid of it? Thank you.</div>
<div> </div>
<div> </div>
<div> </div>
<div class="gmail_quote">On 15 March 2013 05:33, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div><br>On 14 March 2013 at 12:24, Smith, Dale wrote:<br>| Write it up for Rcpp Gallery.<br><br></div>Yup. Our thoughts too. Here is a slightly modified version which works as a<br>single cpp file thanks to the wonders of sourceCpp() --- bigmemory headers<br>
are found automagically, and the example is executed too.<br><br>Dirk<br><br><br><br>// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-<br><br>#include <Rcpp.h><br><br>// The next line is all it takes to find the bigmemory<br>
// headers -- thanks to the magic of Rcpp attributes<br><br>// [[Rcpp::depends(bigmemory)]]<br>#include <bigmemory/MatrixAccessor.hpp><br><br><br>// We define a simple function, and pass the incoming XPtr as a SEXP;<br>
// we could also pass a templated XPtr. Function returns only a bool.<br><br>// [[Rcpp::export]]<br>bool fun(SEXP A) {<br>
<div> 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></div> return Rcpp::wrap(true);<br>}<br><br>// R code for testing below<br><br>/*** R<br>require(bigmemory)<br>
<div><br># set up big.matrix<br>nrows <- 10000<br>bkFile <- "bigmat.bk"<br>descFile <- "bigmatk.desc"<br></div>
<div>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></div>fun(bigmat@address)<br><br>cat("Done\n")<br>*/<br>
<div>
<div><br><br><br>--<br>Dirk Eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com/" target="_blank">http://dirk.eddelbuettel.com</a><br>_______________________________________________<br>
Rcpp-devel mailing list<br><a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">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><br clear="all"><br>-- <br>Aileen L.
<div><br>
<div>View my Linkedin profile: <a style="padding-left:0px;padding-right:0px;border-bottom-width:0px;padding-top:0px;padding-bottom:0px;border-top-width:0px;vertical-align:baseline;line-height:15px;outline-style:none;color:rgb(0,102,153);font-size:13px;border-right-width:0px;margin:0px;font-family:Arial,Helvetica,'Nimbus Sans L',sans-serif;border-left-width:0px" title="View public profile" href="http://au.linkedin.com/in/aileen2" name="13d6b4a6933e5e33_SafeHtmlFilter_SafeHtmlFilter_webProfileURL" target="_blank">http://au.linkedin.com/in/aileen2</a></div>
<div><br></div>
<div>
<h2 style="padding-right:2px;padding-left:0px;padding-top:2px;text-align:left;font-family:Geneva,Arial,Helvetica,sans-serif;margin:0px;font-weight:normal;min-height:35px;padding-bottom:0px">
<font color="#993399">Being happy doesn't mean you're perfect. It just means you've decided to look beyond the imperfectio</font><font color="#cc33cc">ns- <a style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;TEXT-DECORATION:none;PADDING-TOP:0px" href="http://www.boardofwisdom.com/default.asp?topic=1010&search=K%2EB+Indiana+%28age+14%29" target="_blank">K.B Indiana (age 14)</a></font></h2>
</div></div>
</div>