Since we are short of time let us just make thin wrappers around qutip for these issues.

rand_unitary_ndarray[source]

rand_unitary_ndarray(ndarray_shape)

Make a random unitary ndarray of ndarray_shape

rand_unitary_ndarray((2, 2))
array([[ 0.86427001-0.03016381j, -0.4464092 -0.22988329j],
       [ 0.49357313+0.09226627j,  0.66408047+0.55395815j]])

test_unitary_ndarray[source]

test_unitary_ndarray(ndarray)

Returns true if array is unitaryitian

a = rand_unitary_ndarray((9, 9))
test_unitary_ndarray(a)
True