Skip to contents

Computes the inverse of a square matrix.

Usage

mlx_inv(x)

Arguments

x

An mlx array.

Value

The inverse of x.

Examples

A <- as_mlx(matrix(c(4, 7, 2, 6), 2, 2))
A_inv <- mlx_inv(A)
# Verify: A %*% A_inv should be identity
as.matrix(A %*% A_inv)
#>              [,1] [,2]
#> [1,] 1.000000e+00    0
#> [2,] 3.576279e-07    1