下面给出的是我在 jupyter notebook 上运行的代码,我为此项目在 IBM 上创建了帐户。请帮忙 !
import qiskit as q
import numpy as np
import matplotlib
%matplotlib inline
circuit = q.QuantumCircuit(2 , 2) # 2 qubit and 2 classical bits
#currently: (0,0)
circuit.x(0)
#now : (1,0)
circuit.cx(0 , 1) #cnot gate , controlled NOT gate , it flips 2nd bit if 1 quibit is 1
# now : (1 , 1)
circuit.measure([0,1],[0,1]) # map quibit to bits
circuit.draw(output="mpl") # ascii of circuit
from qiskit import IBMQ
IBMQ.save_account('MY_TOKEN_NUMBER',overwrite=True) #save your creds
IBMQ.load_account()
#got this as output to prev line of code :
# <AccountProvider for IBMQ(hub='ibm-q', group='open', project='main')>
provider = IBMQ.get_provider(q.providers.baseprovider)