I would like to know if it is possible implement the following situation in Qiskit (either using the simulators or real quantum computers).
Consider this illustrative toy example:
The arrows illustrate that the outcomes $\{\sigma_1,...,\sigma_i\}$ determine the unitaries $U_j$ for $j=i+1,...,n$. That is, the idea is that the unitary $U_2$ can only be determined once the outcome $\sigma_1$ is known, then the unitary $U_3$ can be determined once $\sigma_1$ and $\sigma_2$ are known, and so on and so forth as we move along the circuit.
The main idea and difficulty is precisely that we do not know the unitaries a priori and need to calculate them from the previous outcomes. (Note that determining all the possible unitary sequences before we start the computation would mean $2^n$ possible sequences for a computation with $n$ layers.)
So basically, I need Qiskit to run the blue box, do the first measurement and stay in "stand-by" (so to speak) while I determine what $U_2$ is. Once I have that information I would have to append $U_2$ to the previous circuit and execute this new portion of the circuit alone (i.e. without running the previous one again!). (If Qiskit re-executes the first block again, it might get the wrong outcome for $\sigma_1$ and everything will be ruined). Is this possible at all? If not: (i) what is the next best thing? and (ii) is there a prediction for when such functionality will be available and in which shape?
Thank you all!
EDIT: I seem to be looking for this: https://www.ibm.com/blogs/research/2021/02/quantum-phase-estimation/ ("dynamic quantum circuits"). There is also the arxiv pre-print reporting this: https://arxiv.org/abs/2102.01682. Now, I need only understand if this is a functionality that is accessible to general IBMQ users like myself, or if it is still to be made available.
Particularly, what I want is what the authors call "real-time compute" or "classical real-time logic". Because what I want to write is an algorithm that requires a dynamic circuit, not a static one.

- I don't know the unitaries $U_i$ beforehand (i.e., before I run the circuit). I have to "learn" them as I go along. (Think one-way model of MBQC if it helps).
- At each point, it is not that I apply $U_2$ if $\sigma_1=1$, it is that I applied that if $\sigma_1=1$ or $U_2^{\prime}$ if $\sigma_1=0$.
- If there are $n$ such unitaires, the $n$-th unitary does not depend solely on $\sigma_{n-1}$ but rather on the whole sequence {$\sigma_1$,...,$\sigma_{n-1}$}.
– fcrp Jun 20 '21 at 08:54