def test_measurement_entangled_state(): # 1/sqrt(2) (|0> + |1>) c = Circuit().h[0].cx[0, 1] for _ in range(10000): c.run() result = c.last_result() assert result == (0, 0) or result == (1, 1)
def test_measurement_after_qubits1(): for _ in range(50): c = Circuit().h[0].m[0] a = c.run() if c.last_result() == (0, ): assert is_vec_same(a, np.array([1, 0])) else: assert is_vec_same(a, np.array([0, 1]))