コード例 #1
0
def solve_and_print_stats(e_qs: EvolvingQubitSystem):
    import time
    start_time = time.time()
    e_qs.solve()
    print(f"Solved in {time.time() - start_time:.2f}s")

    fidelity_with_ghz = e_qs.get_fidelity_with("ghz")
    fidelity_with_ghz_asymmetric = e_qs.get_fidelity_with("ghz_antisymmetric")
    print(f"fidelity with GHZ: {fidelity_with_ghz:.4f} (with antisymmetric: {fidelity_with_ghz_asymmetric:.4f})")
    fidelity_with_ground = e_qs.get_fidelity_with("ground")
    fidelity_with_excited = e_qs.get_fidelity_with("excited")
    superposition_probability = fidelity_with_ground + fidelity_with_excited
    print(
        f"superposition probability: {superposition_probability:.4f} (g: {fidelity_with_ground:.4f}, e: {fidelity_with_excited:.4f})")
    e_qs.plot(with_antisymmetric_ghz=True)
コード例 #2
0
def solve_and_print_stats(e_qs: EvolvingQubitSystem):
    e_qs.solve()
    fidelity_with_ghz = e_qs.get_fidelity_with("ghz")
    fidelity_with_ghz_asymmetric = e_qs.get_fidelity_with("ghz_antisymmetric")
    print(
        f"fidelity with GHZ: {fidelity_with_ghz:.4f} (with antisymmetric: {fidelity_with_ghz_asymmetric:.4f})"
    )
    fidelity_with_ground = e_qs.get_fidelity_with("ground")
    fidelity_with_excited = e_qs.get_fidelity_with("excited")
    superposition_probability = fidelity_with_ground + fidelity_with_excited
    print(
        f"superposition probability: {superposition_probability:.4f} (g: {fidelity_with_ground:.4f}, e: {fidelity_with_excited:.4f})"
    )

    e_qs.plot(with_antisymmetric_ghz=True,
              savefig_name="evolving_fidelities.png",
              show=True)
コード例 #3
0
def rescale_evolving_qubit_system():
    t = 1.1e-6
    N = 4
    e_qs = EvolvingQubitSystem(
        N=N,
        V=paper_data.V,
        geometry=RegularLattice1D(),
        Omega=paper_data.get_hamiltonian_coeff_fn(paper_data.Omega, N),
        Delta=paper_data.get_hamiltonian_coeff_fn(paper_data.Delta, N),
        t_list=np.linspace(0, t, 100),
        ghz_state=AlternatingGHZState(N))
    e_qs.solve()
    # e_qs.plot()

    print(e_qs.get_fidelity_with("ghz"))

    max_Omega = 50e6

    e_qs = EvolvingQubitSystem(
        N=N,
        V=paper_data.V / max_Omega,
        geometry=RegularLattice1D(),
        Omega=paper_data.get_hamiltonian_coeff_fn(
            {
                k: {_k * max_Omega: _v / max_Omega
                    for _k, _v in v.items()}
                for k, v in paper_data.Omega.items()
            }, N),
        Delta=paper_data.get_hamiltonian_coeff_fn(
            {
                k: {_k * max_Omega: _v / max_Omega
                    for _k, _v in v.items()}
                for k, v in paper_data.Delta.items()
            }, N),
        t_list=np.linspace(0, t * max_Omega, 100),
        ghz_state=AlternatingGHZState(N))

    e_qs.solve()
    e_qs.plot()

    print(e_qs.get_fidelity_with("ghz"))
コード例 #4
0
def solve_and_print_stats(e_qs: EvolvingQubitSystem, **kwargs):
    import time
    start_time = time.time()
    e_qs.solve()
    print(f"Solved in {time.time() - start_time:.2f}s")

    fidelity_with_ghz = e_qs.get_fidelity_with("ghz")
    fidelity_with_ghz_asymmetric = e_qs.get_fidelity_with("ghz_antisymmetric")
    print(
        f"fidelity with GHZ: {fidelity_with_ghz:.4f} (with antisymmetric: {fidelity_with_ghz_asymmetric:.4f})"
    )
    fidelity_with_ground = e_qs.get_fidelity_with("ground")
    fidelity_with_excited = e_qs.get_fidelity_with("excited")
    superposition_probability = fidelity_with_ground + fidelity_with_excited
    print(
        f"superposition probability: {superposition_probability:.4f} (g: {fidelity_with_ground:.4f}, e: {fidelity_with_excited:.4f})"
    )
    e_qs.plot(with_antisymmetric_ghz=True,
              **kwargs,
              fig_kwargs={'figsize': (6, 4)},
              plot_titles=False,
              plot_others_as_sum=True)