One of the oldest and still most important concept in classical computing software is the IF statement. This statement allows a program to inspect the value of a variable and then take different courses of action depending upon the result.

Up until recently, the available quantum computers did not have the capability of supporting conditional execution.  So none of the existing quantum computing algorithms (Shor’s, Grover’s, Phase Estimation, QFT, VQE, QAOA, etc.) use anything like an IF statement.  Once you set up your circuit, the computer executes it straight through without any deviations or changes.  Once that circuit fully completes, you can run another circuit right after it but you can’t make any changes in the middle of a circuit.

The reason supporting an IF statement is a difficult challenge for the hardware is because of the short decoherence times available in the early generations of quantum computers.  By the time it would take to measure an ancilla qubit, feed the result to the classical control electronics, figure out the new instruction path, and send new control signals to other qubits in the system, it can be too late.  The latency involved can be too long and the other qubits may have already reached their coherence lifetime and may have collapsed. There has previously been a few previous experimental investigations (see here, here, and here), of this capability, particularly for use in error correction schemes.  However, these experiments were not in deployed systems nor were they envisioned to be used for supporting IF statements in a software algorithm.

This situation has changed recently with the availability of the Honeywell ion trap device.  Because the ion trap qubits have much longer coherence times in the millisecond or even second range, it is possible to implement this capability and Honeywell calls it their “mid-circuit measurement” feature. That feature did not receive as much attention as perhaps it should have but we think it may become an important capability in the future.  Not only does this allow a quantum IF statement, but it is also possible to reuse the measurement qubit after the measurement is complete and make it available for use in a later portion of the circuit.  This may reduce the total number of qubits needed in the computer to execute the program.

Up until now, no published algorithm or paper utilized this capability but the first use has just been described in a paper published by researchers at J.P. Morgan titled Quantum Simulation of Galton Machines Using Mid-Circuit Measurement and Reuse. The paper describes using this capability to implement an efficient state preparation algorithm to load a normal distribution into a quantum register that requires half the number of qubits than other methods. This task is the first step for algorithms including option pricing, matrix inversion, machine learning and others.

So for quantum computing algorithm designers, this new capability represents unexplored territory. There may many new algorithms or efficiencies that may become possible with this new capability and it will be interesting to see what comes out.

We also expect that in the future other quantum hardware designers will find a way to incorporate a mid-circuit measurement capability into their hardware. The quantum hardware companies are working to increase the coherence times of their qubits and also to decrease the latencies in their control electronics.  If they can improve these enough, they would be able to implement a mid-circuit measurement feature in their machines too.

As we said at the beginning of this piece, the IF statement is a powerful programming concept in the classical world that is ubiquitous in the classical world. So it would not be surprising if it eventually becomes popular for quantum algorithms once more hardware designs are available to support it and algorithm designers learn how to take advantage of it.

September 17, 2020