示例#1
0
def dd_wrapper(H, tau_list, dt, N, mu, sigma, corr_time, seed):
    N = 1
    e = []

    # Initial state
    rho_0 = init_qubit([1, 0, 0])

    for tau_final in tau_list:
        dw_it = normal_autocorr_generator(mu, sigma, corr_time / dt / 2, seed)
        tau = np.arange(tau_final, step=dt)
        e.append(
            dynamical_decoupling(H, rho_0, N, tau_final, tau.shape[0], dw_it))
    return e
def test_only_hamiltonian_no_t():

    # Simple sigma z Hamiltonian
    H = lambda t: sz
    # Start in |+> state
    rho_0 = init_qubit([1, 0, 0])
    tlist = np.linspace(0, 10, 1000)

    rho, expect = lindblad_solver(H, rho_0, tlist, e_ops=[si, sx, sy, sz])

    expected_sx = np.cos(2 * tlist)
    expected_sy = np.sin(2 * tlist)
    expected_sz = np.zeros_like(tlist)

    assert_almost_equal(expect[0, :], 1, 3)
    assert_almost_equal(expect[1, :], expected_sx, 2)
    assert_almost_equal(expect[2, :], expected_sy, 2)
    assert_almost_equal(expect[3, :], expected_sz, 2)
示例#3
0
    "legend.fontsize": 14,
    "xtick.labelsize": 14,
    "ytick.labelsize": 14,
}

mpl.rcParams.update(nice_fonts)


def H(t):
    return sz * np.pi


tau_list = np.linspace(0, 3, 100)
e = []
for tau in tqdm(tau_list):
    rho = init_qubit([1, 0, 0])
    tlist = np.linspace(0, tau, 100)
    rho, expect = lindblad_solver(H,
                                  rho,
                                  tlist,
                                  c_ops=[np.sqrt(0.5) * sz],
                                  e_ops=[])
    rho = sx @ rho @ sx
    rho, expect = lindblad_solver(H,
                                  rho,
                                  tlist,
                                  c_ops=[np.sqrt(0.5) * sz],
                                  e_ops=[sx])
    e.append(1 / 2 + np.trace(rho @ sx) / 2)

plt.figure(figsize=(6, 3))
示例#4
0
    wL = args[0]
    w_tilde = np.sqrt((A + wL)**2 + B**2)
    mz = (A + wL) / w_tilde
    mx = B / w_tilde
    alpha = w_tilde * tau
    beta = wL * tau
    term1 = np.cos(alpha) * np.cos(beta) - mz * np.sin(alpha) * np.sin(beta)
    term2 = mx**2 * (1 - np.cos(alpha)) * (1 - np.cos(beta)) / (1 + term1)
    M = 1 - term2 * np.power(np.sin(N * np.arccos(term1) / 2), 2)
    return (M + 1) / 2


if __name__ == '__main__':
    steps = 25
    N = 32
    rho_0 = np.kron(init_qubit([1, 0, 0]), init_qubit([0, 0, 0]))
    taus = np.linspace(9.00, 15.00, 100)

    args1 = [1.0, 0.1, np.pi / 4]

    parameters1 = list(
        product([single_carbon_H], [rho_0], [N], taus, [steps], [args1[0]],
                [args1[1]], [args1[2]]))
    results1 = parmap.starmap(dynamical_decoupling,
                              parameters1,
                              pm_pbar=True,
                              pm_chunksize=3)

    args2 = [1.0, 0.2, np.pi / 6]
    parameters2 = list(
        product([single_carbon_H], [rho_0], [N], taus, [steps], [args2[0]],
示例#5
0
    rk_iterator = _runge_kutta_generator(H, rho, tlist, c_ops, *args)

    for i, rho in enumerate(rk_iterator):
        if len(e_ops):  # Compute all the expectations if any
            expectations[:, i] = np.trace(rho @ e_ops_np, axis1=1, axis2=2)

    return rho, expectations


if __name__ == "__main__":

    def H(t, frequency):
        return sz * frequency / 2

    rho_0 = init_qubit([1, 0, 0])
    tlist = np.linspace(0, 3.2, 1000)

    frequency = 1 * 2 * np.pi
    rho, expect = lindblad_solver(
        H,
        rho_0,
        tlist,
        frequency,  # Extra argument to H
        c_ops=[np.sqrt(0.5) * sz],
        e_ops=[si, sx, sy, sz])

    rho = sx @ rho @ sx

    rho, expect_2 = lindblad_solver(
        H,