Regarding real quantum computers of IBM, can one execute a circuit that contains measurements and afterwards get counts and then, based on the results of measurements (from counts), decide if to build circuit A or circuit B that will be executed on the same quantum register with init_qubits=False and with use of rep_delay parameter, so that the chosen circuit, A or B will run on the quantum register with output state of the first circuit?


Currently (Feb 2021), no. The run/measure/condition/run loop needs to be handled on user-side and it is not possible to preserve the state of quantum register among runs.

However checkout the IBM Quantum Development Roadmap:


Jay Gambetta explains that in 2021 IBM will launch the Quantum Runtime. By bringing together classical and quantum computation on the server-side you should be able to run a Quantum Program that contains a similar logic to the one you are describing. However, you are interested in continuing a computation without reseting the quantum registers.

In 3:32 of the same video, Jay describes Dynamic Circuits. That's much closer to what you are searching for. Circuit with branching in them. They are planned for 2022.

If you prefer reading over a video, here is the roadmap as a blog post: https://www.ibm.com/blogs/research/2021/02/quantum-development-roadmap/

If you are curious about how a Quantum Program might look like, check the OpenQASM3 specification draft: https://qiskit.github.io/openqasm/

Update (Feb 2021): In the direction towards dynamic circuit (and a positive answer to your question), today is possible to do mid-circuit measurements in the IBMQ backends.

Here, an example:

from qiskit import *

provider = IBMQ.load_account()
backend = provider.get_backend('ibmqx2')

circuit = QuantumCircuit(1,2)


result = execute(circuit, backend).result()

enter image description here

enter image description here

This allows you to continue the execution after measurement. Consider that the first measurement colapses the superposition to either 0 or 1. The X gate flips that first result and then it is saved in the second classical bit.

  • $\begingroup$ Thanks a lot. But it sounds like it can be done now, but as you wrote, on the user side? And I wonder, how it can be done. $\endgroup$ – AL_P Feb 11 at 13:38
  • $\begingroup$ because it is not possible to preserve the state of a quantum register among runs, it is not possible to do that on user-side. I updated the first paragraph to clarify that. $\endgroup$ – luciano Feb 11 at 13:44
  • $\begingroup$ Thanks, but if I use init_qubits=False for the second circuit with a very small rep_delay parameter value, wouldn't it be possible to preserve the state? or that preserving state between executions is just completely impossible? $\endgroup$ – AL_P Feb 11 at 13:48
  • 1
    $\begingroup$ the user-server-user cycle is way too long relative to the decoherence time. Decoherence destroys everything. The challenge is to bring CPU/QPU very closely (as is planned in the roadmap for 2022) to be able to classically compute inside the decoherence window. $\endgroup$ – luciano Feb 11 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.