Eigen decomposition for mlx arrays
Arguments
- x
An mlx matrix (2-dimensional array).
- 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
x <- mlx_matrix(c(2, -1, 0, 2), 2, 2)
eig <- mlx_eig(x, device = "cpu")
eig$values
#> mlx array [2]
#> dtype: complex64
#> values:
#> [1] 2+0i 2+0i
eig$vectors
#> mlx array [2 x 2]
#> dtype: complex64
#> values:
#> [,1] [,2]
#> [1,] 2.384186e-07+0i 0+0i
#> [2,] 1.000000e+00+0i 1+0i