示例#1
0
def test_measurement_keys_repeat(scheduler):
    circuit = Circuit()
    meas = XmonMeasurementGate('a')
    circuit.append([meas.on(Q1), X.on(Q1), X.on(Q2), meas.on(Q2)])
    simulator = xmon_simulator.XmonSimulator()
    with pytest.raises(ValueError, message='Repeated Measurement key a'):
        run(simulator, circuit, scheduler)
示例#2
0
def test_measurement_multiple_measurements_qubit_order(scheduler):
    circuit = Circuit()
    measure_a = XmonMeasurementGate('a')
    measure_b = XmonMeasurementGate('b')
    circuit.append(X(Q1))
    circuit.append([measure_a.on(Q1, Q2)])
    circuit.append([measure_b.on(Q2, Q1)])
    simulator = xmon_simulator.XmonSimulator()
    result = run(simulator, circuit, scheduler)
    np.testing.assert_equal(result.measurements['a'], [[True, False]])
    np.testing.assert_equal(result.measurements['b'], [[False, True]])
示例#3
0
def test_measurement_qubit_order(scheduler):
    circuit = Circuit()
    meas = XmonMeasurementGate(key='')
    circuit.append(X(Q2))
    circuit.append(X(Q1))
    circuit.append([meas.on(Q1, Q3, Q2)])
    simulator = xmon_simulator.XmonSimulator()
    result = run(simulator, circuit, scheduler)
    np.testing.assert_equal(result.measurements[''], [[True, False, True]])