MyNixOS website logo
Description

Exact Matrix Algebra for Rational Matrices.

Provides functions to deal with matrix algebra for matrices with rational entries: determinant, rank, image and kernel, inverse, Cholesky decomposition. All computations are exact.

The ‘RationalMatrix’ package

R-CMD-check R-CMD-check-valgrind

Exact matrix algebra for matrices with rational entries.

library(RationalMatrix)
# a rational matrix
M
##      [,1]   [,2]  [,3]  [,4] 
## [1,] "7"    "4/7" "1/4" "2/3"
## [2,] "3/5"  "2"   "3/2" "3/4"
## [3,] "10/3" "10"  "7"   "1"  
## [4,] "1"    "5/2" "1/3" "7/2"

# determinant
Qdet(M)
## [1] "-227405/3024"

# inverse
Qinverse(M)
##      [,1]            [,2]             [,3]              [,4]             
## [1,] "6678/45481"    "-2274/45481"    "2901/454810"     "-4338/227405"   
## [2,] "-17892/227405" "-491624/227405" "510993/1137025"  "397782/1137025" 
## [3,] "9324/227405"   "666168/227405"  "-525726/1137025" "-572424/1137025"
## [4,] "2352/227405"   "290964/227405"  "-316998/1137025" "101448/1137025"

# check
library(gmp)
as.bigq(M) %*% as.bigq(Qinverse(M))
## Big Rational ('bigq') 4 x 4 matrix:
##      [,1] [,2] [,3] [,4]
## [1,] 1    0    0    0   
## [2,] 0    1    0    0   
## [3,] 0    0    1    0   
## [4,] 0    0    0    1
Metadata

Version

1.0.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows