The goal of cpp11eigen is to provide a novel approach to use the Eigen C++ library by using the header-only cpp11 R package and to simplify things for the end-user.
The idea is to pass matrices/vectors from R to C++, write pure C++/Eigen code for the computation, and then export the result back to R with the proper data structures.
This follows from the same goals as cpp11:
If this software is useful to you, please consider donating on Buy Me A Coffee. All donations
will be used to continue improving cpp11eigen
.
You can install the development version of cpp11eigen from GitHub:
::install_github("pachadotdev/cpp11eigen") remotes
I have provided a package template for RStudio that also works with VS Code.
The idea of this package is to be naive and simple (like me).
From RStudio/VSCode create a new project and run:
::pkg_template() cpp11eigen
Then follow the instructions from the README.
The vignettes contains detailed examples that I use to test
cpp11eigen
, these include Ordinary Least Squares.
Eigen supports OpenBLAS, Intel MKL, and the Accelerate framework (Mac). You can install OpenBLAS on Debian-based systems with:
sudo apt-get install libopenblas-dev
You can also use other commands for your specific operating system.
To verify that R is using OpenBLAS, you can run
sessionInfo()
after restarting R to check the BLAS/LAPACK
libraries in use:
: default
Matrix products: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 LAPACK