Trace is wrong but circuit looks correct

Trace is wrong but circuit looks correct

par Daniel Andrzej Polka,
Nombre de réponses : 4
Hi, I implemented the circuit in qiskit and it seems to be correct if I draw it using circuit.draw('mpl'). I computed |0⟩⟨0|⊗I +|1⟩⟨1|⊗U as one matrix in numpy and then converted it into a UnitaryGate, which I then applied to the right qubits. However, I'm getting seemingly random trace estimation results. Does anyone have an idea where I could be going wrong by any chance? This is my result for circuit.draw('mpl'):
Circuit
Thanks in advance for any responses.
En réponse à Daniel Andrzej Polka

Re: Trace is wrong but circuit looks correct

par Khurshed Porus Fitter,

I believe, if you look at the given circuit diagram again, it will be easy to spot the error :)

En réponse à Daniel Andrzej Polka

Trace is wrong but circuit looks correct

par Dina Khaled Sayed Abdelhadi,
Hi Daniel,
May be try to increase the number of shots.
En réponse à Dina Khaled Sayed Abdelhadi

Re: Trace is wrong but circuit looks correct

par Dina Khaled Sayed Abdelhadi,
That is, assuming you do the rest of the computation correctly.
In general, the more shots, the more accurate your estimate is. Try 1 million shots.