示例#1
0
    def test_apply_phase_damp_single_wire(
        self, simulator_device_1_wire, tol, par, input, expected_density_matrix
    ):
        """Tests that applying a phase damping 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.PhaseDamp(*par, wires=[0])])

        assert np.allclose(simulator_device_1_wire.state, expected_density_matrix, **tol)
def encoding(phi, gamma):
    for i in range(3):
        qml.RZ(phi[i], wires=[i])
        cirq_ops.PhaseDamp(gamma, wires=[i])