I found it odd that the result of the action of identity gate (namely a $2\times2$ identity matrix) on a pure state $|0\rangle$ (namely the vector corresponding to the $2\times1$ matrix $\begin{bmatrix} 1\\0 \end{bmatrix}$) becomes a $2\times2$ matrix $\begin{bmatrix} 1+0\cdot i&0+0\cdot i\\0+0\cdot i&1+0\cdot i \end{bmatrix}=\begin{bmatrix} 1&0\\0&1 \end{bmatrix}$ as I found it HERE (QISKit tutorial page): enter image description here

Also, when one lets for more precision, the result gets odd:

enter image description here

Why is this? The same thing happens for other gates listed on the page referenced above.


In the first case you are not asking for the state but the unitary matrix representing the circuit. This is correct and just rounding error. It looks like you are not using the latest version so I would update.

In the second case are you sure that you don’t have a previous circuit loaded in memory. In that notebook all examples have the same circuit name and it looks like this is a different gate. If i had to guess it is the u2 example. If this is not the case you have found a bug and please submit an issue and we try to debug it.

I would also change the title as this is not a general quantum computing question to one qubit gates errors in qiskit or something like that.

  • $\begingroup$ Thanks for your response. If job.result().get_data(circuit) returns the circuit itself, what command gives the result of the operation? $\endgroup$ – Mathist Jun 25 '18 at 2:50
  • $\begingroup$ Regarding the second issue, you're right, I had the version 0.5.3. I updated it and now it's fixed (to version 0.5.4). I just wanted to report an issue related to update: HERE, it says to use conda env update -f QISKitenv.yml to upgrade it, but it didn't work for me. This worked HERE pip install -U qiskit. Just for future reference. $\endgroup$ – Mathist Jun 25 '18 at 3:26
  • $\begingroup$ Ok then we have not updated the tutorial it’s get_unitary . $\endgroup$ – Jay Gambetta Jun 25 '18 at 12:04
  • 1
    $\begingroup$ Oh I see what you want. Change local_unitary_simulator to local_statevecotor_simulator it take the answer you have and times it by a vectors. $\endgroup$ – Jay Gambetta Jun 26 '18 at 1:32
  • 1
    $\begingroup$ This does not make sense. I think it’s best to move this to github as an issue. $\endgroup$ – Jay Gambetta Jun 26 '18 at 23:07

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.