def test_cop_super_mult(): "BR Tools : cop_super_mult" dimension = 10 for _ in range(50): H = qutip.rand_herm(dimension, 0.5) basis = H.eigenstates()[1] a = qutip.destroy(dimension) L = qutip.liouvillian(None, [a.transform(basis)]) vec = np.ones((dimension * dimension, ), dtype=np.complex128) target = L.data.dot(vec) calculated = np.zeros_like(target) _eigenvalues = np.empty((dimension, ), dtype=np.float64) _cop_super_mult(a.full('F'), _test_zheevr(H.full('F'), _eigenvalues), vec, 1, calculated, dimension, qutip.settings.atol) np.testing.assert_allclose(target, calculated, atol=1e-12)
def test_cop_super_mult(): "BR Tools : cop_super_mult" N = 10 for kk in range(50): H = rand_herm(N,0.5) R = rand_dm(N,0.5) a = destroy(N) A = a.transform(H.eigenstates()[1]) vec = np.ones(N**2,dtype=complex) L = liouvillian(None,[A]) ans = L.data.dot(vec) eigvals = np.zeros(N,dtype=float) Z = _test_zheevr(H.full('F'),eigvals) out = np.zeros_like(vec) _cop_super_mult(a.full('F'), Z, vec, 1, out, N, qset.atol) assert_(np.allclose(ans,out))