コード例 #1
0
def schrodinger_with_Z_gates_experiment():
    pi_val = np.pi/2
    qc = schrodinger_circle_with_Z_gates(pi_val)
    qc.draw(output='mpl')
    # plt.show()
    counts = tools.simulate(qc).get_counts()
    print(counts)
    plot_histogram(counts, title="Šredingerio lygties būsenos, su Z vartų keitiniu, kai $\Phi = \\frac{\pi}{2}$ ")
    plt.show()
コード例 #2
0
def schrodinger_inverse_gates_experiment():
    pi_val = np.pi / 2

    qc = schrodinger_circle_inverse_gates(pi_val, measure=True)

    qc.draw(output='mpl')
    # plt.show()
    counts = tools.simulate(qc).get_counts()
    print(counts)
    plot_histogram(counts, title="Grįžtamos sistemos būsenos")
    plt.show()
コード例 #3
0
def simulate_all(qc_arr):
    columns = ['00', '01', '10', '11']

    index = list(range(len(pi_arr)))
    df = pd.DataFrame(index=index, columns=columns)
    for i in range(len(df)):
        df.iloc[i] = 0.0

    for i in range(len(pi_arr)):
        test_result = tools.simulate(qc_arr[i])
        for test in test_result.get_counts():
            value = test_result.get_counts()[test]
            df.iloc[i][test] = value
    df = df / 5000
    return df
コード例 #4
0
def quiskit_simuliation(test_matrix):
    qr = QuantumRegister(1, "qr")
    cr = ClassicalRegister(1, "cr")

    qc = QuantumCircuit(qr, cr)

    qc.unitary(test_matrix, [0], label='$ U_{perėjimo} $')
    qc.measure(qr[0], cr[0])  # measure q[1] -> c[0];

    qc.draw(output='mpl')
    result = tools.simulate(qc).get_counts()
    # plt.show()
    # result = tools.simulate_unitary(qc).get_unitary(qc, decimals=3) #.get_counts()
    # print(result)
    plot_histogram(result)
    plt.show()