Working with sparse matrices in C++

Sparse matrices in RcppArmadillo can be a very useful resource to work with, especially when you are dealing with social networks. Here I provide a couple of examples in which we can take advantage of their structure by using iterators.

Setting up optional OpenMP support with RcppArmadillo

Setting up an R package that supports OpenMP can be a bit awkward. While systems like Ubuntu with g++ have straight forward support for -fopenmp flags, the same may not be true un MacOS’s clang, since the latter is not shipped with it. In order to solve this, it is necesary to have different src/Makevars file depending on whether the compiler supports OpenMP or not. This can be solved using a configure file, more over, autoconf.