Ejemplo n.º 1
0
def test_acquire_dfe_data(benchmarker: BenchmarkConnection, qvm):
    # pick (Clifford) process that acts as identity on qubits 0 and 1
    process = Program(X(2), X(3))
    texpt = generate_exhaustive_state_dfe_experiment(benchmarker=benchmarker,
                                                     program=process,
                                                     qubits=[0, 1])
    dfe_data = acquire_dfe_data(qc=qvm, expt=texpt)
    fid_est, fid_std_err = estimate_dfe(dfe_data, 'state')

    assert_allclose(fid_est, 1.0)
    assert_allclose(fid_std_err, 0.0)
def test_acquire_dfe_data(benchmarker: BenchmarkConnection, test_qc):
    # pick (Clifford) process that acts as identity on qubits 0 and 1
    process = Program(X(2), X(3))
    texpt = generate_exhaustive_state_dfe_experiment(program=process,
                                                     qubits=[0, 1],
                                                     benchmarker=benchmarker)
    dfe_data = acquire_dfe_data(qc=test_qc, expr=texpt)
    dfe_estimate = estimate_dfe(dfe_data, 'state')

    assert dfe_estimate.dimension == 4
    assert dfe_estimate.qubits == [0, 1]
    assert_allclose(dfe_estimate.fid_point_est, 1.0)
    assert_allclose(dfe_estimate.fid_std_err, 0.0)
def test_exhaustive_state_dfe_run(benchmarker: BenchmarkConnection):
    wfnsim = NumpyWavefunctionSimulator(n_qubits=1)
    process = Program(X(0))
    texpt = generate_exhaustive_state_dfe_experiment(program=process,
                                                     qubits=[0],
                                                     benchmarker=benchmarker)
    for setting in texpt:
        setting = setting[0]
        prog = Program()
        for oneq_state in setting.in_state.states:
            prog += _one_q_state_prep(oneq_state)
        prog += process

        expectation = wfnsim.reset().do_program(prog).expectation(
            setting.out_operator)
        assert expectation == 1.
def test_exhaustive_state_dfe(benchmarker: BenchmarkConnection):
    texpt = generate_exhaustive_state_dfe_experiment(program=Program(
        X(0), X(1)),
                                                     qubits=[0, 1],
                                                     benchmarker=benchmarker)
    assert len(texpt) == 2**2 - 1