dq.isqarraylike
isqarraylike(x: Any) -> bool
Returns True if the input is a qarray-like.
Parameters
-
x
–
Any object.
Returns
True if x
is a numeric types (bool
, int
, float
, complex
), a NumPy or
JAX array, a Dynamiqs qarray, a QuTiP qobj, or any nested sequence of these
types.
See also
dq.asqarray()
: converts a qarray-like into a qarray.
Examples
>>> dq.isqarraylike(1)
True
>>> dq.isqarraylike(qt.fock(5, 0))
True
>>> dq.isqarraylike([qt.fock(5, 0), qt.fock(5, 1)])
True