Package 'matrixmodp'

Title: Working with Matrices over Finite Prime Fields
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.
Authors: Ryan Higginbottom [aut, cre, cph]
Maintainer: Ryan Higginbottom <[email protected]>
License: GPL (>= 2)
Version: 0.2.0
Built: 2024-11-13 06:14:25 UTC
Source: https://github.com/rhigginbottom/matrixmodp

Help Index


Calculate the inverse of a matrix mod p

Description

inv_p() finds the inverse of a square matrix over the field FpF_p. The function checks for invertibility and then row-reduces the augmented matrix [AI][A|I] over FpF_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 FpF_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)