3
$\begingroup$

I ran the following code

enter image description here

which adds two 2-digit numbers on different back-ends and the simulator gives the expect result while all real QC's have a problem with the transpiling:

enter image description here

In fact, Melbourne was able to return some results but they were quite far from what expected and what the simulator returned. Has anybody encountered a similar problem? I paste below how the result looks when it fails:

enter image description here

$\endgroup$

3 Answers 3

2
$\begingroup$

I would add that you use 7 qubits, however, with exception of Melbourne the processors have less qubits (for example Armonk has only 1 qubit, Ourense 5 qubits etc.), so you cannot run the algorithm on them.

Melbourne has 15 qubits, so your algorithm is transpiled without error. Check number of qubits by click on particular processor on main page in IBM Q.

Note, simulator can be used for algorithms up to 32 qubits.

Unexpected results on Melbourne are given by too deep circuit.

$\endgroup$
1
  • 1
    $\begingroup$ Thank you for the very useful information. $\endgroup$ Apr 28, 2020 at 13:51
4
$\begingroup$

So without the OpenQASM code to import this is hard (I do not want to input it by hand) to verify what went wrong. However, in the case of unexpected results, it is important to note that every SWAP gate gets decomposed into 3 CX gates, and every CCX (Toffoli) gate becomes six CX gates and a handful of single-qubit gates. So your circuit is already quite long when decomposed. Add to this the need for additional SWAP gates to match the device topology and one can then see that the actual circuit run will have its output greatly affected by noise.

$\endgroup$
2
  • $\begingroup$ I need to use the swaps because the CCX gate jumps the wires in the standard CARRY subroutine (taken from Pittenger's book). I could get rid of the swaps at the end but I still need to figure how to control the classical digit where a qubit measurement goes. $\endgroup$ Apr 27, 2020 at 23:50
  • $\begingroup$ The main problem is number of qubit on processors (5 for Ourense, for example) and used in the circuit (7 qubits). See my answer. $\endgroup$ Apr 28, 2020 at 4:18
1
$\begingroup$

Without the OpenQASM code to import this is hard to verify what went wrong. However, in the case of unexpected results, it is important to note that every SWAP gate gets decomposed into 3 CX gates, and every CCX gate becomes six CX gates and a handful of single-qubit gates. So your circuit is already quite long when decomposed. Add to this the need for additional SWAP gates to match the device topology and one can then see that the actual circuit run will have its output greatly affected by noise.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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