I am trying to implement 5 qubit encoding and decoding circuit which results into generation of syndrome bits that pin points the location of error so that we can correct it afterwards. Please have a look at the below table and the main circuit for reference:

enter image description here

enter image description here

I am not getting these results for some reason. Here's the link to the circuit I made in IBM: link

Please guide me through it. Thank you !


1 Answer 1


The encoding circuit from that paper is weirdly complicated, with things like CSWAPs when only Clifford operations are required (Update: talking with Dave Bacon, I learned this paper predates our conventions on how operations are drawn. Those aren't CSwaps they're multiple CNOTs! Regardless, it does use more gates than necessary.).

Anyways, here's the not-quite-equivalent-but-still-a-5-qubit-code encoding circuit that I found:


And here's a quirk circuit validating that it can correct all single qubit errors:


The validation works by preparing an entangled qubit to encode, picking a random single qubit error to apply, then checking that at the end that the qubit was still correctly entangled with its partner.

Here's an even more compact and symmetrical one, using X basis controls and parity controls (though it again shuffles the corrections):


  • $\begingroup$ This circuit will generate similar syndrome bits as in the case of Laflamme's paper? Regarding Laflamme's circuit in the paper it's return that those are CNOT gates so to implement it I simply added 2 different CNOT operations in two steps to form that multiqubit control. Was I wrong there ? $\endgroup$
    – Sid
    Mar 25, 2022 at 9:08
  • $\begingroup$ @Sid No I think you were right. But yes this circuit will have slightly different corrections. You can see them at the end of the verification circuit, $\endgroup$ Mar 25, 2022 at 15:44
  • $\begingroup$ can you please shed a light on how you came up with the correction circuit in quirk link you mentioned in the answer ? $\endgroup$
    – Sid
    Mar 26, 2022 at 8:49
  • $\begingroup$ @Sid I applied a specific error, looked at the resulting symptoms, looked at how the output state was wrong, and fixed the output state conditioned on the exact symptoms. Repeat 15 times. $\endgroup$ Mar 26, 2022 at 11:16

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.