quantumlib / Stim

A fast stabilizer circuit library.
Apache License 2.0
305 stars 88 forks source link

Crumble SWAPs don't show gate sensitivity correctly #778

Open mmcewen-g opened 1 month ago

mmcewen-g commented 1 month ago

For example:

https://algassert.com/crumble#circuit=Q(0,0)0;Q(0,1)1;Q(0,2)2;Q(0,3)3;R_0_1_2_3;MARKZ(0)0;MARKZ(1)2_3;TICK;TICK;SWAP_0_1_3_2;TICK;TICK;M_0_1_3_2;MARKZ(0)1;MARKZ(1)3_2

image

When a detecting region goes through a SWAP gate in both directions, it is shown to cancel out on the vertical bar of the gate

In a SWAP gate, this is mostly an incorrect interpretation; the channel in the middle of the swap gate supports 2 qubits of information rather than 1 qubit of information typically being moved vertically in 2Q gates (like CX or CZ), and so it is not the case that having Z sensitivity on both 'branches' of the swap gate cancels out the Z sensitivity in the middle of the gate

For SWAP and SWAP-like gates, the code coloring the vertical bars should follow more complex rules, and should color the bar if eg ZZ -> ZZ sensitivity through the gate