/cpp11gaussjordan

A naive implementation of the Gauss-Jordan algorithm with vendoring

Primary LanguageC++Apache License 2.0Apache-2.0

cpp11gaussjordan

All the Cpp11 + R examples were moved to https://github.com/pachadotdev/cpp11-r-examples

The goal of cpp11gaussjordan is to show an implementation of the Gauss-Jordan algorithm that uses cpp11 vendoring capabilities.

I wrote about cpp11 vendoring in my blog.

Installation

You can install the development version of cpp11gaussjordan from GitHub with:

# install.packages("devtools")
devtools::install_github("pachadotdev/cpp11gaussjordan")

Example

This is a basic example which shows you how to invert a matrix:

library(cpp11gaussjordan)

A <- matrix(c(2,1,3,-1), nrow = 2, ncol = 2)
invert_matrix(A)

> invert_matrix(A)
     [,1] [,2]
[1,]  0.2  0.6
[2,]  0.2 -0.4