Esempio n. 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)
Esempio n. 2
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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)