Skip to content

The idea is to pass matrices/vectors from R to C++, write pure C++/Armadillo code for the computation, and then export the result back to R with the proper data structures.

License

Notifications You must be signed in to change notification settings

pachadotdev/cpp11armadillo

Repository files navigation

cpp11armadillo

R-CMD-check codecov BuyMeACoffee CRAN status

The goal of cpp11armadillo is to provide a novel approach to use the Armadillo 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++/Armadillo 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:

  • Enforcing copy-on-write semantics.
  • Improving the safety of using the R API from C++ code.
  • Using UTF-8 strings everywhere.
  • Applying newer C++11 features.
  • Having a more straightforward, simpler implementation.
  • Faster compilation time with lower memory requirements.
  • Growing vectors more efficiently.

If this software is useful to you, please consider donating on Buy Me A Coffee. All donations will be used to continue improving cpp11armadillo.

Installation

You can install the development version of cpp11armadillo like so:

remotes::install_github("pachadotdev/cpp11armadillo")

Examples

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:

cpp11armadillo::pkg_template()

Then follow the instructions from the README.

The vignettes contains detailed examples that I use to test cpp11armadillo, these include Ordinary Least Squares, Leontief inverse, eigenvalues, and the Capital Asset Pricing Model (CAPM).

Next steps

Provide support for sparse matrices. At the moment, cpp11armadillo only works with dense matrices.

About

The idea is to pass matrices/vectors from R to C++, write pure C++/Armadillo code for the computation, and then export the result back to R with the proper data structures.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages