Esempio n. 1
0
 def test_ket_vec(self):
     assert_allclose(self.rho_v,
                     liouville_space.matrix_to_ket_vec(self.rho_d))
     assert_allclose(liouville_space.ket_vec_to_matrix(self.rho_v),
                     self.rho_d)
     assert_allclose(liouville_space.matrix_to_ket_vec(
                         liouville_space.ket_vec_to_matrix(self.rho_v)),
                     self.rho_v)
Esempio n. 2
0
 def test_super_matrices(self):
     assert_allclose(
         liouville_space.matrix_to_ket_vec(self.operator.dot(self.rho_d)),
         liouville_space.super_left_matrix(self.operator).dot(self.rho_v))
     assert_allclose(
         liouville_space.matrix_to_ket_vec(self.rho_d.dot(self.operator)),
         liouville_space.super_right_matrix(self.operator).dot(self.rho_v))
     assert_allclose(
         liouville_space.matrix_to_ket_vec(self.operator.dot(self.rho_d)
                                           - self.rho_d.dot(self.operator)),
         liouville_space.super_commutator_matrix(self.operator).dot(self.rho_v))
Esempio n. 3
0
 def test_bra_vec(self):
     rho_bra_vec = liouville_space.matrix_to_bra_vec(self.rho_d)
     assert_allclose(rho_bra_vec, 0.25 * np.array([1, 2 - 2j, 2 + 2j, 3]))
     operator_vec = liouville_space.matrix_to_ket_vec(self.operator)
     assert_allclose(np.einsum('ij,ji', self.rho_d, self.operator),
                     rho_bra_vec.dot(operator_vec))