How can we compute a 9 qubit correction code using python, without qiskit library or others?


1 Answer 1


There are several pieces of functionality you have to write, or avoid writing, in order to do this:

  • A decoder. Something that takes the errors that occurred and predicts what corrections are needed.
  • A stabilizer simulator. Something that can execute the quantum circuit that performs the code.
  • The error correcting code itself. Some pattern of things to prepare and measure and compare.

For a 9 qubit code, you can get away with using a dumb decoder such as a table lookup decoder. This decoder will not work for bigger codes because it becomes extremely inefficient, but it's easy to write and it works on small cases.

You can mostly avoid writing a stabilizer simulator by assuming you can just magically measure the stabilizers of the code. This isn't really realistic in the context of fault tolerant computation, but it would be relevant in a communication scenario where the sender and receiver are perfect quantum computers and noise only accumulates during transit. In other words, focus on code capacity noise or phenomenological noise instead of on circuit noise. Your simulator in that case will just involve knowing which errors flip which stabilizers.

For a 9 qubit code, the structure of the error correcting code itself shouldn't be too hard to write.

If you want to do full circuit noise with a more complex code, like a high distance surface code, there are major advantages to using existing libraries. You probably don't want to write your own min weight matching decoder. I would estimate that writing a solid scalable decoder takes months, a solid scalable stabilizer simulator takes weeks, and a small error correcting code takes days. If everything goes smoothly then days is hours, weeks is days, and months is weeks... but generally everything does not go smoothly. By using existing libraries you can save yourself weeks or months of work.


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.