Computes the inverse of a numeric or character matrix.

mxinv(x)

Arguments

x

numeric or character matrix.

Value

numeric or character matrix.

References

Guidotti, E. (2020). "calculus: High dimensional numerical and symbolic calculus in R". https://arxiv.org/abs/2101.00086

See also

Other matrix algebra: mxdet(), mxtr(), mx()

Examples

### numeric matrix
x <- matrix(1:4, nrow = 2, byrow = TRUE)
mxinv(x)
#>      [,1] [,2]
#> [1,] -2.0  1.0
#> [2,]  1.5 -0.5

### symbolic matrix
x <- matrix(letters[1:4], nrow = 2, byrow = TRUE)
mxinv(x)
#>      [,1]                                [,2]                               
#> [1,] "((d)) / ((a)*((d)) + -(c)*((b)))"  "-((b)) / ((a)*((d)) + -(c)*((b)))"
#> [2,] "-((c)) / ((a)*((d)) + -(c)*((b)))" "((a)) / ((a)*((d)) + -(c)*((b)))"