qadence icon indicating copy to clipboard operation
qadence copied to clipboard

[Bug] Drawing krons of non-consecutive blocks

Open jpmoutinho opened this issue 1 year ago • 2 comments

The following works:

from qadence import *
from qadence.draw import display

b0 = X(0) @ X(1)
b1 = X(2) @ X(3)
b2 = kron(b0, b1)
display(b2)

The following does not:

from qadence import *
from qadence.draw import display

b0 = X(0) @ X(2)
b1 = X(1) @ X(3)
b2 = kron(b0, b1) # Works up to here, building the correct block
display(b2) # Here fails with "AssertionError: Make sure blocks act on distinct qubits!"

jpmoutinho avatar Dec 28 '23 15:12 jpmoutinho

Hey! Thanks for catching this one. There is unfortunately no obvious way to plot this... unless we convert overlapping blocks to chains.... what do you think is a reasonable plot here? the same as in the first case? because if we have tags around e.g. b0 we will run into trouble

nmheim avatar Jan 08 '24 09:01 nmheim

Hey! Thanks for catching this one. There is unfortunately no obvious way to plot this... unless we convert overlapping blocks to chains.... what do you think is a reasonable plot here? the same as in the first case? because if we have tags around e.g. b0 we will run into trouble

I think it would be fine to draw it as if it was a chain.

jpmoutinho avatar Jan 08 '24 10:01 jpmoutinho