コード例 #1
0
    return bitwise_xor(bitwise_dot(a, rep), b)


if __name__ == "__main__":
    n = 2
    a = "11"
    b = "1"
    f = lambda rep: \
        bitwise_xor(bitwise_dot(a, rep), b)
    prog = build_circuit(n, f)
    sample_shot =4000
    writefile = open("../data/startQiskit_QC10.csv", "w")
    # prog.draw('mpl', filename=(kernel + '.png'))
    IBMQ.load_account() 
    provider = IBMQ.get_provider(hub='ibm-q') 
    provider.backends()
    backend = provider.get_backend("ibmq_belem")

    circuit1 = transpile(prog, FakeYorktown())
    circuit1.h(qubit=2)
    circuit1.x(qubit=3)
    circuit1.measure_all()

    info = execute(circuit1,backend=backend, shots=sample_shot).result().get_counts()

    print(info, file=writefile)
    print("results end", file=writefile)
    print(circuit1.depth(), file=writefile)
    print(circuit1, file=writefile)
    writefile.close()
コード例 #2
0
    a = "111"
    b = "1"
    return bitwise_xor(bitwise_dot(a, rep), b)


if __name__ == "__main__":
    n = 2
    a = "11"
    b = "1"
    f = lambda rep: \
        bitwise_xor(bitwise_dot(a, rep), b)
    prog = build_circuit(n, f)
    sample_shot = 4000
    writefile = open("../data/startQiskit_noisy204.csv", "w")
    # prog.draw('mpl', filename=(kernel + '.png'))
    backend = FakeYorktown()

    circuit1 = transpile(prog, FakeYorktown())
    circuit1.h(qubit=2)
    circuit1.x(qubit=3)
    circuit1.measure_all()

    info = execute(circuit1, backend=backend,
                   shots=sample_shot).result().get_counts()

    print(info, file=writefile)
    print("results end", file=writefile)
    print(circuit1.depth(), file=writefile)
    print(circuit1, file=writefile)
    writefile.close()