An open API service indexing awesome lists of open source software.

https://github.com/stla/rationalmatrix

Exact matrix algebra for matrices with rational entries.
https://github.com/stla/rationalmatrix

eigen gmp r rcpp

Last synced: 6 months ago
JSON representation

Exact matrix algebra for matrices with rational entries.

Awesome Lists containing this project

README

          

---
title: "The 'RationalMatrix' package"
output: github_document
---

[![R-CMD-check](https://github.com/stla/RationalMatrix/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/stla/RationalMatrix/actions/workflows/R-CMD-check.yaml)
[![R-CMD-check-valgrind](https://github.com/stla/RationalMatrix/actions/workflows/R-CMD-check-valgrind.yaml/badge.svg)](https://github.com/stla/RationalMatrix/actions/workflows/R-CMD-check-valgrind.yaml)

*Exact matrix algebra for matrices with rational entries.*

```{r}
library(RationalMatrix)
```

```{r sim, echo=FALSE, message=FALSE}
library(gmp)
set.seed(666L)
numers <- rpois(16L, 5)
denoms <- 1L + rpois(16L, 2)
fractions <- paste0(numers, "/", denoms)
M <- as.character(as.bigq(matrix(fractions, nrow = 4L, ncol = 4L)))
```

```{r, collapse=TRUE}
# a rational matrix
M

# determinant
Qdet(M)

# inverse
Qinverse(M)

# check
library(gmp)
as.bigq(M) %*% as.bigq(Qinverse(M))
```