Exemplo n.º 1
0
    def test_apply_bit_flip_single_wire(
        self, simulator_device_1_wire, tol, par, input, expected_density_matrix
    ):
        """Tests that applying a bit flip operation yields the expected output state for single wire."""

        simulator_device_1_wire.reset()
        simulator_device_1_wire._initial_state = np.array(input, dtype=np.complex64)
        simulator_device_1_wire.apply([ops.BitFlip(*par, wires=[0])])

        assert np.allclose(simulator_device_1_wire.state, expected_density_matrix, **tol)
 def bell_pair():
     qml.Hadamard(wires=0)
     qml.CNOT(wires=[0, 1])
     cirq_ops.BitFlip(p, wires=0)
     cirq_ops.BitFlip(p, wires=1)