Re: [Rcpp-devel] presentation
That is fine. It is there anyway. If anyone wants to download it, he is welcome to do so. Aileen Lin On 23 May 2013 00:43, Dirk Eddelbuettel e...@debian.org wrote: On 22 May 2013 at 14:20, Smith, Dale (Norcross) wrote: | Is it similar to the Revolution Analytics presentation | | http://www.revolutionanalytics.com/news-events/free-webinars/2011/ | successful-uses-of-r-sas-in-banking/ | | I am unable to access meetup.com at work so hosting it on Rcpp Gallery would be | greatly appreciated. The Rcpp Gallery has a clearly defined scope: short, succinct use cases, tricks and applications involving Rcpp. It also has a clearly documented way of contributing (see the linkt). We take submissions in .Rmd and .cpp with suitable markup. And allow me to make it very plain: Rcpp Gallery is *not* a random hosting site for semi-random Rcpp content, nor is it a means of circumventing one user's corporate firewall. I am very appreciative of Aileen's presentation, but if that content needs to be hosted somewhere, maybe Aileen needs to start a blog or submit it somewhere else. I hope this clears up any possibly misunderstanding. Dirk -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
[Rcpp-devel] presentation
Hi there, I did a presentation on how to manage credit risk by using sas and R in SURF (Sydney Users of R Forum). Part of it has something to do with Rcpp. The slides are simple and use many Rcpp examples found online. The value of the slides is that Rcpp gets used in a commercial context. I would like to make it available in Rcpp gallery (my manager is OK with the slides going online), but not sure it is good enough for it. There are gaps here and there in the slides due to confidentiality. If I miss any reference in the slides, please also let me know. The link is here: http://files.meetup.com/1656767/Presentation_slides.pdf Regards, Aileen L. ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
[Rcpp-devel] rcpp + bigmemory
Hi there, I tried to build a package where I used rcpp and bigmemory. My .cpp file starts with: // [[Rcpp::depends(bigmemory)]] #include Rcpp.h #include bigmemory/MatrixAccessor.hpp using namespace Rcpp; ~~~ However, there is an error message: devtools::document()Updating cafs documentationLoading cafsRe-compiling cafsC:/PROGRA~1/R/R-215~1.3/bin/i386/R --vanilla CMD INSTALL \ C:\Documents and Settings\F051133\Desktop\cafs \ --library=C:\DOCUME~1\F051133\LOCALS~1\Temp\RtmpsBikUM --no-R \ --no-data --no-help --no-demo --no-inst --no-docs --no-multiarch \ --no-test-load --preclean * installing *source* package 'cafs' ... ** libs g++ -m32 -IC:/PROGRA~1/R/R-215~1.3/include -DNDEBUG -IH:/R/win-library/2.15/Rcpp/include -Id:/RCompile/CRANpkg/extralibs64/local/include -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o g++ -m32 -IC:/PROGRA~1/R/R-215~1.3/include -DNDEBUG -IH:/R/win-library/2.15/Rcpp/include -Id:/RCompile/CRANpkg/extralibs64/local/include -O2 -Wall -mtune=core2 -c rcpp_hello_world.cpp -o rcpp_hello_world.o g++ -m32 -IC:/PROGRA~1/R/R-215~1.3/include -DNDEBUG -IH:/R/win-library/2.15/Rcpp/include -Id:/RCompile/CRANpkg/extralibs64/local/include -O2 -Wall -mtune=core2 -c sbi.cpp -o sbi.o sbi.cpp:3:40: fatal error: bigmemory/MatrixAccessor.hpp: No such file or directory compilation terminated. make: *** [sbi.o] Error 1 ERROR: compilation failed for package 'cafs' * removing 'C:/DOCUME~1/F051133/LOCALS~1/Temp/RtmpsBikUM/cafs'Error: Command failed (1) Does anyone know how to fix it? Thank you. Regards, Aileen L. View my Linkedin profile: http://au.linkedin.com/in/aileen2 Being happy doesn't mean you're perfect. It just means you've decided to look beyond the imperfections- K.B Indiana (age 14)http://www.boardofwisdom.com/default.asp?topic=1010search=K%2EB+Indiana+%28age+14%29 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
[Rcpp-devel] Rcpp+bigmemory
Problem solved. Need to add bigmemory after ' linking:' in description file. Thanks. Aileen Lin View my profile: au.linkedin.com/in/aileen2 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Re: [Rcpp-devel] Rcpp+bigmemory
Yes, I did it. Thanks. Aileen Lin View my profile: au.linkedin.com/in/aileen2 On 2 Apr 2013 21:03, JJ Allaire jj.alla...@gmail.com wrote: Hi Aileen, You should also add bigmemory to the the Depends line of the DESCRIPTION file. See: http://cran.r-project.org/doc/manuals/R-exts.html#Linking-to-native-routines-in-other-packages J.J. On Tue, Apr 2, 2013 at 2:49 AM, Aileen Lin aileenshanhong@gmail.comwrote: Problem solved. Need to add bigmemory after ' linking:' in description file. Thanks. Aileen Lin View my profile: au.linkedin.com/in/aileen2 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
[Rcpp-devel] Fwd: Re: Filling a big.matrix in Rcpp
Aileen Lin View my profile: au.linkedin.com/in/aileen2 -- Forwarded message -- From: Aileen Lin aileenshanhong@gmail.com Date: 15 Mar 2013 10:44 Subject: Re: [Rcpp-devel] Filling a big.matrix in Rcpp To: Dirk Eddelbuettel e...@debian.org Cc: I tried your source code and had two warning messages: g++ -IC:/R/R-215~1.2/include -DNDEBUG -IC:/R/R-2.15.2/library/Rcpp/include -IH:/R/win-library/2.15/bigmemory/include -O2 -Wall -mtune=core2 -c rcpp_bm_test.cpp -o rcpp_bm_test.o In file included from H:/R/win-library/2.15/bigmemory/include/boost/smart_ptr/detail/spinlock_sync.hpp:18:0, from H:/R/win-library/2.15/bigmemory/include/boost/smart_ptr/detail/spinlock.hpp:38, from H:/R/win-library/2.15/bigmemory/include/boost/smart_ptr/detail/spinlock_pool.hpp:25, from H:/R/win-library/2.15/bigmemory/include/boost/smart_ptr/shared_ptr.hpp:37, from H:/R/win-library/2.15/bigmemory/include/boost/shared_ptr.hpp:17, from H:/R/win-library/2.15/bigmemory/include/bigmemory/BigMatrix.h:6, from H:/R/win-library/2.15/bigmemory/include/bigmemory/MatrixAccessor.hpp:4, from rcpp_bm_test.cpp:7: H:/R/win-library/2.15/bigmemory/include/boost/smart_ptr/detail/yield_k.hpp:58:48: warning: declaration of 'void boost::detail::Sleep(unsigned int)' with C language linkage [enabled by default] H:/R/win-library/2.15/bigmemory/include/boost/interprocess/detail/win32_api.hpp:382:49: warning: conflicts with previous declaration 'void boost::interprocess::winapi::Sleep(long unsigned int)' [enabled by default] 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 Do you have the same warning messages? Do you know how to get rid of it? Thank you. On 15 March 2013 05:33, Dirk Eddelbuettel e...@debian.org wrote: 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 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- #include Rcpp.h // The next line is all it takes to find the bigmemory // headers -- thanks to the magic of Rcpp attributes // [[Rcpp::depends(bigmemory)]] #include bigmemory/MatrixAccessor.hpp // We define a simple function, and pass the incoming XPtr as a SEXP; // we could also pass a templated XPtr. Function returns only a bool. // [[Rcpp::export]] bool fun(SEXP A) { Rcpp::XPtrBigMatrix bigMat(A); MatrixAccessorint Am(*bigMat); int nrows = bigMat-nrow(); int ncolumns = bigMat-ncol(); for (int j = 0; j ncolumns; j++){ for (int i = 1; i nrows; i++){ Am[j][i] = Am[j][i] + Am[j][i-1]; } } return Rcpp::wrap(true); } // R code for testing below /*** R require(bigmemory) # set up big.matrix nrows - 1 bkFile - bigmat.bk descFile - bigmatk.desc bigmat - filebacked.big.matrix(nrow=nrows, ncol=3,type=integer, init=1, backingfile=bkFile, backingpath=.,descriptorfile=descFile, dimnames=c(NULL,NULL)) matDesc - bigmemory::describe(bigmat) fun(bigmat@address) cat(Done\n) */ -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel -- Aileen L. View my Linkedin profile: http://au.linkedin.com/in/aileen2 Being happy doesn't mean you're perfect. It just means you've decided to look beyond the imperfections- K.B Indiana (age 14)http://www.boardofwisdom.com/default.asp?topic=1010search=K%2EB+Indiana+%28age+14%29 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
[Rcpp-devel] not sure if it's a rcpp question or a cpp question
My C code: //[[Rcpp::depends(Rcpp)]] #include Rcpp.h #include iostream using namespace Rcpp; //[[Rcpp::export]] NumericVector sigmutest(double pd, double rsq){ double qpd = R::qnorm(pd, 0, 1, 1, 0); double sgtemp = 0.2; double sg = 0.3; double eor = 1; double w = 0; while (eor=0.0001) { sg = sgtemp; w = pd * 0.4 / (R::pnorm((qpd - sqrt(rsq) * (-0.42) * sgtemp), 0, 1, 1, 0)); sgtemp = (-0.5) * w + 0.4; std::cout sg sg std::endl; std::cout sgtemp sgtemp std::endl; eor = abs(sg - sgtemp); std::cout error eor std::endl; } NumericVector out(3); out(0) = sg; out(1) = sgtemp; out(2) = eor; return out; } My R code: Rcpp::sourceCpp('src/sbi.cpp') x - sigmutest(0.0002327279, 0.1025499338)sg 0.2 sgtemp 0.219135 error 0 Does anyone know what is going on? Thanks. -- Aileen L. View my Linkedin profile: http://au.linkedin.com/in/aileen2 Being happy doesn't mean you're perfect. It just means you've decided to look beyond the imperfections- K.B Indiana (age 14)http://www.boardofwisdom.com/default.asp?topic=1010search=K%2EB+Indiana+%28age+14%29 ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
[Rcpp-devel] Roxygen2 + rcpp
Hi there, I gained a lot of benefit from your discussion and rcpp gallery. Thank you very much. Just wondering whether roxygen2 can read those comments in my .CPP files. Regards, Aileen Lin ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
[Rcpp-devel] r crashed
Hi there, Thanks for replies for my earlier enquiries. I had an error message: 'R encoutered a fatal error. This session was terminated'. My code is here: //[[Rcpp::depends(RcppArmadillo)]] #include Rcpp.h #include vector #include iostream using namespace std; using std::vector; using namespace Rcpp; typedef vectorvectorvectordoublearray3d; //[[Rcpp::export]] array3d systematic_composite(NumericMatrix cdx, NumericMatrix idx, NumericMatrix cs_compvar){ array3d arraysc; int d1 = cdx.ncol(); int d2 = idx.ncol(); int d3 = cdx.nrow(); arraysc.resize(d1); for (int i=0; id1; ++i){ arraysc[i].resize(d2); for (int j=0; jd2; ++j){ arraysc[i][j].resize(d3); } } for (int i=0; id1; ++i){ for (int j=0; jd2; ++j){ for (int k=0; kd3; ++k){ arraysc[i][j][k] = (cdx(k,i) + idx(k,j))/sqrt(cs_compvar(i,j)); } } } return arraysc; } //[[Rcpp::export]] NumericVector wrap_sim1(NumericMatrix cdx, NumericMatrix idx, NumericMatrix cs_compvar, NumericMatrix pf_agg, NumericVector noise, int w_pdlgd){ int d1 = pf_agg.nrow(); int d2 = cdx.nrow(); double ci=0, di=0; double core_temp = 0, grp_avgpd_temp = 0, lgd_temp = 0; double w_circle = sqrt(1-w_pdlgd*w_pdlgd); NumericVector lln_temp(d2); NumericVector lln_sum(d2); for (int i=0; id2; ++i) lln_sum(i) = 0; array3d corex = systematic_composite(cdx, idx, cs_compvar); for (int j=0; jd1; ++j){ ci = pf_agg(j, 0); di = pf_agg(j, 1); for (int k=0; kd2; ++k){ core_temp = corex[ci][di][k]; grp_avgpd_temp = Rcpp::stats::pnorm_0( (pf_agg(j, 7)- pf_agg(j, 8) * core_temp)/pf_agg(j, 9), 1,0); lgd_temp = exp( pf_agg(j,4) + pf_agg(j,5) *( w_pdlgd *core_temp + noise(k) * w_circle) ); lln_temp(k) = pf_agg(j, 6) * grp_avgpd_temp * lgd_temp; lln_sum(k) = lln_sum(k) + lln_temp(k); } } return lln_sum; } ### R: system.time(x - wrap_sim1(cdx[,], idx[,], csx[,], pfagg_expand, noise1, -0.42)) cdx is a big matrix 100K*7 idx is a big matrix 100k*14 csx is a big matrix 7*14 pfagg_expand is a matrix 2323*10 They are all numerical. in this case, my R program crashes. if I replace pfagg_expand with pfagg_expand[c(2,3),] in my R command, it works fine. Any idea what is going on? Thank you. -- Aileen L. ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
[Rcpp-devel] an error message from RcppArmadillo: sourceRcpp
Hi there, I get RcppArmadillo running, but still has a problem with Rcpp::sourceCpp(). My code is here: #include Rcpp.h #include RcppArmadillo.h using namespace Rcpp; //[[Rcpp::export]] NumericMatrix add(NumericMatrix b){ return b.n_cols; } Rcpp::sourceCpp('add.cpp') g++ -m64 -IC:/R/R-215~1.2/include -DNDEBUG -IC:/Users/Aileen/Documents/R/win-library/2.15/Rcpp/include -Id:/RCompile/CRANpkg/extralibs64/local/include -O2 -Wall -mtune=core2 -c add.cpp -o add.o add.cpp:2:27: fatal error: RcppArmadillo.h: No such file or directory compilation terminated. make: *** [add.o] Error 1 Error in Rcpp::sourceCpp(add.cpp) : Error 1 occurred building shared library. Could anyone tell me what I did wrongly? Thank you. Regards, Aileen ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel