Skip to contents

If x is not symmetric positive semi-definite, "behaviour is undefined" according to the MLX documentation.

Usage

# S3 method for class 'mlx'
chol(x, pivot = FALSE, ..., device = NULL)

Arguments

x

An mlx matrix (2-dimensional array).

pivot

Ignored; pivoted decomposition is not supported.

...

Additional arguments; ignored.

device

Execution target for APIs that expose a one-off device or stream override. Supply "gpu", "cpu", or an mlx_stream created via mlx_new_stream(). Ordinary array operations use the current mlx_device() instead.

Value

Upper-triangular Cholesky factor as an mlx matrix.

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

x <- mlx_matrix(c(4, 1, 1, 3), 2, 2)
chol(x, device = "cpu")
#> mlx array [2 x 2]
#>   dtype: float32
#>   values:
#>      [,1]     [,2]
#> [1,]    2 0.500000
#> [2,]    0 1.658312