Publications by Rcpp Gallery
Call matplotlib from R
Motivation I often use Python and matplotlib for exploring measurement data (from e.g. accelerometers), even if I use R for the actual analysis. The reason is that I like to be able to flexibly zoom into different parts of the plot using the mouse and this works well for me with matplotlib. So I decided to try to call matplotlib from R using Rcpp...
2988 sym R (2052 sym/4 pcs) 2 img
Stochastic SIR Epidemiological Compartment Model
Introduction This post is a simple introduction to Rcpp for disease ecologists, epidemiologists, or dynamical systems modelers – the sorts of folks who will benefit from a simple but fully-working example. My intent is to provide a complete, self-contained introduction to modeling with Rcpp. My hope is that this model can be easily modified to ...
2645 sym R (4703 sym/3 pcs) 4 img
Serialize and Deserialize a C++ Object in Rcpp
This post shows how to serialize a c++ object to the raw vector in R and deserialize it with the help of Rcereal and BH. First, please install the Rcpp, Rcereal, and BH from CRAN and enable the support of C++11 via Sys.setenv("PKG_CXXFLAGS"="-std=c++11"). We can use the cereal library and boost iostreams in Rcpp. The following example shows a toy...
2137 sym R (1330 sym/2 pcs) 2 img
Writing fast asynchronous SGD/AdaGrad with RcppParallel
Word embeddings After Tomas Mikolov et al. released word2vec tool, there was a boom of articles about words vector representations. One of the greatest is GloVe, which did a big thing by explaining how such algorithms work. It also refolmulates word2vec optimization as a special kind of factoriazation for word cooccurences matrix. This post is de...
7640 sym R (5073 sym/8 pcs) 2 img
Introduction to RcppNT2
Modern CPU processors are built with new, extended instruction sets that optimize for certain operations. A class of these allow for vectorized operations, called Single Instruction / Multiple Data (SIMD) instructions. Although modern compilers will use these instructions when possible, they are often unable to reason about whether or not a part...
2855 sym R (1271 sym/5 pcs) 2 img
Using RcppNT2 to Compute the Variance
Introduction The Numerical Template Toolbox (NT2) collection of header-only C++ libraries that make it possible to explicitly request the use of SIMD instructions when possible, while falling back to regular scalar operations when not. NT2 itself is powered by Boost, alongside two proposed Boost libraries – Boost.Dispatch, which provides a mech...
3213 sym R (3174 sym/11 pcs) 2 img
Using RcppNT2 to Compute the Sum
Introduction The Numerical Template Toolbox (NT2) collection of header-only C++ libraries that make it possible to explicitly request the use of SIMD instructions when possible, while falling back to regular scalar operations when not. NT2 itself is powered by Boost, alongside two proposed Boost libraries – Boost.Dispatch, which provides a mech...
3988 sym R (1300 sym/7 pcs) 2 img
Using RcppNT2 to Compute the Variance
Introduction The Numerical Template Toolbox (NT2) collection of header-only C++ libraries that make it possible to explicitly request the use of SIMD instructions when possible, while falling back to regular scalar operations when not. NT2 itself is powered by Boost, alongside two proposed Boost libraries – Boost.Dispatch, which provides a mech...
3213 sym R (3174 sym/11 pcs) 2 img
Introduction to RcppNT2
Modern CPU processors are built with new, extended instruction sets that optimize for certain operations. A class of these allow for vectorized operations, called Single Instruction / Multiple Data (SIMD) instructions. Although modern compilers will use these instructions when possible, they are often unable to reason about whether or not a part...
2855 sym R (1271 sym/5 pcs) 2 img
SIMD Map-Reduction with RcppNT2
Introduction The Numerical Template Toolbox (NT2) collection of header-only C++ libraries that make it possible to explicitly request the use of SIMD instructions when possible, while falling back to regular scalar operations when not. NT2 itself is powered by Boost, alongside two proposed Boost libraries – Boost.Dispatch, which provides a mech...
5318 sym R (2759 sym/11 pcs) 2 img