-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
40 lines (31 loc) · 980 Bytes
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
title: "The 'RationalMatrix' package"
output: github_document
---
<!-- badges: start -->
[![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)
<!-- badges: end -->
*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))
```