Describe the bug
Calling linalg.cholesky on an empty (0, 0) matrix aborts the process. Found here: data-apis/array-api-compat#450 (comment)
To Reproduce
import mlx.core as mx
a = mx.zeros((0, 0))
r = mx.linalg.cholesky(a)
mx.eval(r) # process aborts here
Output:
** On entry to POTRF, parameter number 4 had an illegal value
libc++abi: terminating due to uncaught exception of type std::runtime_error: [Cholesky::eval_cpu] Cholesky decomposition failed with error code -4
[1] 31154 abort
Expected behavior
Return an empty (0, 0) array
Desktop (please complete the following information):
- OS Version: MacOS 26.5.1
- MLX Version: 0.32.0
Describe the bug
Calling
linalg.choleskyon an empty (0, 0) matrix aborts the process. Found here: data-apis/array-api-compat#450 (comment)To Reproduce
Output:
Expected behavior
Return an empty (0, 0) array
Desktop (please complete the following information):