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.
- Host: GitHub
- URL: https://github.com/stla/rationalmatrix
- Owner: stla
- Created: 2023-01-23T13:18:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-27T13:28:04.000Z (over 2 years ago)
- Last Synced: 2025-02-06T16:05:44.202Z (8 months ago)
- Topics: eigen, gmp, r, rcpp
- Language: C++
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
title: "The 'RationalMatrix' package"
output: github_document
---[](https://github.com/stla/RationalMatrix/actions/workflows/R-CMD-check.yaml)
[](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))
```