Esempio n. 1
0
    results_list = []

    args = []
    for i in range(n_B):
        args.append([i, lim_T, lim_S])

    with concurrent.futures.ProcessPoolExecutor(
            max_workers=workers) as executor:
        results = executor.map(compute_parameters, args)

        for result in results:
            results_list.append(result)
            pbar.update()
    pbar.refresh()

    args_temp = sort_solution(results_list)

    args = []
    for i in args_temp:
        for j in i:
            args.append(j)

    print('\nParameters computed')

    results_list = []

    pbar = tqdm(total=n_tf * n_B,
                desc='Processing',
                file=sys.stdout,
                ncols=90,
                bar_format='{l_bar}{bar}{r_bar}')
Esempio n. 2
0
            args.append(temp)  # Append the list

        with concurrent.futures.ProcessPoolExecutor(
                max_workers=workers) as executor:
            results = executor.map(solve_system_unpack_qutip,
                                   args,
                                   chunksize=4)
            for result in results:
                results_list.append(result)
                pbar.update()

    pbar.refresh()
    pbar.close()
    finish = timer.perf_counter()

    results = sort_solution(results_list)

    probabilities = []
    for temp in results:
        probabilities.append(np.abs(temp)**2)

    fidelity = np.zeros([n_2, n_13])
    for i in range(n_2):
        for j in range(n_13):
            index = i * n_13 + j
            temp = probabilities[index]
            fidelity[i, j] = temp[5]

    fig, ax = plt.subplots()
    data = np.log10(1 - fidelity).transpose()
    pos = ax.imshow(
Esempio n. 3
0
    # pool = Pool()
    # for i, result in enumerate(pool.imap_unordered(solve_system_unpack, args), 1):  # Iterate over all the desired parameters
    # 	results_list.append(result)  # Save the result
    # 	pbar.update()  # Update the progress bar
    # pool.terminate()  # Terminate the pool

    # for i in range(0, n_tf):
    # 	result = solve_system_unpack(args[i])
    # 	results_list.append(result)
    # 	pbar.update()

    final = timer.perf_counter()

    print('\nThe computation took {} s'.format(final - start))

    results_sort = sort_solution(results_list)  # Sort the async results

    fidelity = np.zeros(n_tf)
    for i in range(0, n_tf):
        fidelity[i] = results_sort[i][
            -1,
            0]  # Extract the data from the final time (i), last time computed (-1), and the state S(1,1) (1)

    maximum = False
    counter = 0
    while not maximum:
        if fidelity[counter] > fidelity[counter + 1]:
            index_max = counter
            maximum = True
        else:
            counter += 1