{"id":15047403,"url":"https://github.com/pachadotdev/cpp11armadillo","last_synced_at":"2025-04-10T00:51:13.308Z","repository":{"id":219315693,"uuid":"748702229","full_name":"pachadotdev/cpp11armadillo","owner":"pachadotdev","description":"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.","archived":false,"fork":false,"pushed_at":"2025-03-21T05:40:34.000Z","size":47208,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T00:51:02.980Z","etag":null,"topics":["armadillo","cpp","cpp11","hacktoberfest","linear-algebra","rstats"],"latest_commit_sha":null,"homepage":"http://pacha.dev/cpp11armadillo/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pachadotdev.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-26T15:23:27.000Z","updated_at":"2025-04-03T15:47:33.000Z","dependencies_parsed_at":"2024-08-09T01:47:17.007Z","dependency_job_id":null,"html_url":"https://github.com/pachadotdev/cpp11armadillo","commit_stats":null,"previous_names":["pachadotdev/cpp11armadillo","pachadotdev/armadillo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachadotdev%2Fcpp11armadillo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachadotdev%2Fcpp11armadillo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachadotdev%2Fcpp11armadillo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachadotdev%2Fcpp11armadillo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pachadotdev","download_url":"https://codeload.github.com/pachadotdev/cpp11armadillo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137997,"owners_count":21053775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["armadillo","cpp","cpp11","hacktoberfest","linear-algebra","rstats"],"created_at":"2024-09-24T20:57:47.393Z","updated_at":"2025-04-10T00:51:12.325Z","avatar_url":"https://github.com/pachadotdev.png","language":"C++","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n   collapse = TRUE,\n   comment = \"#\u003e\",\n   fig.path = \"man/figures/README-\",\n   out.width = \"100%\"\n)\n```\n\n# cpp11armadillo \u003cimg src=\"man/figures/logo.svg\" align=\"right\" height=\"139\" alt=\"\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/pachadotdev/cpp11armadillo/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/pachadotdev/cpp11armadillo/actions/workflows/R-CMD-check.yaml)\n[![codecov](https://codecov.io/gh/pachadotdev/cpp11armadillo/graph/badge.svg?token=mWfiUCgfNu)](https://app.codecov.io/gh/pachadotdev/cpp11armadillo)\n[![BuyMeACoffee](https://raw.githubusercontent.com/pachadotdev/buymeacoffee-badges/main/bmc-donate-white.svg)](https://buymeacoffee.com/pacha)\n[![CRAN status](https://www.r-pkg.org/badges/version/cpp11armadillo)](https://CRAN.R-project.org/package=cpp11armadillo)\n\u003c!-- badges: end --\u003e\n\n## About\n\nThe goal of cpp11armadillo is to provide a novel approach to use the [Armadillo\nC++ library](https://arma.sourceforge.net/docs.html) by using the header-only\ncpp11 R package and to simplify things for the end-user. It uses the Apache 2.0\nlicense.\n\n⚠️Important⚠️: cpp11armadillo was created to ease writing functions in your own\npackages and does not offer on-the-fly compilation for code snippets.\n\nThe idea is to pass matrices/vectors from R to C++, write pure C++/Armadillo\ncode for the computation, and then export the result back to R with the proper\ndata structures.\n\n[RcppArmadillo](https://cran.r-project.org/package=RcppArmadillo) is a\npopular R package used by over 1200 CRAN packages as of 2024-12-13.\nRcppArmadillo uses the GPL-3 license.\n\ncpp11armadillo has different internals, even when the goal is the same, and it\naims to:\n\n* Enforcing copy-on-write semantics.\n* Improving the safety of using the R API from C++ code.\n* Using UTF-8 strings everywhere.\n* Applying newer C++11 features.\n* Having a more straightforward, simpler implementation.\n* Faster compilation time with lower memory requirements.\n* Growing vectors more efficiently.\n\nThe design differences result in marginally higher speed for cpp11armadillo, and\nthe real difference for the end user is that cpp11armadillo:\n\n* Has a smaller memory footprint.\n* Uses the Apache license instead of GPL-3 (i.e., The Apache license is\n   permissive and allows commercial use with attribution, unlike the GPL-3,\n   which requires open-source redistribution.)\n* Can be vendored to be used in restricted environments (i.e., servers with no\n   internet access or where IT restricts the installation of packages).\n\nThis is expanded in our article [cpp11armadillo: An R package to use the Armadillo C++ library](https://dx.doi.org/10.1016/j.softx.2025.102087).\n\nIf this software is useful to you, please consider donating on\n[Buy Me A Coffee](https://buymeacoffee.com/pacha). All donations will\nbe used to continue improving cpp11armadillo.\n\n## Getting Started\n\nInstall the released version of cpp11armadillo from CRAN:\n\n``` r\ninstall.packages(\"cpp11armadillo\")\n```\n\nOr, alternatively, install the development version of cpp11armadillo from\nGitHub:\n\n``` r\nremotes::install_github(\"pachadotdev/cpp11armadillo\")\n```\n\n## Who uses cpp11armadillo?\n\ncpp11armadillo is used by the following packages:\n\n* [lotri](https://github.com/nlmixr2/lotri), created by Dr. Matt Fidler.\n* [economiccomplexity](https://github.com/pachadotdev/economiccomplexity),\n   created by me.\n\n## Examples\n\nI have provided a package template for RStudio that also works with VS Code.\n\nThe idea of this package is to be as simple as possible, with the least amount\nof setup to get you started.\n\nFrom RStudio/VSCode, go to an empty directory of your choice and run:\n\n```r\n# subdir + package name\n# subdir can be \".\" to create the package in the current directory\ncpp11armadillo::pkg_template(\"pkgtemplate\", \"myownpackage\")\n```\n\nThen follow the instructions from README.md in the path where the new package\nis. The template contains a simple Ordinary Least Squares (OLS) example that you\ncan run to test the package.\n\nThe vignette expands on the OLS estimator, and the\n[hansen package](https://pacha.dev/hansen/) expands on how to use cpp11armadillo\nfor Econometric models.\n\nThe [cpp11armadillotest](https://github.com/pachadotdev/cpp11armadillo/tree/main/cpp11armadillotest)\ndirectory contains a package that I use to test cpp11armadillo. It includes\ntests for OLS, eigenvalues, matrix decompositions (Cholesky and QR), the Capital\nAsset Pricing Model (CAPM), and data consistency between R and C++. Please note\nthat cpp11armadillotest is a dummy package to test the C++ build with GitHub\nActions, and you do not need to install it. You can check its code to get extra\nexamples.\n\n## Linear Algebra Libraries\n\nArmadillo supports OpenBLAS, Intel MKL, and the Accelerate framework (Mac).\n\nInstall OpenBLAS on Debian-based systems with:\n\n```bash\nsudo apt-get install libopenblas-dev\n```\n\nRestart R and run the following command to verify:\n\n```r\nsessionInfo()\n```\n\nR should display something like:\n\n```r\nMatrix products: default\nBLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 \nLAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0\n```\n","funding_links":["https://buymeacoffee.com/pacha"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpachadotdev%2Fcpp11armadillo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpachadotdev%2Fcpp11armadillo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpachadotdev%2Fcpp11armadillo/lists"}