| Title: | Working with Matrices over Finite Prime Fields |
| Version: | 0.2.0 |
| Description: | 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. |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.1 |
| Suggests: | testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| URL: | https://github.com/rhigginbottom/matrixmodp, https://rhigginbottom.github.io/matrixmodp/ |
| BugReports: | https://github.com/rhigginbottom/matrixmodp/issues |
| NeedsCompilation: | no |
| Packaged: | 2024-07-01 15:46:42 UTC; rhigginbottom |
| Author: | Ryan Higginbottom [aut, cre, cph] |
| Maintainer: | Ryan Higginbottom <rhigginbottom@washjeff.edu> |
| Repository: | CRAN |
| Date/Publication: | 2024-07-02 15:10:05 UTC |
Calculate the inverse of a matrix mod p
Description
inv_p() finds the inverse of a square matrix over the field F_p. The function checks for invertibility and then row-reduces the augmented matrix [A|I] over F_p to find the inverse.
Usage
inv_p(A, p)
Arguments
A |
A square matrix |
p |
A prime integer |
Value
A square matrix of the same size as A
Examples
B <- matrix(c(5, 2, 3, 6, 5, 5, 4, 0, 2), 3, 3)
inv_p(B, 7)
C <- matrix(c(3, 0, 4, 0, 2, 1, 1, 3, 0, 3, 0, 1, 3, 0, 2, 1), 4, 4)
inv_p(C, 5)
Find the RREF of a matrix mod p
Description
rref_p() calculates the unique reduced-row echelon form of a matrix with entries in the finite field F_p.
Usage
rref_p(A, p)
Arguments
A |
A matrix |
p |
A prime integer |
Value
A matrix of the same size as A which is the unique reduced-row echelon form of A.
Examples
B <- matrix(c(3, 4, 1, 3, 2, 0), 2, 3)
rref_p(B, 5)
C <- matrix(c(0, 2, 0, 0, 0, 2, 0, 1, 1), 3, 3)
rref_p(C, 3)