inv_p {matrixmodp} | R Documentation |
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)
[Package matrixmodp version 0.2.0 Index]