In Stim's color_code:memory_xyz, the all data qubits are first initialized to the |0> state, then the Z-type stabilizer measurement circuit is executed, and finally, measurements are taken in the Z basis. There are two questions about this circuit. The first question is that it seems to only detect X errors and not Z errors; how should the circuit be modified if we want to detect Z errors(and also Y errors) as well? The second question is that it seems that the data qubits are not encoded into a code state at the beginning of the circuit; why is that?


1 Answer 1


It's executing a color code. But instead of alternating between measuring X stabilizers and Z stabilizers, it cycles between measuring X stabilizers then Y stabilizers then Z stabilizers. And it does this by starting each round by applying the a 120 degree rotation around X+Y+Z to each of the data qubits (called "C_XYZ"; it sends X to Y, Y to Z, and Z to X). This has the effect of the one round measuring $X^{\otimes 6}$, the next round measuring $Y^{\otimes 6}$, and the next round measuring $Z^{\otimes 6}$, then repeating, even though each round's operations are identical.

For details, here's the diagram output by

stim gen --code color_code --task memory_xyz --distance 5 --rounds 9 \
     | stim diagram --type detslice-with-ops-svg --tick 16:41 --filter_coords D30 \
     > tmp.svg

enter image description here

This shows the sensitivity regions of one of the detectors declared in the circuit. The detectors work by comparing three measurements in the same location across three rounds. Instead of using the fact that $X^{\otimes 6} \cdot X^{\otimes 6} = I$ to get a deterministic comparison when no noise is present, they're using the fact that $X^{\otimes 6} \cdot Y^{\otimes 6} \cdot Z^{\otimes 6} = -I$. That's why it's combining three measurements instead of two.

Anyways, this is just a minor variation on the concept of a color code. The upside of this variation is that it should have a higher timelike distance for the same number of rounds (because you need two measurement errors to move a detection event three rounds, instead of one error to move it two rounds). The downside is that it requires a slightly different decoder.

  • $\begingroup$ In that method, noise would be sampled for each stabilizer measurement of X, Y, and Z, so I think different errors would be measured for each one. Is that not a problem? Normally, I think it is necessary to perform stabilizer measurements to detect X, Y, and Z errors for a single depolarizing noise sample. $\endgroup$
    – lan
    Commented Apr 23, 2023 at 5:12
  • $\begingroup$ @Ian The whole point of it being a fault tolerant code is that it can survive noise that occurs while it runs (up to some threshold). Any fault tolerant circuit will have dozens of noise sources per measurement; it has to survive anyway. $\endgroup$ Commented Apr 23, 2023 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.