Example #1
0
def single_q_tomo_fixture(basis, single_q_process, measurement_func):
    qubits = [0]
    process, u_rand = single_q_process
    tomo_expt = generate_process_tomography_experiment(process, qubits, in_basis=basis)
    results = measurement_func(tomo_expt)

    return qubits, results, u_rand
Example #2
0
def test_single_qubit_y(qvm):
    qvm.qam.random_seed = 1
    process = Program(RY(pi, 0))

    exp_desc = generate_process_tomography_experiment(process)
    exp_data = acquire_tomography_data(exp_desc, qvm)
    estimate = pgdb_process_estimate(exp_data)
    assert np.allclose(estimate.estimate.process_choi_est,
                       kraus2choi(sigma_y),
                       atol=.01)
Example #3
0
def test_two_qubit_cnot(qvm):
    qvm.qam.random_seed = 2
    process = Program(CNOT(5, 3))

    exp_desc = generate_process_tomography_experiment(process)
    exp_data = acquire_tomography_data(exp_desc, qvm, var=.05)
    estimate = pgdb_process_estimate(exp_data)
    assert np.allclose(estimate.estimate.process_choi_est,
                       kraus2choi(REVERSE_CNOT_KRAUS),
                       atol=.05)
Example #4
0
def test_two_qubit_identity(qvm):
    qvm.qam.random_seed = 2
    process = Program(I(1)).inst(I(3))

    exp_desc = generate_process_tomography_experiment(process)
    exp_data = acquire_tomography_data(exp_desc, qvm, var=.05)
    estimate = pgdb_process_estimate(exp_data)
    assert np.allclose(estimate.estimate.process_choi_est,
                       kraus2choi(np.eye(4)),
                       atol=.06)
Example #5
0
def test_single_qubit_rx(qvm):
    qvm.qam.random_seed = 1
    process = Program(RX(pi / 2, 0))

    exp_desc = generate_process_tomography_experiment(process)
    exp_data = acquire_tomography_data(exp_desc, qvm, var=.005)
    estimate = pgdb_process_estimate(exp_data)
    assert np.allclose(estimate.estimate.process_choi_est,
                       kraus2choi(expm(-1j * pi / 4 * sigma_x)),
                       atol=.01)
Example #6
0
def test_two_qubit_cnot_rx_rz(qvm):
    qvm.qam.random_seed = 1
    process = Program(CNOT(0, 1)).inst(RX(pi / 2, 0)).inst(RZ(1, 1))

    exp_desc = generate_process_tomography_experiment(process)
    exp_data = acquire_tomography_data(exp_desc, qvm, var=.05)
    estimate = pgdb_process_estimate(exp_data)
    rx = np.kron(
        np.eye(2),
        expm(-1j * pi / 4 * sigma_x),
    )
    rz = np.kron(expm(-1j / 2 * sigma_z), np.eye(2))
    assert np.allclose(estimate.estimate.process_choi_est,
                       kraus2choi(rz @ rx @ CNOT_KRAUS),
                       atol=.05)