Bug: linalg.kron
is not correct for matrices of ndims > 2
(original) (raw)
Description
See these discussions:
- Add rewrite to lift linear algebra through certain linalg ops #622
- ENH:linalg: kron does not support nd arrays with n>2 scipy/scipy#20072
The fix is easy enough, we just have to switch from the scipy implementation to the numpy implementation. We can follow the JAX implementation here.
An alternative would be to keep our implementation, but BlockWise
it so that the ndim > 2
case just broadcasts over the additional dimensions. It would make us equivalent to jax.vmap(jnp.kron)(A, B)
by default.