예제 #1
0
def test_zeros_sampler_many_measure():
    qubits = cirq.LineQubit.range(6)
    circuit = cirq.Circuit(cirq.H.on_each(*qubits),
                           cirq.measure_each(*qubits, key_func=str))
    sampler = recirq.ZerosSampler()
    result = sampler.run(circuit, repetitions=155)
    assert len(result.measurements) == 6
    for k, v in result.measurements.items():
        assert v.shape == (155, 1)
예제 #2
0
def test_zeros_sampler_one_big_measure():
    qubits = cirq.LineQubit.range(6)
    circuit = cirq.Circuit(cirq.H.on_each(*qubits),
                           cirq.measure(*qubits, key='asdf'))

    sampler = recirq.ZerosSampler()
    result = sampler.run(circuit, repetitions=155)
    assert len(result.measurements) == 1
    bitstrings = result.measurements['asdf']
    assert bitstrings.shape == (155, 6)