Compute the inverse of a symmetric, positive definite matrix from its
Cholesky decomposition. The input x should be an upper triangular matrix
from chol().
Arguments
- x
An mlx matrix (2-dimensional array).
- size
Ignored; included for compatibility with base R.
- ...
Additional arguments; ignored.
- 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.
Details
As of MLX 0.31.1, this operation only runs on CPU. Run it inside
with_device() or local_device(), or pass device = "cpu".
Examples
A <- mlx_matrix(c(4, 1, 1, 3), 2, 2)
U <- chol(A, device = "cpu")
A_inv <- chol2inv(U, device = "cpu")
# Verify: A %*% A_inv should be identity
A %*% A_inv
#> mlx array [2 x 2]
#> dtype: float32
#> values:
#> [,1] [,2]
#> [1,] 1 0
#> [2,] 0 1