Exemple #1
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)
Exemple #2
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)
Exemple #3
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)
Exemple #4
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)
Exemple #5
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)
Exemple #6
0
def test_two_q_pgdb(two_q_tomo_fixture):
    qubits, results, u_rand = two_q_tomo_fixture
    process_choi_est = pgdb_process_estimate(results, qubits=qubits)
    process_choi_true = kraus2choi(u_rand)
    np.testing.assert_allclose(process_choi_true, process_choi_est, atol=0.05)