Closed BoltzmannEntropy closed 1 year ago
Thanks for the issue, it is a matter of visualization, (I ⊗ Y ⊗ I ⊗ I) (Y ⊗ I ⊗ I ⊗ H) (X ⊗ H ⊗ H ⊗ H)
is equivalent to (Y ⊗ Y ⊗ I ⊗ H) (X ⊗ H ⊗ H ⊗ H)
. In YaoPlots
, the default rule for visualization is:
igate
on a line, it does not take any slot, andThere are two alternative ways to define the circuit that you wanted
julia> kron(I2, Y, I2, I2) * kron(Y, I2, I2, H) * kron(X, H, H, H)
circuit = chain(
4,
kron(X, H, H, H),
kron(1=>Y, 4=>H),
put(2=>Y),
)
Thanks for the prompt reply/ I already tried with a Kron command, even your examples above (both method1 and method 2) are not plotted correctly. the Y gate should be on a new slot.
All of them are correct. It is a matter of display. The number of slots in the plot is not equal to the number of blocks in the chain.
Yes, I understand that, but if I am trying to reproduce Figures from nielsen & chung I am never going to get the same plot while if i use qiskit/cirq I get the exact same plot.
We can add a new block Barrier
to the circuit to help visualization. How does it sounds like?
Many thanks for your suggestion, I wonder how no one has asked this before, for larger circuits involving many Krons and gates, it would be almost impossible to visually verify a gate without the plots being correctly displayed.
Hmm, what you said makes sense. Maybe we should add a global variable to toggle the display mode.
An example in cirq:
Thanks for the example. I added a new global variable in the PR: https://github.com/QuantumBFS/YaoPlots.jl/pull/60 to toggle the barrier mode and compact mode.
The reason why we use compact mode by default is, it do make some circuits more suitible for publication purpose. Please find an example in the comment of that PR.
I am having trouble understating the way the 'chain' command works.
Mathematically, this should have represented:
(I ⊗ Y ⊗ I ⊗ I) (Y ⊗ I ⊗ I ⊗ H) (X ⊗ H ⊗ H ⊗ H)
but what i get is that the third row, is mingled into the second row.