def test_diag_liou_mult(dimension): "BR Tools : Diagonal Liouvillian mult" H = qutip.rand_dm(dimension, 0.5) evals, evecs = H.eigenstates() L = qutip.liouvillian(H.transform(evecs)) coefficients = np.ones((dimension * dimension, ), dtype=np.complex128) calculated = np.zeros_like(coefficients) target = L.data.dot(coefficients) _test_diag_liou_mult(evals, coefficients, calculated, dimension) np.testing.assert_allclose(target, calculated, atol=1e-11, rtol=1e-6)
def test_diag_liou_mult(): "BR Tools : Diagonal Liouvillian mult" for dimension in range(2, 100): H = qutip.rand_dm(dimension, 0.5) evals, evecs = H.eigenstates() L = qutip.liouvillian(H.transform(evecs)) coefficients = np.ones((dimension*dimension,), dtype=np.complex128) calculated = np.zeros_like(coefficients) target = L.data.dot(coefficients) _test_diag_liou_mult(evals, coefficients, calculated, dimension) assert np.allclose(target, calculated)
def test_diag_liou_mult(): "BR Tools : Diagonal liouvillian mult" for kk in range(2,100): H = rand_dm(kk,0.5) evals, evecs = H.eigenstates() H_eig = H.transform(evecs) L = liouvillian(H_eig) y = np.ones(kk**2, dtype=complex) out = np.zeros(kk**2, dtype=complex) ans = L.data.dot(y) _test_diag_liou_mult(evals,y,out,H.shape[0]) assert_(np.allclose(ans,out))