3
$\begingroup$

Can Qiskit's c_if be used on a real quantum computer of IBM? And if it can, can it put a condition only on Qiskit gates like X, H, U1, U2, etc, or is there some way to make the conditioned operation to be a user defined operation, like a block of code, or a user defined gate? Is there other ways to do operations which are conditioned on the classical register measurements results, which will work on real quantum devices (or at least on a simulator)?

$\endgroup$
4
$\begingroup$

As far as I know, c_if operation is not implementable on IBM's hardware currently. But it should be implementable on simulator.

For instance, if I tried to execute this "teleportation" circuit on the hardware:

enter image description here

I would get the following error:

enter image description here

Note that I was able to execute the same circuit on the IBM qasm_simulator.


However, thanks to principle of deferred measurement, we can push the measurement all the way back to the end of the circuit. That is, you can convert the above circuit into an equivalent circuit with measurement operations being executed at the very end of the circuit:

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks a lot!!! @KAJ226 but I want to call a function or do set of operations according to the measurement results stored in the classical register. Is there a way of doing so on a real device/simulator? $\endgroup$ – AL_P Jan 10 at 3:06
  • 1
    $\begingroup$ So if you just need to do some post processing calculations on the classical computer from the result of the measured results then it's fine.. but if you want to do a measurement mid circuit, and do more operation on the quantum circuit after measurement then it is not possible. So mid-circuit measurements is not yet available in IBM hardware (whereas they do for Honeywell system) but it should be available in the near-future. On IBM hardware, you have the ability to do qubit reset only. That is, you can make a measurement in mid-circuit to get the collapsed state but then reset it to |0> $\endgroup$ – KAJ226 Jan 10 at 4:18

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.