def test_ph(angle):
gate = _gates.Ph(angle)
gate2 = _gates.Ph(angle + 2 * math.pi)
expected_matrix = np.matrix([[cmath.exp(1j * angle), 0],
[0, cmath.exp(1j * angle)]])
assert gate.matrix.shape == expected_matrix.shape
assert np.allclose(gate.matrix, expected_matrix)
assert gate2.matrix.shape == expected_matrix.shape
assert np.allclose(gate2.matrix, expected_matrix)
assert gate == gate2
评论列表
文章目录