MyNixOS website logo
Description

Working with Matrices over Finite Prime Fields.

Provides functions for row-reducing and inverting matrices with entries in many of the finite fields (those with a prime number of elements). With this package, users will be able to find the reduced row echelon form (RREF) of a matrix and calculate the inverse of a (square, invertible) matrix.

matrixmodp

R-CMD-check

The goal of matrixmodp is to make two matrix algebra tasks easier when working with the fields $\mathbb{F}_p$. Specifically, this package provides two functions: rref_p() calculates the reduced-row echelon form of a matrix, and inv_p() calculates the inverse of a (square, invertible) matrix.

Installation

You can install the public released version of matrixmodp from CRAN with:

install.packages("matrixmodp")
#> Installing package into 'C:/Users/rhigginbottom/AppData/Local/Temp/Rtmpc35hmI/temp_libpath93c0442736d5'
#> (as 'lib' is unspecified)
#> Warning: package 'matrixmodp' is not available for this version of R
#> 
#> A version of this package for your version of R might be available elsewhere,
#> see the ideas at
#> https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

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

# install.packages("devtools")
devtools::install_github("rhigginbottom/matrixmodp")

Example

We first provide an example of finding the RREF of a matrix with entries in $\mathbb{F}_5$.

library(matrixmodp)
entries <- c(4, 1, 2, 0, 0, 3, 4, 0, 0, 1, 4, 1)
A <- matrix(entries, 3, 4)
rref_p(A, 5)
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    0    0    4
#> [2,]    0    1    0    1
#> [3,]    0    0    1    0

We now show how to find the inverse of a $3\times 3$ matrix over $\mathbb{F}_7$.

library(matrixmodp)
entries <- c(3, 3, 3, 2, 0, 2, 1, 2, 5)
A <- matrix(entries, 3, 3)
inv_p(A, 7)
#>      [,1] [,2] [,3]
#> [1,]    6    5    1
#> [2,]    3    3    1
#> [3,]    5    0    2

Note

Some of the code for the rref_p() function was taken from the echelon() function in the matlib package. Because of the different way row operations need to work when using entries in $\mathbb{F}_p$, no functions could be copied entirely. This makes attribution somewhat difficult. The license chosen for this package was specifically chosen to be compatible with the license in use for the matlib package because of this overlap in code.

Metadata

Version

0.2.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