Closed nlwach closed 3 years ago
Hi - thanks for the question. It appears that Qutip does not support duck-typed ndarrays, as you can see in the source: https://github.com/qutip/qutip/blob/dc2abc4be6540a3a3c549ed21d8da83f3f0db5aa/qutip/qobj.py#L221-L343
JAX arrays do not meet any of the isinstance
checks used there, so they appear to be incompatible with the package. I would suggest explicitly casting the input to numpy, i.e.
Q_state = q.Qobj(np.asarray(state))
If you would like qutip to support JAX and other numpy-like array inputs natively (perhaps by checking for an __array__
attribute on the input), I would suggest opening a feature request in the Qutip repository.
I am trying to differentiate a quantum circuit which uses qutip. Whenever I try to create a
qutip.Qobj
using ajnp.array
the createdqutip.Qobj
is empty. Somewhere thejnp
arrays differ too much from the usualnp
arrays. The creation ofqutip.Qobj
using the standardnp.array
's works perfectly fine.Here the code for the
jnp
arrays:and the output
And using
NumPy
arrays:and the output