Beispiel #1
0
 def test_transpose(self):
     """test transpose"""
     ham = HamiltonianGate([[15, 1j], [-1j, -2]], np.pi / 7)
     np.testing.assert_array_almost_equal(ham.transpose().to_matrix(),
                                          np.transpose(ham.to_matrix()))
Beispiel #2
0
 def test_adjoint(self):
     """test adjoint operation"""
     ham = HamiltonianGate([[3, 4j], [-4j, -.2]], np.pi * .143)
     np.testing.assert_array_almost_equal(
         ham.adjoint().to_matrix(), np.transpose(np.conj(ham.to_matrix())))
Beispiel #3
0
 def test_conjugate(self):
     """test conjugate"""
     ham = HamiltonianGate([[0, 1j], [-1j, 2]], np.pi / 4)
     np.testing.assert_array_almost_equal(ham.conjugate().to_matrix(),
                                          np.conj(ham.to_matrix()))