If I want to run a circuit on a real quantum computer, I have to measure it before running it. For example:
qc=QuantumCircuit(2) qc.x(0) qc.x(1) qc.cx(0,1) **qc.measure_all()**
To run on a quantum computer:
#Import IBMQ from qiskit import IBMQ #different companies(IBM ic)'s quantum provider from qiskit.providers.ibmq import least_busy #ask for the least busy quantum computer provider = IBMQ.get_provider(hub='ibm-q') backend = least_busy(provider.backends(filters=lambda x: x.configuration().n_qubits >= 2 and not x.configuration().simulator #dont want a simulator, want a actual machine and x.status().operational==True)) #want an operational machine #tell us what the least busy one is print("least busy backend: ", backend) # send the job to a quantum computer job = execute(qc, backend=backend, shots=100) result = job.result() #then we plot our histogram as usual counts = result.get_counts(qc) plot_histogram(counts)
I am wondering why do we have to measure the circuit before sending it to the real quantum computer? I know that we shouldn't measure the circuit if we send it to a statevector simulator.