I don't understand this circuit's output from Qiskit's doc : .
Indeed, the result should be 13, but output, I think I don't have the right method to read the result. I should have $|1101\rangle$ but we can see $|1110\rangle$ instead. Maybe the right result is report on the classical register but I don't know how to read it?
-
$\begingroup$ Hi and welcome to Quantum Computing SE. Which backend do you use? A real QPU or simulator? How many shots is used? $\endgroup$– Martin VeselyDec 17, 2022 at 6:43
-
$\begingroup$ What section of the Qiskit docs is this from? $\endgroup$– Joseph GeipelDec 17, 2022 at 19:46
-
$\begingroup$ Your circuit is getting precisely the result it's supposed to. Why do you believe it calculates 7 * 4? $\endgroup$– Frank YellinDec 18, 2022 at 2:51
-
$\begingroup$ Hi and thanks for your answers. This circuit is extract from the IBM quantum composer’s IBM user guide in « Shor’s algorithm » chapters (quantum-computing.ibm.com/composer/docs/iqx/guide/…). At the end of the article, there is a lot of example of 7xmod15. I understand the input x but I don’t know how to read the output. $\endgroup$– JonahDec 20, 2022 at 8:30
1 Answer
By the gate you made, the input isn't 4
Note that my input. $$|x_1\rangle = |q_3 q_2 q_1 q_0\rangle $$ In the circuit you made, would be something like:
$$ |x_2\rangle = |q_0 q_1 q_2 q_3\rangle $$
In conclusion, when $ |x_1\rangle = |0100\rangle = |4\rangle$, your state must be: $|x_2\rangle = |0010\rangle = |2\rangle $ for a equivalent output value.
So you can either change the input state to 2 or the second SWAP gate's positon