Computes the inverse of a triangular matrix.
Arguments
- x
An mlx array.
- upper
Logical; if
TRUE,xis upper triangular, otherwise lower triangular.- device
Execution target for APIs that expose a one-off device or stream override. Supply
"gpu","cpu", or anmlx_streamcreated viamlx_new_stream(). Ordinary array operations use the currentmlx_device()instead.
Examples
# Lower triangular matrix
L <- mlx_matrix(c(1:3, 0, 4:5, 0, 0, 6), 3, 3)
mlx_tri_inv(L, upper = FALSE, device = "cpu")
#> mlx array [3 x 3]
#> dtype: float32
#> values:
#> [,1] [,2] [,3]
#> [1,] 1.00000000 0.0000000 0.0000000
#> [2,] -0.50000000 0.2500000 0.0000000
#> [3,] -0.08333334 -0.2083333 0.1666667